52.5 The graphics cursor and drawing lines
You have now tried some of the ways you can translate programs into graphic displays - and several
of the program commands and concepts have been given a chance to perform. When drawing lines at
the screen, there are some important considerations to watch out for to avoid confusion.
The first point to watch for is the current state of the program memory. The computer remembers
the current colour settings even after a NEW instruction to clear the program memory. To reset
everything to the starting point, you should use the simultaneous [CTRL][SHIFT][ESCAPE]
sequence to get back to the switch-on conditon. (SAVE anything you need to before doing this!)
You can prove this by simply typing:
NEW:CLS
. . ..after you have broken out of the previous program. Now type:.
DRAW 100,100
The
DRAW
instruction draws a straight line from the last location of the GRAPHICS cursor to the
x,y coordinate point specified (100,100). The GRAPHICS CURSOR is an invisible concept that
indicates the point at which the next graphics operation will occur.
To find out where it is, you must use the functions XPOS and YPOS
.
Type in:
PRINT XPOS
The answer is
100
(which is the same for YPOS at this point)
Note that if the text goes down to the bottom of the screen and causes the display to be moved up
(‘scrolled’ up), the graphics display will move up as well but the graphics cursor position remains the
same as before. Try it - hold down the cursor down key [
?
] until the screen clears away at the top,
then ask for XPOS and YPOS again. The graphics cursor value is still there in the memory.
To specify a colour for a line drawn, add the instruction at the end of the DRAW command (see the
description of the PLOT command after the program on the previous page - it works the same way).
You must first have specified the INK - and remember that you can only use the number of INKS
and colours that are permissible in the screen mode you are using.
To see this, type in:
1 0 MODE 1
20 INK 0,10
30 ORIGIN 0,0
40 INK 1,26
5 0 I N K 2,0 2,0
60 DRAW 320,400,1
70 DRAW 640,0,2
Содержание CPC464
Страница 1: ......
Страница 32: ...or you can type 3e1 1e1 ENTER 300 2 3000x1000 Type 3e3 1e3 ENTER 3000000 3 3000x0 001 Type 3e3 1e 3 ENTER 3 ...
Страница 102: ...PRINT 10 AND 12 Results in 8 PRINT 10 AND 1000 Results in 8 again ...
Страница 118: ...TO DO DRAW THIS PAGE ...
Страница 219: ...actual value may be made to vary during the execution of a program ...
Страница 240: ...Text and WINDOW planner Mode 2 80 Columns ...
Страница 241: ......
Страница 245: ...Sound envelope Music planner sheet ...