Original Author Paul Laughton, 2011
Page 154
De Re BASIC!
be a distinct, short buzz. Tap the BACK key to close the Graphics Screen upon feeling this alert. The error
messages can then read from the BASIC! Output Console.
Use the Gr.front command to swap the front-most screen between the Output Console and the graphics
screen.
Commands that use a new window or screen to interact with the user (Input, Select and others) may be
used in graphics mode.
When your program ends, the graphics screen will be closed. If you want to keep the graphics screen
showing, use a long pause or an infinite loop to keep the program from ending:
! Stay running to keep the graphics screen showing
do
until 0
Depending on your application, you may want to add a Pause to the loop to conserve battery power.
Tap the BACK key to break out of the infinite loop. The BACK key ends your program unless you trap it
with the OnBackKey: interrupt label.
Display Lists
Each command that draws a graphical object (line, circle, text, etc.) places that object on a list called the
Object List. The command returns the object's Object Number. This Object Number, or Object Pointer, is
the object's position in the Object List. This Object Number can be used to change the object on the fly.
You can change the parameters of any object in the Object List with the Gr.modify command. This
feature allows you easily to create animations without the overhead of having to recreate every object
in the Object List.
To draw graphical objects on the graphics screen, BASIC! uses a Display List. The Display List contains
pointers to graphical objects on the Object List. Each time a graphical object is added to the Object List,
its Object Number is also added to the Display List. Objects are drawn on the screen in the order in
which they appear in the Display List. The Display List objects are not visible on the screen until the
Gr.render command is called.
You may use the Gr.NewDL command to replace the current Display List with a custom display list array.
This custom display list array may contain some or all of the Object Numbers in the Object List.
One use for custom display lists is to change the Z order of the objects. In other words you can use this
feature to change which objects will be drawn on top of other objects.
See the Sample Program file, f24_newdl, for a working example of Gr.NewDL.
Drawing Coordinates
The size and location of an object drawn on the screen are specified in pixels. The coordinates of the
pixel at the upper-left corner of the screen are x = 0 (horizontal position) and y = 0 (vertical position).
Coordinate values increase from left to right and from top to bottom of the screen.