MOUSE.H 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. * *
  20. * Project Name : Westwood 32 Bit Library *
  21. * *
  22. * File Name : MOUSE.H *
  23. * *
  24. * Programmer : Philip W. Gorrow *
  25. * *
  26. * Start Date : 12/12/95 *
  27. * *
  28. * Last Update : December 12, 1995 [PWG] *
  29. * *
  30. *---------------------------------------------------------------------------------------------*
  31. * Functions: *
  32. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  33. #ifndef WW_MOUSE_H
  34. #define WW_MOUSE_H
  35. #include <gbuffer.h>
  36. class WWMouseClass {
  37. public:
  38. WWMouseClass(GraphicViewPortClass *scr, int mouse_max_width, int mouse_max_height);
  39. ~WWMouseClass();
  40. void *Set_Cursor(int xhotspot, int yhotspot, void *cursor);
  41. void Process_Mouse(void);
  42. void Hide_Mouse(void);
  43. void Show_Mouse(void);
  44. void Conditional_Hide_Mouse(int x1, int y1, int x2, int y2);
  45. void Conditional_Show_Mouse(void);
  46. int Get_Mouse_State(void);
  47. int Get_Mouse_X(void);
  48. int Get_Mouse_Y(void);
  49. void Get_Mouse_XY(int &x, int &y);
  50. //
  51. // The following two routines can be used to render the mouse onto a graphicbuffer
  52. // other than the hidpage.
  53. //
  54. void Draw_Mouse(GraphicViewPortClass *scr);
  55. void Erase_Mouse(GraphicViewPortClass *scr, int forced = FALSE);
  56. void Block_Mouse(GraphicBufferClass *buffer);
  57. void Unblock_Mouse(GraphicBufferClass *buffer);
  58. void Set_Cursor_Clip(void);
  59. void Clear_Cursor_Clip(void);
  60. private:
  61. enum {
  62. CONDHIDE = 1,
  63. CONDHIDDEN = 2,
  64. };
  65. void Low_Hide_Mouse(void);
  66. void Low_Show_Mouse(int x, int y);
  67. char *MouseCursor; // pointer to the mouse cursor in memory
  68. int MouseXHot; // X hot spot of the current mouse cursor
  69. int MouseYHot; // Y hot spot of the current mouse cursor
  70. int CursorWidth; // width of the mouse cursor in pixels
  71. int CursorHeight; // height of the mouse cursor in pixels
  72. char *MouseBuffer; // pointer to background buffer in memory
  73. int MouseBuffX; // pixel x mouse buffer was preserved at
  74. int MouseBuffY; // pixel y mouse buffer was preserved at
  75. int MaxWidth; // maximum width of mouse background buffer
  76. int MaxHeight; // maximum height of mouse background buffer
  77. int MouseCXLeft; // left x pos if conditional hide mouse in effect
  78. int MouseCYUpper; // upper y pos if conditional hide mouse in effect
  79. int MouseCXRight; // right x pos if conditional hide mouse in effect
  80. int MouseCYLower; // lower y pos if conditional hide mouse in effect
  81. char MCFlags; // conditional hide mouse flags
  82. char MCCount; // nesting count for conditional hide mouse
  83. GraphicViewPortClass *Screen; // pointer to the surface mouse was init'd with
  84. char * PrevCursor; // pointer to previous cursor shape
  85. int MouseUpdate;
  86. int State;
  87. char *EraseBuffer; // Buffer which holds background to restore to hidden page
  88. int EraseBuffX; // X position of the hidden page background
  89. int EraseBuffY; // Y position of the hidden page background
  90. int EraseBuffHotX; // X position of the hidden page background
  91. int EraseBuffHotY; // Y position of the hidden page background
  92. int EraseFlags; // Records whether mutex has been released
  93. CRITICAL_SECTION MouseCriticalSection; // Control for mouse re-enterancy
  94. unsigned TimerHandle;
  95. };
  96. extern "C" {
  97. void __cdecl Mouse_Shadow_Buffer(void *thisptr, GraphicViewPortClass *srcdst, void *buffer, int x, int y, int hotx, int hoty, int store);
  98. void __cdecl Draw_Mouse(void *thisptr, GraphicViewPortClass *srcdst, int x, int y);
  99. void * __cdecl ASM_Set_Mouse_Cursor(void * thisptr, int hotspotx, int hotspoty, VOID *cursor);
  100. };
  101. void Hide_Mouse(void);
  102. void Show_Mouse(void);
  103. void Conditional_Hide_Mouse(int x1, int y1, int x2, int y2);
  104. void Conditional_Show_Mouse(void);
  105. int Get_Mouse_State(void);
  106. void *Set_Mouse_Cursor(int hotx, int hoty, void *cursor);
  107. int Get_Mouse_X(void);
  108. int Get_Mouse_Y(void);
  109. #endif