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