home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / WGT_TC21.ZIP / WGT07.C < prev    next >
C/C++ Source or Header  |  1992-07-17  |  1KB  |  59 lines

  1. #include <conio.h>
  2. #include "c:\tc\wgt\wgt.h"
  3. /*   WORDUP Graphics Toolkit   Version 2.1
  4.      Demonstration program 7
  5.  
  6. Displays some text with the text grid off until you hit a key, then
  7. turns the grid on and displays text, to show the difference.
  8.  
  9. */
  10.  
  11. int x,y,col;
  12. color palette[255];
  13.  
  14.  
  15. void main(void)
  16. {
  17. vga256();        // initializes system
  18.  
  19.  
  20. for (y=0; y<64; y++)        
  21.    wsetrgb(y,y,y,y,&palette);       // sets first 64 colours to grey
  22.                     // note the use of &
  23. for (y=0; y<64; y++)
  24.    wsetrgb(y+64,y,0,0,&palette);        // next 64 to red
  25. for (y=0; y<64; y++)
  26.    wsetrgb(y+128,0,y,0,&palette);       // green
  27. for (y=0; y<64; y++)
  28.    wsetrgb(y+192,0,0,y,&palette);    // blue
  29.  wsetpalette(0,255,palette);        // and finally change them
  30.                     // all at once
  31.  
  32.  
  33.    wcls(0);
  34. wtextgrid(0);
  35. wtexttransparent(2);
  36. do {
  37.    x=rand() % 320;
  38.    y=rand() % 200;
  39.    col=rand() % 255;
  40.    wouttextxy(x,y,"WORDUP Graphics Toolkit");
  41.    wtextcolor(col);
  42.    } while (kbhit()==0);
  43.  getch();
  44.  
  45. wcls(0);
  46. wtextgrid(1);
  47. do {
  48.    x=rand() % 80;
  49.    y=rand() % 25;
  50.    col=rand() % 255;
  51.    wtextcolor(col);
  52.    wtextbackground(rand() % 255);
  53.    wouttextxy(x,y,"WORDUP Graphics Toolkit");
  54.    } while (kbhit()==0);
  55.  
  56.  
  57. getch();        // get the key
  58. textmode(C80);        // used to return to text mode
  59. }