
231
The
DISPXY
command allows you to place a string of text at any position on
the screen using two different fonts. Until this command was added to the
language the only way to do this was to:
- save the current screen into a graphics variable.
- create a special GROB which contained the text.
- superimpose the GROB onto the stored image.
- redisplay the modified image onto the screen.
Quite apart from the fact that this was incredibly involved, it was very slow
and the command to create the GROB was very limited in what it would
allow.
The new command has the syntax:
DISPXY <x-pos>;<y-pos>;<font#>;<object>:
Suppose
M=2
&
C=3
. Then the command
will display the text “y=2x+3” using font #1 (small) at the top (Ymax) left
(Xmin) of the screen.
The next line places a label on the y axis (offset slightly) to mark the y-
intercept. A check is then done to see if an x-intercept exists and, if it does, a
label is placed to mark it. Any labels off the edge of the screen will be
ignored.
Finally the line itself is drawn. Even though part of the line extends off the
screen there is no problem - the excess is clipped.
The next section of code below waits until the user presses a key (
GETKEY
)
and stores the key’s code into the variable
K
.
A
CASE
statement is then used to check for the use of the arrow keys. Notice
the lack of colons (:) after each
END
in the
CASE
statement.