/* TESTVGA.C
*
* This program tests the functionality of the VGA256.C functions
*/
#include
#include
#include
/* Enable this line for compile with at the command line */
#include "include\vga256.h"
/* Enable this line for compile within the IDE */
/* #include "source\vga256.c" */
int main(void)
{
int i;
long count;
char string[41];
SetVideoMode(VGA256);
while (!kbhit())
SetPixel(rand()%320, rand()%200, rand()%256);
getch();
FillScreen(0);
Gputs(0, 0, "Gary Neal Jr.", 4, -1);
getch();
FillScreen(0);
while (!kbhit())
Line(rand()%320, rand()%200, rand()%320, rand()%200, rand()%256);
getch();
FillScreen(0);
while (!kbhit())
Circle(rand()%320, rand()%200, rand()%100, rand()%256);
getch();
FillScreen(0);
Gputs(0, 0, "Counting vertical retrace periods.", 15, 0);
count = 0L;
while(!kbhit()) {
WaitForVertRetrace();
count++;
sprintf(string, "%ld vertical retraces.", count);
Gputs(0, 32, string, 15, 0);
}
getch();
FillScreen(0);
Gputs(0, 0, "Opening Cache...", 4, -1);
if (!InitCache(ScreenHeight))
Gputs(0, 8, "Failed to open cache...press a key", 15, -1);
else {
Gputs(0, 8, "Cache successfully opened...", 15, -1);
Gputs(0, 16, "Now setting dots...", 15, -1);
for (i=0; i<300; i++)
SetPixelC(rand()%ScreenWidth, rand()%cacheLines, rand()%256);
Gputs(0, 24, "Press a key to view cache...", 15, -1);
getch();
ShowCache();
getch();
Gputs(0, 0, "Clearing and writing lines to cache", 15, 0);
FillScreenC(0);
for (i=0; i<300; i++)
LineC(rand()%320, rand()%200, rand()%320, rand()%200, rand()%256);
Gputs(0, 24, "Press a key to view cache...", 15, -1);
getch();
ShowCache();
getch();
Gputs(0, 0, "Clearing and writing circles to cache", 15, 0);
FillScreenC(0);
for (i=0; i<300; i++)
CircleC(rand()%320, rand()%200, rand()%100, rand()%256);
Gputs(0, 24, "Press a key to view cache...", 15, -1);
getch();
ShowCache();
getch();
Gputs(0, 0, "Clearing and writing text to cache", 15, 0);
FillScreenC(0);
GputsC(0, 0, "This was written to cache.", 4, 0);
GputsC(0, 8, "Cache enables you to update offscreen...", 15, 0);
GputsC(0, 16, "and view when update is complete.", 15, 0);
GputsC(0, 32, "Helping to eliminate screen flicker.", 14, 0);
Gputs(0, 24, "Press a key to view cache...", 15, -1);
getch();
ShowCache();
getch();
FillScreen(0);
Gputs(0, 0, "That's all folks!", 15, 0);
DeleteCache();
}
getch();
SetVideoMode(TEXT_MODE);
return 0;
}
               (
geocities.com/garyneal_71)