Advertisement
nguyenvanquan7826

chuột

May 26th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.41 KB | None | 0 0
  1. int bit_get(int num, int pos)
  2. {
  3.   return (num>>pos)&1;
  4. }
  5.  
  6. void bit_set(int *num, int pos)
  7. {
  8.   *num|(1 << pos);
  9. }
  10. int initmouse()
  11. {
  12.   _AX = 0;
  13.   geninterrupt(0x33);
  14.   if (_AX == 0) return _AX; else return _BX;
  15. }
  16.  
  17. void showmouse()
  18. {
  19.   _AX = 1;
  20.   geninterrupt(0x33);
  21. }
  22.  
  23. void hidemouse()
  24. {
  25.   _AX = 2;
  26.   geninterrupt(0x33);
  27. }
  28.  
  29. void getXY(int *mouseX, int *mouseY)
  30. {
  31.   _AX = 3;
  32.   geninterrupt(0x33);
  33.   *mouseX = _CX;
  34.   *mouseY = _DX;
  35. }
  36.  
  37. int left_down()
  38. {
  39.   _AX = 3;
  40.   geninterrupt(0x33);
  41.   return bit_get(_BX, 0);
  42. }
  43.  
  44. int right_down()
  45. {
  46.   _AX = 3;
  47.   geninterrupt(0x33);
  48.   return bit_get(_BX, 1);
  49. }
  50. /*
  51. void move(int mouseX, int mouseY)
  52. {
  53.   _AX = 4;
  54.   _CX = mouseX;
  55.   _DX = mouseY;
  56.   geninterrupt(0x33);
  57. }
  58. */
  59. void setX(int start, int end)
  60. {
  61.   _AX = 7;
  62.   _CX = start;
  63.   _DX = end;
  64.   geninterrupt(0x33);
  65. }
  66.  
  67. void setY(int start, int end)
  68. {
  69.   _AX = 8;
  70.   _CX = start;
  71.   _DX = end;
  72.   geninterrupt(0x33);
  73. }
  74.  
  75. int left_up()
  76. {
  77.   int fx, fy, lx, ly;
  78.   _BX = 0;
  79.   _AX = 6;
  80.   geninterrupt(0x33);
  81.   if (_BX == 1)
  82.   {
  83.     fx = _CX; fy = _DX;
  84.     getXY(&lx, &ly);
  85.     if ((fx == lx)&(fy == ly)) return 1; else return 0;
  86.   } else return 0;
  87. }
  88.  
  89. int right_up()
  90. {
  91.   int fx, fy, lx, ly;
  92.   _BX = 1;
  93.   _AX = 6;
  94.   geninterrupt(0x33);
  95.   if (_BX == 1)
  96.   {
  97.     fx = _CX; fy = _DX;
  98.     getXY(&lx, &ly);
  99.     if ((fx == lx)&(fy == ly)) return 1; else return 0;
  100.   } else return 0;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement