xmouse.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. ** Command & Conquer Renegade(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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Command & Conquer *
  23. * *
  24. * $Archive:: /Commando/Code/wwlib/xmouse.h $*
  25. * *
  26. * $Author:: Byon_g $*
  27. * *
  28. * $Modtime:: 11/28/00 2:44p $*
  29. * *
  30. * $Revision:: 3 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef XMOUSE_H
  36. #define XMOUSE_H
  37. #include "trect.h"
  38. class Surface;
  39. class ShapeSet;
  40. /*
  41. ** This class manages the "mouse cursor". It presumes the mouse behaves in the traditional
  42. ** manner, but requires more manual management than a traditional mouse.
  43. **
  44. ** The mouse interface is designed with the following requirements:
  45. **
  46. ** 1> The interface (coordinate system) must be consistent with respect to the game user.
  47. ** This means that coordinate 0,0 is the upper left pixel of the drawable client area.
  48. **
  49. ** 2> It must support arbitrary mouse cursor artwork size and hotspot positioning. Mouse shape
  50. ** animation should be a simple process of just changing the mouse shape.
  51. **
  52. ** 3> The mouse must be able to break free of the game constraints where necessary in order
  53. ** to interface with the operating system. The transition should be easy to manage.
  54. **
  55. ** 4> The game mouse "active" region may be a subset rectangle of the normal visible surface.
  56. ** This bounding requirement should be transparent to system's functionality.
  57. **
  58. ** The system assumes that the sub-rectangle that binds the mouse to the visible surface will
  59. ** exactly match the dimensions of any hidden surface that the mouse may have occasion to be
  60. ** drawn upon.
  61. */
  62. class Mouse {
  63. public:
  64. virtual ~Mouse(void) {}
  65. /*
  66. ** Sets the game-drawn mouse imagery.
  67. */
  68. virtual void Set_Cursor(int xhotspot, int yhotspot, ShapeSet const * cursor, int shape) = 0;
  69. /*
  70. ** Controls visibility of the game-drawn mouse.
  71. */
  72. virtual void Hide_Mouse(void) = 0;
  73. virtual void Show_Mouse(void) = 0;
  74. /*
  75. ** Takes control of and releases control of the mouse with
  76. ** respect to the operating system. The mouse must be released
  77. ** during operations with the operating system. When the mouse is
  78. ** relased, it may move outside of the confining rectangle and its
  79. ** shape is controlled by the operating sytem.
  80. */
  81. virtual void Release_Mouse(void) = 0;
  82. virtual void Capture_Mouse(void) = 0;
  83. virtual bool Is_Captured(void) const = 0;
  84. /*
  85. ** Hide the mouse if it falls within this game screen region.
  86. */
  87. virtual void Conditional_Hide_Mouse(Rect region) = 0;
  88. virtual void Conditional_Show_Mouse(void) = 0;
  89. /*
  90. ** Query about the mouse visiblity state and location. If the mouse
  91. ** state is zero or greater, then the mouse is visible.
  92. */
  93. virtual int Get_Mouse_State(void) const = 0;
  94. virtual int Get_Mouse_X(void) const = 0;
  95. virtual int Get_Mouse_Y(void) const = 0;
  96. /*
  97. ** Set the mouse location.
  98. */
  99. virtual void Set_Mouse_XY( int xpos, int ypos ) = 0;
  100. /*
  101. ** The following two routines can be used to render the mouse onto an alternate
  102. ** surface.
  103. */
  104. virtual void Draw_Mouse(Surface * scr, bool issidebarsurface = false) = 0;
  105. virtual void Erase_Mouse(Surface * scr, bool issidebarsurface = false) = 0;
  106. //virtual void Erase_Mouse(Surface * scr) = 0;
  107. /*
  108. ** Converts O/S screen coordinates into game coordinates.
  109. */
  110. virtual void Convert_Coordinate(int & x, int & y) const = 0;
  111. };
  112. #endif