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

  1. #include <stdio.h>
  2. #include <dos.h>
  3. #include <conio.h>
  4. #include <stdlib.h>
  5. #include <alloc.h>
  6. #include "c:\tc\wgt\wgt.h"
  7. #include "c:\tc\wgt\spr.h"
  8.  
  9. color palette[256];
  10. block sprites[201];
  11. int x,y,i;
  12.  
  13. void looper();        // the part that repeats everything
  14.  
  15.  
  16. void main(void)
  17. {
  18. printf("WordUp Graphics Toolkit Example Program\n\n");
  19. printf("This program is meant to show off what the\n");
  20. printf("WGT Library can do, and is not meant as a\n");
  21. printf("complete shareware or public domain game.\n");
  22. printf("Please remember this while playing the game.\n\n\n");
  23.  
  24.  
  25. i=minit();
  26. if (i==0)
  27.    {
  28.    printf("Mouse not detected.  You need a mouse for this example program\n");
  29.    printf("Press any key\n");
  30.    getch();
  31.    exit(1);
  32.    }
  33. else printf("Mouse with %i buttons detected.\n",i);
  34. printf("Press any key\n");
  35. getch();
  36. vga256();
  37. wloadsprites(&palette,"c:\\tc\\wgt\\invader.spr",sprites);
  38. initspr();
  39. spon=1;
  40.  
  41. wsetscreen(spritescreen);
  42.  
  43.  
  44. for (y=160; y<200; y++)
  45.     {
  46.     wsetcolor((y/2)-78);
  47.     wline(0,y,319,y);
  48.     }
  49. wcopyscreen(0,0,319,199,spritescreen,0,0,NULL);
  50.  
  51. spriteon(1,160,152,1);
  52.  
  53.  msetbounds(0,152,319,152);
  54.  
  55. do {
  56. looper();
  57. } while (but !=2);        // 2 means quit
  58.  
  59.  msetbounds(0,0,319,199);
  60. textmode(C80);
  61. }
  62.  
  63.  
  64. void looper(void)
  65. {
  66. erasespr();
  67.  
  68. mread();
  69. s[1].x=mx;
  70. s[1].y=my;
  71.  
  72. drawspr();
  73. }
  74.  
  75.  
  76.