home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / MOUSE / CMOUSE2.ZIP / TEST1.C < prev   
Encoding:
C/C++ Source or Header  |  1990-11-21  |  2.1 KB  |  76 lines

  1. #include <stdio.h>
  2. #include <dos.h>
  3. #include "mouse.h"
  4.  
  5. main()
  6.     {
  7.     int i = 0;
  8.     int x, y, b, press;
  9.  
  10.     static unsigned far masks[32] =            /* Graphics cursor masks */
  11.         {
  12.         0xffff, 0xffff, 0xffff, 0xffff,        /* Screen mask */
  13.         0xffff, 0xffff, 0xffff, 0xffff,
  14.         0xffff, 0xffff, 0xffff, 0xffff,
  15.         0xffff, 0xffff, 0xffff, 0xffff,
  16.  
  17.         0x8000, 0xe000, 0xf800, 0xd800,        /* Cursor mask */
  18.         0x0c00, 0x0600, 0x0300, 0x0000,
  19.         0x0000, 0x0000, 0x0000, 0x0000,
  20.         0x0000, 0x0000, 0x0000, 0x0000
  21.         };
  22.  
  23.     if((i = CheckMouse()) == 0)
  24.         {
  25.         puts("No mouse found");
  26.         exit(-1);
  27.         }
  28.     else
  29.         printf("Mouse with %d buttons found\n", i);
  30.  
  31.     puts("Cursor is visible");
  32.     DisplayMCursor(SHOW);
  33.     fprintf(stderr,"Press <Enter> to continue\n");
  34.     getchar();
  35.  
  36.     TextCursor(1, 12, 13);                /* Text mode underscore cursor */
  37.     PositionMCursor(200, 80);
  38.     puts("Now cursor is at 200, 80 and text mode");
  39.     fprintf(stderr,"Press <Enter> to continue\n");
  40.     getchar();
  41.  
  42.     while(!kbhit())                        /* Display changing locations        */
  43.         {                                        /* as mouse is moved                    */
  44.         b = CheckPosition(&x, &y);
  45.         printf("Buttons: %d, mouse at %d col and %d row\r", b, x, y);
  46.         }
  47.  
  48.     for(i = 0; i < 3; i++)                /* Show mouse location when        */
  49.         {                                        /* buttons were pressed                */
  50.         GetPress(i, &x, &y, &press);
  51.         printf("Button: %d, X: %d, Y: %d, Presses: %d\n", i, x, y, press);
  52.         }
  53.  
  54.     for(i = 0; i < 3; i++)                /* Show mouse locations when        */
  55.         {                                        /* buttons were released            */
  56.         GetRelease(i, &x, &y, &press);
  57.         printf("Button: %d, X: %d, Y: %d, Releases: %d\n", i, x, y, press);
  58.         }
  59.  
  60.     LimitCursor(HORIZ, 0, 80);            /* Limit mouse cursor travel        */
  61.     LimitCursor(VERT,  0, 80);
  62.     puts("Cursor movement is limited to 80 x 80 and full");
  63.     TextCursor(0, 0x77ff, 0x7700);    /* Make cursor a block                */
  64.  
  65.     GetMickeys(&x, &y);
  66.     fprintf(stderr,"Press <Enter> to continue\n");
  67.     getchar(); getche();                    /* Ecosoft does not use getche() */
  68.  
  69.     GetMickeys(&x, &y);
  70.     printf("Mickeys since last call - X: %d, Y: %d\n", x, y);
  71.     puts("Cursor is now hidden");
  72.     DisplayMCursor(HIDE);
  73.     getchar();
  74.     }
  75.  
  76.