http://neozones.quickbasic.com/basfiles/svgaqb25.zip
LINK /QU SVGAQB.LIB, SVGAQB.QLB, NUL, BQLB45.LIB
Then, to start the QB IDE using the library, type QB /L SVGAQB
To use ZSVGA in your programs you must use a specific header. At the top of all ZSVGA programs enter:
DEFINT A-Z '$INCLUDE: 'SVGABC.BI'
There ya go, your now ready to use ZSVGA functions in your programs.
IF WHICHVGA THEN PRINT "SVGA Video Card Detected!" ELSE PRINT "SVGA Video Card Not Detected!": END END IF
Now let's get into hi res modes! Yippee! =]
For most of these articles I will be using 640x480 modes, you should have at least 1 meg of video ram which can be checked via WHICHMEM. To enter a video mode simply use:
IF Res640 = 0 THEN PRINT "Could not enter 640x480 mode!": END
To plot a single pixel you can simply use the DrwPoint function. The syntax goes like this:
DrwPoint (Mode%, Color%, X%, Y%)
Simple, eh? =]
You may wonder what Mode% is. Well, it's nothing but the pixel write mode. You don't really have to worry about it at this point (Pardon the pun), just set it to 1 for now. =] In case your interested the pixel write modes go like this:
1 = SET 2 = XOR 3 = OR 4 = AND
Now, let's plot da pixels! Here is some example code:
RANDOMIZE TIMER 'Seed the random number generator FOR i = 1 TO 250 'Begin our FOR loop x = INT(RND * 639) + 1 'Randomize the x axis position y = INT(RND * 479) + 1 'Randomize the y axis position c = INT(RND * 255) + 1 'Randomize the pixel color DrwPoint 1, c, x, y 'Plot the pixel! NEXT i 'End our loop
DrwLine (Mode%, Color%, X1%, Y1%, X2%, Y2%)
Like, the point function this is pretty much self-explanatory. Like the DrwPoint function, set Mode% to 1 for now. Here's some more example code:
RANDOMIZE TIMER 'Seed the random number generator FOR i = 1 TO 100 'Begin our FOR loop x1 = INT(RND * 639) + 1 '\ y1 = INT(RND * 479) + 1 '|Randomize all the points! x2 = INT(RND * 639) + 1 '| y2 = INT(RND * 479) + 1 '/ c = INT(RND * 255) + 1 'Randomize the color DrwLine 1, c, x1, y1, x2, y2 NEXT i 'End our loop
Null = ResText
That's it for this article of ZSVGA. It's short, due to time constraints, but the next one should be bigger. In the next article I'll explain more graphic functions including using page flipping for smooth animation. Until then, be sure to explore SVGABC25.TXT to learn about other functions. Signing off...