' Quickie Graphics Demo ' Written by Vince Long ' April 1999 StartHere: CLS COLOR 10, 0 Text$ = " Quickie": ROW = 10 GOSUB RollAcross COLOR 11, 0 Text$ = "Graphics": ROW = 11 GOSUB RollAcross COLOR 12, 0 Text$ = " Demo": ROW = 12 GOSUB RollAcross COLOR 5, 0 Text$ = "eikciuQ ": ROW = 10 GOSUB RollBack COLOR 4, 0 Text$ = "scihparG": ROW = 11 GOSUB RollBack COLOR 3 Text$ = "omeD ": ROW = 12 GOSUB RollBack COLOR 8, 0 LOCATE 9, 53 PRINT CHR$(176); LOCATE 10, 53 PRINT CHR$(176); LOCATE 11, 53 PRINT CHR$(176); LOCATE 12, 53 PRINT CHR$(176); LOCATE 13, 53 PRINT CHR$(176); COLOR 14, 0 R1 = 8: C1 = 43: R2 = 14: c2 = 63 GOSUB DrawBox MenuHere: COLOR 10, 0 LOCATE 10, 45: PRINT " Quickie" COLOR 11, 0 LOCATE 11, 45: PRINT "Graphics" COLOR 12, 0 LOCATE 12, 45: PRINT " Demo" COLOR 8, 0 LOCATE 9, 53 PRINT CHR$(176); LOCATE 10, 53 PRINT CHR$(176); LOCATE 11, 53 PRINT CHR$(176); LOCATE 12, 53 PRINT CHR$(176); LOCATE 13, 53 PRINT CHR$(176); COLOR 10, 0 LOCATE 10, 54: PRINT "eikciuQ" COLOR 11, 0 LOCATE 11, 54: PRINT "scihparG" COLOR 12, 0 LOCATE 12, 54: PRINT "omeD" COLOR 14, 0 R1 = 8: C1 = 43: R2 = 14: c2 = 63 GOSUB DrawBox COLOR 2, 0 LOCATE 5, 1 PRINT " Select the Command that you" PRINT "would like to see demonstrated." PRINT PRINT PRINT "1. Screen": PRINT PRINT "2. PSET": PRINT PRINT "3. Line": PRINT PRINT "4. Circle": PRINT PRINT "5. Paint": PRINT PRINT "6. Quit this Program" COLOR 7, 0 DO I$ = INKEY$ LOOP WHILE I$ = "" IF VAL(I$) < 1 OR VAL(I$) > 7 THEN GOTO MenuHere ON VAL(I$) GOTO ScreenDemo, PSETDemo, LineDemo, CircleDemo, PaintDemo, ShutDown ScreenDemo: SCREEN 0 WIDTH 80 COLOR 7, 0 CLS PRINT "The SCREEN statement allows you to select various graphics mode. Each" PRINT "mode has a different screen reolution and color depth." PRINT PRINT "The default mode, the one you are looking at now, is SCREEN 0 and only" PRINT "supports text. It does this in a layout of 80 columns by 25 rows." PRINT PRINT "The other SCREEN modes let you display graphics, in addition to text, " PRINT "and in different resolutions. You can see a list of resolutions by looking" PRINT "up the SCREEN statement in the INDEX" PRINT PRINT "The SCREEN statement also has other parameters, but we won't be using " PRINT "them right now" PRINT PRINT PRINT "So let's take a look at how the display mode changes when the SCREEN" PRINT "mode parameter is changed." PRINT PRINT "Press a key to go to the next screen" DO I$ = INKEY$ LOOP WHILE I$ = "" CLS SCREEN 1 LOCATE 10, 10 PRINT "This is SCREEN 1." PRINT "It has a resolution of 320 X 200." PRINT : PRINT : PRINT PRINT "Press a key to go to the next screen" DO I$ = INKEY$ LOOP WHILE I$ = "" CLS SCREEN 2 LOCATE 10, 10 PRINT "This is SCREEN 2." PRINT "It has a resolution of 640 X 200." PRINT : PRINT : PRINT PRINT "Press a key to go to the next screen" DO I$ = INKEY$ LOOP WHILE I$ = "" CLS SCREEN 7 LOCATE 10, 10 PRINT "This is SCREEN 7." PRINT "It has a resolution of 320 X 200." PRINT : PRINT : PRINT PRINT "Press a key to go to the next screen" DO I$ = INKEY$ LOOP WHILE I$ = "" CLS SCREEN 8 LOCATE 10, 10 PRINT "This is SCREEN 8." PRINT "It has a resolution of 640 X 200." PRINT : PRINT : PRINT PRINT "Press a key to go to the next screen" DO I$ = INKEY$ LOOP WHILE I$ = "" CLS SCREEN 9 LOCATE 10, 10 PRINT "This is SCREEN 9." PRINT "It has a resolution of 640 X 350." PRINT : PRINT : PRINT PRINT "Press a key to go to the next screen" DO I$ = INKEY$ LOOP WHILE I$ = "" CLS SCREEN 10 LOCATE 10, 10 PRINT "This is SCREEN 10." PRINT "It has a resolution of 640 X 350." PRINT : PRINT : PRINT PRINT "Press a key to go to the next screen" DO I$ = INKEY$ LOOP WHILE I$ = "" CLS SCREEN 11 LOCATE 10, 10 PRINT "This is SCREEN 11." PRINT "It has a resolution of 640 X 480." PRINT : PRINT : PRINT PRINT "Press a key to go to the next screen" DO I$ = INKEY$ LOOP WHILE I$ = "" CLS SCREEN 12 LOCATE 10, 10 PRINT "This is SCREEN 12." PRINT "It has a resolution of 640 X 480." PRINT : PRINT : PRINT PRINT "Press a key to go to the next screen" DO I$ = INKEY$ LOOP WHILE I$ = "" CLS SCREEN 13 LOCATE 10, 10 PRINT "This is SCREEN 13." PRINT "It has a resolution of 320 X 200." PRINT : PRINT : PRINT PRINT "Press a key to go to the next screen" DO I$ = INKEY$ LOOP WHILE I$ = "" SCREEN 0 WIDTH 80 GOTO MenuHere PSETDemo: CLS PRINT "PSET lets you turn any pixel on the screen on or off. You can also" PRINT "set its color. The syntax for the command is:" PRINT PRINT " PSET x, y , color" PRINT PRINT "Let's give it a try by running two different programs. The first" PRINT "will draw a diagonal line on SCREEN 12. The program looks like this:" PRINT PRINT " CLS" PRINT " SCREEN 12" PRINT " FOR I = 1 TO 300" PRINT " PSET (I, I),4" PRINT " NEXT I" PRINT PRINT PRINT "Press a key to run this program" DO I$ = INKEY$ LOOP WHILE I$ = "" CLS SCREEN 12 FOR I = 1 TO 300 PSET (I, I), 4 NEXT I LOCATE 24, 1 PRINT "Press a key to go to the next PSET demo" DO I$ = INKEY$ LOOP WHILE I$ = "" SCREEN 0 WIDTH 80 CLS PRINT "In the next PSET demo we will generate a series of random dots," PRINT "1700 of them, on the screen, like a starfield. " PRINT "The program looks like this:" PRINT PRINT " SCREEN 12" PRINT " FOR I = 1 TO 1700" PRINT " x% = RND * 639" PRINT " y% = RND * 479" PRINT " PSET (x%, y%)" PRINT " NEXT I" PRINT PRINT "Press a key to run this program" DO I$ = INKEY$ LOOP WHILE I$ = "" CLS SCREEN 12 FOR I = 1 TO 1700 x% = RND * 639 y% = RND * 479 PSET (x%, y%) NEXT I LOCATE 24, 1 PRINT "Press a key to go to return to the Menu" DO I$ = INKEY$ LOOP WHILE I$ = "" SCREEN 0 WIDTH 80 CLS GOTO MenuHere LineDemo: CLS PRINT "The LINE statement draws a line on the screen (duh!). The syntax is:" PRINT PRINT "LINE (x1, y1) - (x2, y2) attribute, B, style" PRINT PRINT " The (x1, y1) are the starting coordinates" PRINT " The (x2, y2) are the ending coordinates" PRINT " attribute is the color" PRINT " B, if present, draws a box using the coordinates as its diagonal" PRINT " style allows the line to be dashed" PRINT PRINT "Let's show some lines on SCREEN 12." PRINT PRINT "Press a key to begin" DO I$ = INKEY$ LOOP WHILE I$ = "" CLS SCREEN 12 LINE (10, 10)-(200, 100) LOCATE 10, 5 PRINT "LINE (10, 10)-(200, 100)" PRINT PRINT LINE (300, 10)-(600, 100), 4, B LOCATE 10, 45 PRINT "LINE (300, 10)-(600, 100), 4, B" LINE (10, 300)-(200, 390), 6, BF LOCATE 21, 30 PRINT "LINE (10, 300)-(200, 390),6,BF" LOCATE 25, 30 PRINT "Press a key to return to the Main Menu" DO I$ = INKEY$ LOOP WHILE I$ = "" SCREEN 0 WIDTH 80 GOTO MenuHere CircleDemo: CLS PRINT "The CIRCLE statement draws circles. You specify the coordinates" PRINT "of the circle's centerpoint, its radius, and color. The syntax looks" PRINT "like this:" PRINT " CIRCLE (x, y), radius, color" PRINT PRINT "Let's draw some randomly placed and colored circles. The program is:" PRINT PRINT " SCREEN 12" PRINT " DO" PRINT " x% = RND * 639" PRINT " y% = RND * 479" PRINT " I% = RND * 15" PRINT " CIRCLE (x%, y%), 50, I%" PRINT " T = TIMER" PRINT " DO" PRINT " LOOP UNTIL TIMER > T + .05" PRINT " LOCATE 15, 25" PRINT " PRINT 'Press a key to return to the Main Menu'" PRINT " I$ = INKEY$" PRINT " LOOP WHILE I$ = "; "" PRINT PRINT LOCATE , 22 PRINT "Press a key to start the demo" DO I$ = INKEY$ LOOP WHILE I$ = "" SCREEN 12 DO x% = RND * 639 y% = RND * 479 I% = RND * 15 CIRCLE (x%, y%), 50, I% T = TIMER DO LOOP UNTIL TIMER > T + .05 LOCATE 15, 25 PRINT "Press a key to return to the Main Menu" I$ = INKEY$ LOOP WHILE I$ = "" SCREEN 0 WIDTH 80 GOTO MenuHere PaintDemo: CLS PRINT "Now that you have seen ways to draw various shapes, you can start" PRINT "to play with the PAINT statement. PAINT lets you fill a shape which" PRINT "you have already drawn with a color. It also lets you change the" PRINT "color of its border. The syntax of the command is:" PRINT PRINT " PAINT (x, y) interior attribute, border attribute" PRINT PRINT " (x, y) is the coordinate of a point inside the object to be filled" PRINT " interior attribute is the color to fill with" PRINT " border attribute is the color of the line that makes up the object" PRINT PRINT LOCATE 22, 22 PRINT "Press a key to start the demo" DO I$ = INKEY$ LOOP WHILE I$ = "" IA% = 2: BC% = 1 SCREEN 12 CLS LINE (10, 10)-(100, 100), 15, B CIRCLE (300, 50), 50, 15, , , 1 ChangeIA: LOCATE 19, 1 INPUT "To change the interior color enter a number from 0 to 14"; IA% IF IA% < 0 OR IA% > 14 THEN GOTO ChangeIA PAINT (75, 75), IA%, 15 PAINT (300, 50), IA%, 15 AskEm: LOCATE 19, 1 PRINT "Do you want to change it again? (Y or N) " DO I$ = INKEY$ LOOP WHILE I$ = "" IF UCASE$(I$) = "Y" THEN GOTO ChangeIA IF UCASE$(I$) = "N" THEN FOR Cycles = 1 TO 3 FOR c = 0 TO 14 PAINT (75, 75), c, 15 PAINT (300, 50), c, 15 T = TIMER DO LOOP UNTIL TIMER > T + .1 NEXT c NEXT Cycles SCREEN 0 WIDTH 80 GOTO MenuHere END IF GOTO AskEm ShutDown: COLOR 7, 0 CLS END RollAcross: FOR I = 1 TO 44 LOCATE ROW, I PRINT Text$ T = TIMER DO LOOP UNTIL TIMER > T + .01 LOCATE ROW, I PRINT " " NEXT I LOCATE ROW, I PRINT Text$ RETURN RollBack: FOR I = 72 TO 55 STEP -1 LOCATE ROW, I PRINT Text$ T = TIMER DO LOOP UNTIL TIMER > T + .01 LOCATE ROW, I PRINT " " NEXT I LOCATE ROW, I PRINT Text$ RETURN REM Draw Box DrawBox: ' Draw Top LOCATE R1, C1 PRINT CHR$(201); FOR I = 1 TO (c2 - C1 - 1) PRINT CHR$(205); NEXT PRINT CHR$(187) ' Draw Sides FOR I = 1 TO (R2 - R1) LOCATE R1 + I, C1 PRINT CHR$(186); LOCATE R1 + I, c2 PRINT CHR$(186); NEXT ' Draw Bottom LOCATE R2, C1 PRINT CHR$(200); FOR I = 1 TO (c2 - C1 - 1) PRINT CHR$(205); NEXT PRINT CHR$(188); RETURN