home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / RAYCAST.ZIP / MOUSE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-10  |  1.3 KB  |  75 lines

  1. /*
  2. Mouse.cpp
  3. DOS mouse routines
  4. The include os.h is a file I include so the file only exists if you're running under DOS
  5. This means it can be included in a non-Dos project file without screwing up the compile
  6. */
  7.  
  8. #include "os.h"
  9. #ifdef OS_DOS
  10. #include <i86.h>
  11. #include "mouse.h"
  12.  
  13. extern union REGS regs;
  14. extern struct SREGS sregs;
  15.  
  16. const int mousediv=2;
  17.  
  18. short initmouse(){
  19.   regs.w.ax=0x0;
  20.   int386(0x33,®s,®s);
  21.   return regs.w.ax;
  22.   }
  23.  
  24. void showmouse(){
  25.   regs.w.ax=0x1;
  26.   int386(0x33,®s,®s);
  27.   }
  28.  
  29. void hidemouse(){
  30.   regs.w.ax=0x2;
  31.   int386(0x33,®s,®s);
  32.   }
  33.  
  34. short mbpos(short & x, short & y)
  35.   {
  36.   regs.w.ax=0x3;
  37.   int386(0x33,®s,®s);
  38.   x=(short)regs.w.cx/mousediv;
  39.   y=(short)regs.w.dx;
  40.   return (regs.w.bx);
  41.   }
  42.  
  43. void mbrel(short & x, short & y)
  44. {
  45. regs.w.ax=0xb;
  46. int386(0x33,®s,®s);
  47. x=(short)regs.w.cx;
  48. y=(short)regs.w.dx;
  49. }
  50.  
  51. void micktopix(short int horiz, short int vert)
  52. {
  53. regs.w.cx=horiz;
  54. regs.w.dx=vert;
  55. regs.w.ax=0x0f;
  56. int386(0x33,®s,®s);
  57. }
  58.  
  59. void xlimit(short int min, short int max)
  60. {
  61. regs.w.cx=min;
  62. regs.w.dx=max;
  63. regs.w.ax=0x7;
  64. int386(0x33,®s,®s);
  65. }
  66.  
  67. void ylimit(short int min, short int max)
  68. {
  69. regs.w.cx=min;
  70. regs.w.dx=max;
  71. regs.w.ax=0x8;
  72. int386(0x33,®s,®s);
  73. }
  74. #endif
  75.