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

  1. #include <conio.h>
  2. #include "c:\tc\wgt\wgt.h"
  3. /*   WORDUP Graphics Toolkit   Version 2.1
  4.      Demonstration program 15
  5.  
  6. This program shows how to use virtual graphics pages and tells how
  7. they are used in animation.  More complicated examples follow after this
  8. one.
  9.  
  10. */
  11.  
  12. int x,y;
  13. block screen1;
  14.  
  15.  
  16. void main(void)
  17. {
  18. vga256();        // initializes system
  19.  
  20. screen1=wnewblock(0,0,319,199);
  21.     // virtual screens are created by making a block with size
  22.     // 0-319 and 0-199.  These screens can be used like any other
  23.     // block, however they make also be drawn on top of.
  24.     // You can tell which screen to draw to by calling
  25.     // wsetscreen(name of block) and wnormscreen() to restore
  26.     // drawing to the default screen.
  27.     // For example:
  28.  
  29. wsetscreen(screen1);        // sets to screen1
  30. for (y=0; y<200; y++)
  31.   {
  32.   wsetcolor(y);
  33.   wline(0,0,319,y);        // draw something on another screen
  34.   wline(319,199,0,y);
  35.   }
  36.  
  37. sound(500);        // This is to let you know when it is finished
  38. delay(100);
  39. nosound();
  40. getch();        // there is nothing on the screen yet
  41.  
  42. // now use putblock to show what happened on the other screen
  43.  
  44. wnormscreen();        // make the putblock go onto the default screen
  45. wputblock(0,0,screen1,0);
  46.  
  47. getch();        // now everything is shown!
  48.  
  49.  
  50. wfreeblock(screen1);    // remember to free that memory (64004 bytes for a screen)
  51.  
  52. textmode(C80);                // used to return to text mode
  53. }