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 / FLI03.C < prev    next >
C/C++ Source or Header  |  1992-09-13  |  2KB  |  101 lines

  1. #include <conio.h>
  2. #include <wgt.h>
  3. #include <wgtfli.h>
  4. // WordUp Graphics Toolkit FLI demo program
  5. // This beauty resizes an FLI as it plays, and allows
  6. // you to change the size of the window.
  7. // Use the right hand mouse button to resize, and the left to move the 
  8. // window. Press any key to exit.
  9.  
  10.  
  11. int wx=0,wy=0,ww=100,wh=100; // fli window coordinates
  12. block other;             // the virtual screen to show FLI on
  13.  
  14.  
  15. void movebox(void)   // Move the fli window around
  16. {
  17.  wclip(0,0,319,199);
  18.  wsetcolor(0);
  19.  wbar(wx,wy,wx+ww,wy+wh);
  20.  
  21. do {
  22. mread();
  23. wsetcolor(0);
  24. wline(wx,wy,wx+ww,wy);
  25. wline(wx,wy,wx,wy+wh);
  26. wline(wx+ww,wy,wx+ww,wy+wh);
  27. wline(wx,wy+wh,wx+ww,wy+wh);
  28.  
  29. wx=mx; wy=my;
  30. wsetcolor(1);
  31. wline(wx,wy,wx+ww,wy);
  32. wline(wx,wy,wx,wy+wh);
  33. wline(wx+ww,wy,wx+ww,wy+wh);
  34. wline(wx,wy+wh,wx+ww,wy+wh);
  35.  
  36. } while (but==1);
  37.  wclip(wx+1,wy+1,wx+ww-1,wy+wh-1);
  38. }
  39.  
  40. void resizebox(void)  // resize the fli window
  41. {
  42.  wclip(0,0,319,199);
  43. wsetcolor(0);
  44. wbar(wx,wy,wx+ww,wy+wh);
  45. msetbounds(wx+2,wy+2,319,199);
  46.  
  47. do {
  48. mread();
  49. wsetcolor(0);
  50. wline(wx,wy,wx+ww,wy);
  51. wline(wx,wy,wx,wy+wh);
  52. wline(wx+ww,wy,wx+ww,wy+wh);
  53. wline(wx,wy+wh,wx+ww,wy+wh);
  54.  
  55. ww=mx-wx; wh=my-wy;
  56. wsetcolor(1);
  57. wline(wx,wy,wx+ww,wy);
  58. wline(wx,wy,wx,wy+wh);
  59. wline(wx+ww,wy,wx+ww,wy+wh);
  60. wline(wx,wy+wh,wx+ww,wy+wh);
  61.  
  62. } while (but==2);
  63.  wclip(wx+1,wy+1,wx+ww-1,wy+wh-1);
  64.  msetbounds(0,0,319,199);
  65. }
  66.  
  67. void main(void)
  68. {
  69.      vga256();
  70.      other=wnewblock(0,0,319,199);
  71.      fliscreen=other;
  72.  
  73.      openfli("wordup.fli");
  74.      wsetcolor(1);
  75.      wline(wx,wy,wx+ww,wy);
  76.      wline(wx,wy,wx,wy+wh);
  77.      wline(wx+ww,wy,wx+ww,wy+wh);
  78.      wline(wx,wy+wh,wx+ww,wy+wh);
  79.      wclip(wx+1,wy+1,wx+ww-1,wy+wh-1);
  80.  
  81.      minit();
  82.      do {
  83.      mread();
  84.      nextframe();
  85.      moff();
  86.      wnormscreen();
  87.      wclip(0,0,319,199);
  88.      wresize(wx+1,wy+1,wx+ww-1,wy+wh-1,other); 
  89.      // instead of using copyfli, we will resize the fli
  90.      // although it is slow at large sizes
  91.      mon();
  92.      if (but==1) movebox();
  93.      if (but==2) resizebox();
  94.      }while (!kbhit());
  95.      getch();
  96.      wfreeblock(other);
  97.      closefli();
  98.      textmode(C80);
  99. }
  100.  
  101.