I am starting this thread to collect various examples of bitmap graphics programming in fbForth 2.0.
This first example is a quick-and-dirty joystick drawing program, JDRAW , ported from the program of the same name I wrote four years ago for TI Forth in post #48 of thread, TI FORTH Version 3.0 dated October 20 1982. As I stated then, it is a pretty useless program except as a demo and proof of concept.
It uses the CRU mode of JOYST for joystick-only use. There is a three-choice menu accessed with the fire button. The choices are
- P—Toggle pen up/down [blue pen = pen down; white pen = pen up]
- D—Toggle draw/erase [ solid pen = draw mode; hollow pen = erase mode]
- Q—Quit program
The joystick moves the pen around the display screen.
There is much that could be done to make it more useful. One such thing would be to provide finer control over the pen—reaction to joystick movement is too fast for any useful drawing. Another would probably be to dispense with the menu and use the fire button for pen-up/pen-down. But, that leaves managing draw/erase mode, which would probably require using the JOYST word in keyboard (KSCAN) mode. Anyway, here is the fbForth 2.0 source code for JDRAW :
I will add a blocks file, later. For now, you can paste this in Classic99 at the command line of fbForth 2.0. Start the program by typing: