ScummVM API documentation
mouse_w32.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AGS_ENGINE_DEVICE_MOUSEW32_H
23 #define AGS_ENGINE_DEVICE_MOUSEW32_H
24 
25 #include "ags/shared/util/geometry.h"
26 #include "ags/shared/util/geometry.h"
27 
28 namespace AGS3 {
29 namespace AGS {
30 namespace Shared {
31 class Bitmap;
32 } // namespace Shared
33 } // namespace AGS
34 
35 using namespace AGS; // FIXME later
36 
37 struct Mouse {
38  // Tells whether mouse was locked to the game window
39  bool LockedToWindow = false;
40 
41  // Screen rectangle, in which the mouse movement is controlled by engine
42  Rect ControlRect;
43  // Mouse control enabled flag
44  bool ControlEnabled = false;
45  // Flag that tells whether the mouse must be forced to stay inside control rect
46  bool ConfineInCtrlRect = false;
47  // Mouse speed value provided by user
48  float SpeedVal = 1.f;
49  // Mouse speed unit
50  float SpeedUnit = 1.f;
51  // Actual speed factor (cached)
52  float Speed = 1.f;
53 
54  // Converts real window coordinates to native game coords
55  void WindowToGame(int &x, int &y);
56  // Sets mouse position in system coordinates, syncs with the real mouse cursor
57  void SetSysPosition(int x, int y);
58 
59  // Tells the number of supported mouse buttons
60  int GetButtonCount();
61 
62  // Get if mouse is locked to the game window
63  bool IsLockedToWindow();
64  // Try locking mouse to the game window
65  bool TryLockToWindow();
66  // Unlock mouse from the game window
67  void UnlockFromWindow();
68 
69  // Tell if the mouse movement control is enabled
70  bool IsControlEnabled() const;
71  // Set base speed factor, which would serve as a mouse speed unit
72  void SetSpeedUnit(float f);
73  // Get base speed factor
74  float GetSpeedUnit();
75  // Set speed factors
76  void SetSpeed(float speed);
77  // Get speed factor
78  float GetSpeed();
79 
80  // Updates limits of the area inside which the standard OS cursor is not shown;
81  // uses game's main viewport (in native coordinates) to calculate real area on screen
82  void UpdateGraphicArea();
83  // Limits the area where the game cursor can move on virtual screen;
84  // parameter must be in native game coordinates
85  void SetMoveLimit(const Rect &r);
86 
87  // Polls the cursor position, updates mousex, mousey
88  void Poll();
89  // Set actual OS cursor position on screen; in native game coordinates
90  void SetPosition(const Point &p);
91  // Sets the relative position of the cursor's hotspot, in native pixels
92  void SetHotspot(int x, int y);
93 
94  void SetMovementControl(bool flag);
95 };
96 
97 } // namespace AGS3
98 
99 #endif
Definition: achievements_tables.h:27
Definition: geometry.h:87
Definition: geometry.h:219
Definition: mouse_w32.h:37
Definition: ags.h:40