Any Colour! - VDU19 -Tutorial 013
VDU 19,logical,16,red,green,blue is a command which enables you to get
any colour you like on the screen as this and the next program will show
you :
VDU19 Demo
MODE8:OFF
message$ = "Click mouse to pause"
caption$ = "Control"
SYS "MessageBox", @hwnd%, message$, caption$,
0
REPEAT
red=RND(255)
green=RND(255)
blue=RND(255)
VDU 19,1,16,red,green,blue
GCOL0,1
CIRCLE FILL RND(1280),RND(1024),(10+RND(100))
delay=INKEY(5)
Stop=INKEY(-10)
IF Stop THEN
message$ = "Press
any key for more circles"
caption$ = "To
Restart"
SYS "MessageBox",
@hwnd%, message$, caption$, 0
G=GET
ENDIF
UNTIL FALSE
Annotated Listing
MODE8:OFF ***Mode
8 has 16 "logical colours"***
------------------------------------------------------------------------------------------------------------------------------
message$ = "Click mouse to pause" ***
See previous tutorial for another message box.....
caption$ = "Control"
SYS "MessageBox", @hwnd%, message$, caption$,
0
-------------------------------------------------------------------------------------------------------------------------------
REPEAT
red=RND(255) ****values of
red, green, blue go from 0 to 255***
green=RND(255)
blue=RND(255)
--------------------------------------------------------------------------------------------------------------------------------
VDU 19,1,16,red,green,blue *****
- The "1" specifies the first out of 16 possible
"logical colours" available in MODE8 is to be redefined from its default
colour (in this case red)
- "16" specifies that the following three
parameters (numbers), will indicate the mixture of red, green and blue to
be used in making the redefined colour.
-------------------------------------------------------------------------------------------------------------------------------
GCOL0,1 ***** GCOL0 specifies "normal
colours" which cover other colours in an uncomplicated way; the 1 indicates
that graphics colour 1 (which we have just redefined is to be used.
------------------------------------------------------------------------------------------------------------------------------
CIRCLE FILL RND(1280),RND(1024),(10+RND(100))
****coloured discs which over-print each other
delay=INKEY(5)**** If you
alter this to read "delay=INKEY(0)" you will see why it is here
--------------------------------------------------------------------------------------------------------------------------------
Stop=INKEY(-10) *****INKEY(-10)
is TRUE if the left mouse button is held down as this instruction is executed
IF Stop THEN **** Halts program
until you click the mouse (or touch a key)
message$ = "Press
any key for more circles"
caption$ = "To
Restart"
SYS "MessageBox",
@hwnd%, message$, caption$, 0
G=GET ***** halts
until a key is pressed, then allows more coloured discs to be printed
ENDIF
UNTIL FALSE **** loops back from here
to produce another coloured disc
Colour Possibilities!
MODE8:OFF
message$ = "Keep Pressing any key to see
next display"
caption$ = "Control"
SYS "MessageBox", @hwnd%, message$, caption$,
0
REPEAT
red=RND(255)
green=RND(255)
blue=RND(255)
VDU 19,1,16,red,green,blue
PRINTTAB(30,2)"red = ";red;SPC(2)
PRINTTAB(30)"green : ";green;SPC(2)
PRINTTAB(30)"blue = ";blue;SPC(2)
PRINTTAB(30,24)"VDU19,1,16,";red;",";green;",";blue;SPC(8)
GCOL0,1
RECTANGLE FILL 80,400,1100,400
G=GET
UNTIL FALSE
Next Tutorial
Richard Weston's Homepage