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

  1. #include <conio.h>
  2. #include "c:\tc\wgt\wgt.h"
  3. /*   WORDUP Graphics Toolkit   Version 2.1
  4.      Demonstration program 13
  5.  
  6. Demonstrates mouse noclick, mousehape, msetspeed, and wbutt
  7.  
  8. */
  9.  
  10. color palette[256];
  11.  
  12. int i,doneflag;                // end of loop
  13.  
  14.    unsigned wgtcursor[32] = {
  15.     0x3ff, 0x3ff, 0x7ff, 0x3ff, 0x1ff, 0x20ff,0xf07f,0xf8ff,
  16.     0xfdff,0x1000,0x0,   0x0,   0x1,   0x1,   0x1,   0x1,
  17.     0x0,   0x7800,0x7000,0x7800,0x5c00,0xe00 ,0x700, 0x200,
  18.     0x0,   0x0,   0x45ce,0x4504,0x5564,0x5524,0x7de4,0x0};
  19.  
  20.    // this is the shape of the mouse cursor. There are many shareware
  21.    // or public domain programs that help you make these.
  22.  
  23.  
  24. void main(void)
  25. {
  26. vga256();        // initializes system
  27.  
  28. for (i=1; i<253; i++)
  29.    wsetrgb(i,i+30,i+30,i,&palette);         // just something other
  30.                         // than black!
  31.  
  32. wsetrgb(253,60,60,60,&palette);
  33. wsetrgb(254,50,50,50,&palette);
  34. wsetrgb(255,40,40,40,&palette);
  35. wsetpalette(0,255,&palette);
  36.  
  37. wcls(0);
  38.  
  39. wbutt(1,1,319,50);
  40. wbutt(1,60,319,109);
  41. wbutt(1,189,319,199);
  42.  
  43. wtextcolor(253);
  44. wtexttransparent(0);
  45. wouttextxy(30,10,"This button doesn't use noclick()");
  46. wouttextxy(60,70,"This button does!");
  47. wouttextxy(100,191,"Click here to quit");
  48.  
  49.  
  50.  
  51. minit();                // init mouse
  52. msetbounds(0,0,319,199);
  53. msetspeed(20,5);            // make x slow and y real fast
  54. mouseshape(0,0,wgtcursor);        // 0,0 for hotspot
  55.  
  56. mon();                    // turn it on
  57.  
  58. doneflag=0;                // keep looping until flag is 1
  59.  
  60. do {
  61. mread();                // read mouse
  62.                     // stores info into mx,my,but
  63.  
  64. if (but !=0)                // button pressed
  65.    {
  66.    if (my<50)
  67.       {
  68.       sound(500);
  69.       delay(30);
  70.       nosound();
  71.       }
  72.    else if ((my<109) & (my>60))
  73.       {
  74.       sound(500);
  75.       delay(30);
  76.       nosound();
  77.       noclick();
  78.       }
  79.    else if (my>189)
  80.        doneflag=1;                // you hit the quit button
  81.  
  82.    }
  83. } while (!doneflag);
  84.  
  85. textmode(C80);                // used to return to text mode
  86. }