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

  1. #include <conio.h>
  2. #include <stdio.h>
  3. #include "c:\tc\wgt\wgt.h"
  4. /*   WORDUP Graphics Toolkit   Version 2.1
  5.      Demonstration program 16
  6.  
  7. This program shows how to use wcopyscreen
  8.  
  9. */
  10.  
  11. int x,y;
  12. block screen1;
  13.  
  14.  
  15. void main(void)
  16. {
  17. vga256();        // initializes system
  18.  
  19. screen1=wnewblock(0,0,319,199);
  20.     // virtual screens are created by making a block with size
  21.     // 0-319 and 0-199.  These screens can be used like any other
  22.     // block, however they make also be drawn on top of.
  23.     // You can tell which screen to draw to by calling
  24.     // wsetscreen(name of block) and wnormscreen() to restore
  25.     // drawing to the default screen.
  26.  
  27. wsetscreen(screen1);        // sets to screen1
  28. for (y=0; y<200; y++)
  29.   {
  30.   wsetcolor(y);
  31.   wline(0,0,319,y);        // draw something on another screen
  32.   wline(319,199,0,y);
  33.   }
  34.  
  35. minit();
  36. moff();
  37. wnormscreen();        // make the putblock go onto the default screen
  38.  
  39. do {
  40.   mread();
  41.   wcopyscreen(mx,my,mx+20,my+20,screen1,mx,my,NULL);
  42.   // this means copy a square 20*20 from screen1 to the same spot
  43.   // on the default screen.  Move the mouse around and watch the black
  44.   // wipe away as screen1 copies over.
  45.  
  46.   // NULL means the default screen.  Be sure to #include <stdio.h>
  47.   // so it knows what NULL means.
  48.  
  49.    } while (!kbhit());
  50.  
  51. getch();        // wasn't that fun?!
  52.  
  53.  
  54. wfreeblock(screen1);    // remember to free that memory (64004 bytes for a screen)
  55.  
  56. textmode(C80);                // used to return to text mode
  57. }