home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / w / wgt3_ex.zip / WGT02.C < prev    next >
C/C++ Source or Header  |  1992-09-08  |  810b  |  35 lines

  1. #include <conio.h>
  2. #include <wgt.h>
  3.  
  4. /*   WORDUP Graphics Toolkit   Version 3.0
  5.      Demonstration program 2
  6.  
  7. Draw pixels with random colour in random places until you hit a key.
  8. Second loop fills screen with wfastputpixel.
  9. ***** wgetpixel will return the colour at a specific coordinate. It
  10. is not included in this example file.
  11.  
  12. */
  13.  
  14. int x,y,col;
  15.  
  16. void main(void)
  17. {
  18. vga256();        // initializes system
  19. wcls(0); // clears screen with colour 0
  20. do {
  21.    wsetcolor(rand() % 255);
  22.    x=rand() % 320;
  23.    y=rand() % 200;
  24.    wputpixel(x,y);
  25.    } while (kbhit()==0);
  26. getch();        // get the key
  27.  
  28. wcls(0); // clears screen with colour 0
  29. wsetcolor(10);
  30. for (x=0; x<320; x++)
  31. for (y=0; y<200; y++)
  32.    wfastputpixel(x,y);
  33. getch();        // get the key
  34. textmode(C80);        // used to return to text mode
  35. }