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

  1. #include <conio.h>
  2. #include "c:\tc\wgt\wgt.h"
  3. /*   WORDUP Graphics Toolkit   Version 2.1
  4.      Demonstration program 5
  5.  
  6. Draws vertical lines of different colours, and rotates the colours
  7. until you hit a key.
  8.  
  9. */
  10.  
  11. int x,y,col;
  12. color palette[256];
  13.  
  14.  
  15. void main(void)
  16. {
  17. vga256();        // initializes system
  18.  
  19. for (y=0; y<64; y++)        
  20.    wsetrgb(y,y,y,y,&palette);       // sets first 64 colours to grey
  21.                     // note the use of &
  22.  
  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. for (y=0; y<200; y++)            // draw lines down the screen
  33.    {
  34.    wsetcolor(y);
  35.    wline(0,y,319,y);
  36.    }
  37.  
  38. do {
  39.    wcolrotate(1,255,0,palette);
  40.    } while (kbhit() == 0);
  41. getch();        // get the key
  42.  
  43. do {
  44.    wcolrotate(1,255,1,palette);
  45.    } while (kbhit() == 0);
  46. getch();        // get the key
  47.  
  48. do {
  49.    wcolrotate(1,100,1,palette);
  50.    wcolrotate(100,255,0,palette);
  51.    } while (kbhit() == 0);
  52. getch();        // get the key
  53.  
  54.  
  55. textmode(C80);        // used to return to text mode
  56. }