' +----------------------------------------------------------------------+ ' | | ' | GRAFWIZ Copyright (c) 1990 Thomas G. Hanlin III | ' | | ' | The Graphics Wizard's Library for BASIC | ' | | ' +----------------------------------------------------------------------+ REM $INCLUDE: 'grafwiz.bi' DEFINT A-Z DEF FNR (X) = INT(RND * X) RANDOMIZE TIMER GetDisplay Adapter, Mono IF Adapter < 3 THEN PRINT "Sorry, but you must have a CGA, EGA or VGA display active to run this demo." END END IF G1Mode 1 ' CGA 320x200 mode G1PaletteA 0 ' Green, Red, Yellow palette BFont 1 G1Color 1, 0 G1Banner "GRAFWIZ", 0, 0, 3, 2 BFont 0 G1Color 3, 0 G1Banner "Copyright (c)1990", 179, 5, 1, 1 G1Banner "Thomas G. Hanlin", 182, 15, 1, 1 BFont 2 G1Color 2, 0 G1Banner "This is the Graphics Wizard's Library.", 0, 40, 1, 1 BFont 1 G1Color 1, 0 G1Banner "Flexible text handling is a natural", 0, 68, 1, 1 G1Banner "aspect of graphics modes. The GRAFWIZ", 0, 82, 1, 1 G1Banner "library takes full advantage of that,", 0, 96, 1, 1 G1Banner "with a selection of fonts and fast", 0, 110, 1, 1 G1Banner "full-color text support.", 0, 124, 1, 1 BFont 0 G1Color 3, 0 G1Banner "This is CGA mode SCREEN 1, by the way.", 0, 150, 1, 1 BFont 2 G1Color 2, 0 G1Banner "Now let's see some graphics!", 0, 170, 1, 1 G1Locate 25, 14 G1Color 2, 3 G1Write "Press a key" DO LOOP WHILE LEN(INKEY$) DO ky$ = INKEY$ LOOP UNTIL LEN(ky$) IF ky$ = CHR$(27) THEN GOTO Done G1Color 0, 0 G1Box 0, 30, 319, 189, 1 G1Color 2, 0 G1Box 0, 26, 319, 188, 0 G1Color 1, 0 G1Locate 23, 2 G1Write "Dots, Lines, Boxes... all the usual!" FOR Dot = 1 TO 200 G1Color FNR(3) + 1, 0 G1Plot FNR(316) + 2, FNR(140) + 28 NEXT FOR Lin = 1 TO 10 G1Color FNR(3) + 1, 0 G1Line FNR(316) + 2, FNR(140) + 28, FNR(315) + 3, FNR(139) + 29 NEXT FOR Box = 1 TO 10 G1Color FNR(3) + 1, 0 X = FNR(250) + 2 Y = FNR(112) + 28 G1Box X, Y, X + FNR(60) + 1, Y + FNR(25) + 1, FNR(2) NEXT DO LOOP WHILE LEN(INKEY$) DO ky$ = INKEY$ LOOP UNTIL LEN(ky$) IF ky$ = CHR$(27) THEN GOTO Done G1Color 0, 0 G1Box 1, 27, 318, 187, 1 G1Color 1, 0 G1Locate 23, 2 G1Write "But why stop at the usual?" FOR Poly = 1 TO 12 G1Color FNR(3) + 1, 0 X = FNR(212) + 40 Y = FNR(90) + 60 G1Polygon X, Y, FNR(25) + 5, FNR(6) + 3, 3.14159 * RND NEXT DO LOOP WHILE LEN(INKEY$) DO ky$ = INKEY$ LOOP UNTIL LEN(ky$) IF ky$ = CHR$(27) THEN GOTO Done G2Mode 1 ' CGA 640x200 mode IF Adapter = 3 THEN ' if CGA... G1Border 1 ' set foreground color to blue END IF G2Locate 1, 1 G2Color 1, 0 G2WriteLn "There are a few additional routines of interest which are designed to work" G2WriteLn "only in SCREEN 2 mode at this time. These are the picture readers, which" G2WriteLn "allow you to read in .MAC and .PCX pictures into a GET/PUT image. Here's" G2WriteLn "a sample from DEMO.PCX:" REDIM Image(1) G2LoadPCX "DEMO.PCX", Image(), ErrCode G2Put 40, 40, Image() G2Locate 15, 1 G2WriteLn "Of course, that's not the end of it! There are many other routines that" G2WriteLn "are not included in this demonstration. One of 'em in particular which you" G2WriteLn "may like is a routine to print out a screen (almost any display mode) to" G2WriteLn "any Epson-compatible printer. Another allows you to detect what kind of" G2WriteLn "display adapter is attached and whether the display is color or monochrome." G2WriteLn "" G2WriteLn "See GRAFWIZ.DOC for more details." G2Locate 25, 33 G2Color 0, 1 G2Write "Press any key" IF Adapter = 4 OR Adapter = 6 THEN ' if EGA/VGA... DO LOOP WHILE LEN(INKEY$) DO ky$ = INKEY$ LOOP UNTIL LEN(ky$) IF ky$ = CHR$(27) THEN GOTO Done G7Mode 1 ' ...put into low-res EGA mode G7Color 4, 2 G7WriteLn "Ah, I see you have an EGA! Of course," G7Color 0, 3 G7WriteLn "GRAFWIZ supports the various EGA modes" G7Color 7, 1 G7WriteLn "as well as the CGA." G7WriteLn "" G7Color 14, 5 G7WriteLn "Hercules support will come later." G7WriteLn "" G7Color 2, 1 G7WriteLn "VGA awaits the time I can afford it!" FOR Y = 0 TO 31 G7Color Y AND 15, 0 G7Box Y, Y + 64, 319 - Y, (64 - Y) + 120, (Y = 100) IF Y > 15 THEN G7Polygon Y * 15 - 194, 112, 5, FNR(6) + 3, .75 * 3.141593 G7Color ((Y XOR 15) AND 15), 0 G7Polygon Y * 15 - 194, 136, 5, FNR(6) + 3, 0 END IF NEXT G7Locate 25, 14 G7Color 15, 4 G7Write "Press any key" END IF DO LOOP WHILE LEN(INKEY$) DO ky$ = INKEY$ LOOP UNTIL LEN(ky$) IF ky$ = CHR$(27) THEN GOTO Done Done: G1Mode 0 ' restore text mode