/*
==============================================================================
WordUp Graphics Toolkit Version 5.0
Demonstration Program 7
Displays some text with the text grid off until you hit a key, then turns
the grid on and displays text, to show the difference.
*** PROJECT ***
This program requires the file WGT5_WC.LIB to be linked.
*** DATA FILES ***
NONE
WATCOM C++ VERSION
==============================================================================
*/
#include <wgt5.h>
void main(void)
{
short x;
short y;
short col;
short oldmode;
color palette[255];
printf ("WGT Example #7\n\n");
printf ("This program will randomly paste a text string onto the screen without using\n");
printf ("a text grid coordinate system. Press a key to see how it would look by\n");
printf ("using a grid. A second keypress ends the program.\n");
printf ("\n\nPress any key to continue.\n");
getch ();
if ( !vgadetected() )
{
printf("Error - VGA card required for any WGT program.\n");
exit (0);
}
oldmode = wgetmode ();
vga256 ();
/* Set our palette */
for (y = 0; y < 64; y++)
wsetrgb (y, y, y, y, palette);
for (y = 0; y < 64; y++)
wsetrgb(y + 64, y, 0, 0, palette);
for (y = 0; y < 64; y++)
wsetrgb(y + 128, 0, y, 0, palette);
for (y = 0; y < 64; y++)
wsetrgb(y + 192, 0, 0, y, palette);
wsetpalette (0, 255, palette);
wcls (0);
wtextgrid (TEXTGRID_OFF);
wtexttransparent (TEXTFGBG); /* Turn foreground and background on */
do {
x = rand () % 320;
y = rand () % 200;
col = rand () % 256;
wtextcolor (col);
wouttextxy (x, y, NULL, "WordUp Graphics Toolkit");
} while (!kbhit ());
getch ();
wcls (0);
wtextgrid (TEXTGRID_ON);
do {
x = rand () % 80;
y = rand () % 25;
col = rand () % 256;
wtextcolor (col);
wtextbackground (rand () % 256);
wouttextxy (x, y, NULL, "WordUp Graphics Toolkit");
} while (!kbhit ());
getch ();
wsetmode (oldmode);
}