home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 321_01 / micetest.c < prev    next >
C/C++ Source or Header  |  1990-08-06  |  4KB  |  199 lines

  1. #include <stdio.h>
  2. #include "moustrap.h"
  3.  
  4. #include <graph.h>
  5. #pragma comment(lib,"graphics")
  6.  
  7.  
  8. main ()
  9. {
  10.     mouse_t    w,x,y,z,c;
  11.     int    oldcolor;
  12.  
  13.  
  14. /* Set up screen for demo, using Microsoft GRAPHICS library        */    
  15.     
  16.     oldcolor=_gettextcolor();
  17.  
  18.     _clearscreen(_GCLEARSCREEN);
  19.  
  20.     for (x=16; x<26; ++x) {
  21.         _settextposition(x,21);
  22.         _settextcolor(2);
  23.         _outtext("LLLLLLLLLL");
  24.         _settextcolor(4);
  25.         _outtext("RRRRRRRRRR");
  26.         }
  27.     
  28.     
  29.     _settextcolor(1);
  30.     for (x=6; x<17; ++x) {
  31.             _settextposition(x,11);
  32.         _outtext("11111111111");
  33.         }
  34.     
  35.  
  36.     _settextposition(7,1);
  37.     printf("Page Z:");
  38.  
  39.     _settextcolor(3);
  40.     for (x=8; x<15; ++x) {
  41.         _settextposition(x,14);
  42.         _outtext("CCCCCC");
  43.         }
  44.     
  45.     _settextposition(24,10);
  46.     printf("Page Y:");
  47.  
  48.  
  49.  
  50.     _settextposition(7,35);
  51.     printf("Middle Button Anywhere       = '2'");
  52.  
  53.     _settextposition(9,35);
  54.     printf("Left Button Anywhere in Z    = '1'");
  55.  
  56.     _settextposition(10,35);
  57.     printf("Right Near Middle of Z       = 'C'");
  58.  
  59.     _settextposition(12,35);
  60.     printf("Left Button, Left  side of Y = 'L'");
  61.  
  62.     _settextposition(13,35);
  63.     printf("Left Button, Right side of Y = 'R'");
  64.  
  65.     _settextposition(14,35);
  66.     printf("Click Middle buttom to Move on");
  67.     
  68. /*************************************************************************/
  69.  
  70.     
  71.     Define_Mouse_System(M_Single_Pages);
  72.  
  73.     y=Add_Mouse_Page(M_Text_Coord,15,20,24,40); 
  74.  
  75.     z=Add_Mouse_Page(M_Text_Coord,5,10,15,20);
  76.  
  77.  
  78.     Set_Mouse_Text_Cursor(0,0,TC(' ',4,4));
  79.  
  80.     Add_Mouse_Button(0,M_Middle,'2');
  81.     Add_Mouse_Button(z,M_Left,'1');
  82.     Add_Mouse_Button(z,M_Right,0);
  83.     Add_Mouse_Hot_Spot(z,M_Right,7,13,13,18,'C');
  84.  
  85.     Add_Mouse_Button(y,M_Left,0);
  86.  
  87.     Add_Mouse_Hot_Spot(y,M_Left,15,20,24,30,'L');
  88.     Add_Mouse_Hot_Spot(y,M_Left,15,30,24,40,'R');
  89.  
  90.     _settextposition(3,50);
  91.     printf("# of buttons = %d\n",_mouse_there);
  92.  
  93.  
  94.     
  95. do {
  96.     
  97.  
  98.     _settextposition(1,10);
  99.     printf("Page Z Active");
  100.  
  101.     
  102.     Activate_Mouse_Page(z);
  103.     
  104.     c=Get_Char_Mouse_Kbd();
  105.  
  106.  
  107.     _settextposition(4,50);
  108.     printf("Page Z: Character \"%c\"",c);
  109.  
  110.      DeActivate_Mouse_Page(z);  
  111.  
  112.  
  113.     Activate_Mouse_Page(y);
  114.  
  115.     _settextposition(1,10);
  116.     printf("Page Y Active");
  117.  
  118.     c=Get_Char_Mouse_Kbd();
  119.  
  120.  
  121.     _settextposition(5,50);
  122.     printf("Page Y: Character \"%c\"",c);
  123.  
  124.     DeActivate_Mouse_Page(y);
  125.     
  126.     } while (c!='2');
  127.  
  128.  
  129.     Clear_All_Mouse_Definitions();
  130.  
  131.     Define_Mouse_System(M_Overlaid_Pages);
  132.  
  133.     y=Add_Mouse_Page(M_Text_Coord,15,20,24,40);
  134.  
  135.     z=Add_Mouse_Page(M_Text_Coord,5,10,15,20); 
  136.  
  137.     Add_Mouse_Button(0,M_Middle,'2');
  138.     Add_Mouse_Button(z,M_Left,'1');
  139.     Add_Mouse_Button(z,M_Right,0);
  140.     Add_Mouse_Hot_Spot(z,M_Right,7,13,13,18,'C');
  141.  
  142.     Add_Mouse_Button(y,M_Left,0);
  143.  
  144.     Add_Mouse_Hot_Spot(y,M_Left,15,20,24,30,'L');
  145.     Add_Mouse_Hot_Spot(y,M_Left,15,30,24,40,'R');
  146.  
  147.     _settextposition(3,50);
  148.     printf("# of buttons = %d\n",_mouse_there);
  149.  
  150.     Set_Mouse_Text_Cursor(0,0,TC('+',4,2));
  151.  
  152. do {
  153.     
  154.  
  155.     Activate_Mouse_Page(z);
  156.     
  157.     _settextposition(1,10);
  158.     printf("Page Z Active");
  159.  
  160.     
  161.     c=Get_Char_Mouse_Kbd();
  162.  
  163.     _settextposition(4,50);
  164.     printf("Page Z: Character \"%c\"",c);
  165.  
  166.      DeActivate_Mouse_Page(z);  
  167.  
  168.  
  169.     Activate_Mouse_Page(y);
  170.  
  171.     _settextposition(1,10);
  172.     printf("Page Y Active");
  173.  
  174.     c=Get_Char_Mouse_Kbd();
  175.  
  176.     _settextposition(5,50);
  177.     printf("Page Y: Character \"%c\"",c);
  178.  
  179.     Activate_Mouse_Page(z);
  180.     
  181.     c=Get_Char_Mouse_Kbd();
  182.  
  183.  
  184.     _settextposition(6,46);
  185.     printf("Page Y & Z: Character \"%c\"",c);
  186.     
  187.      DeActivate_Mouse_Page(y);  
  188.  
  189.     } while (c!='2');
  190.  
  191.  
  192. /***********************************************************************/
  193.  
  194.     _settextcolor(oldcolor);
  195. }
  196.  
  197.  
  198.  
  199.