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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef AGS_ENGINE_DEVICE_MOUSEW32_H
24 #define AGS_ENGINE_DEVICE_MOUSEW32_H
25 
26 #include "ags/shared/util/geometry.h"
27 #include "ags/shared/util/geometry.h"
28 
29 namespace AGS3 {
30 namespace AGS {
31 namespace Shared {
32 class Bitmap;
33 } // namespace Shared
34 } // namespace AGS
35 
36 using namespace AGS; // FIXME later
37 
38 void msetgraphpos(int, int);
39 void mgetgraphpos();
40 // Sets the area of the game frame (zero-based coordinates) where the mouse cursor is allowed to move;
41 // this function was meant to be used to achieve gameplay effect
42 void msetcursorlimit(int x1, int y1, int x2, int y2);
43 void msetgraphpos(int xa, int ya);
44 void msethotspot(int xx, int yy);
45 int minstalled();
46 
47 struct Mouse {
48 	// Tells whether mouse was locked to the game window
49 	bool LockedToWindow = false;
50 
51 	// Screen rectangle, in which the mouse movement is controlled by engine
52 	Rect  ControlRect;
53 	// Mouse control enabled flag
54 	bool  ControlEnabled = false;
55 	// Flag that tells whether the mouse must be forced to stay inside control rect
56 	bool  ConfineInCtrlRect = false;
57 	// Mouse speed value provided by user
58 	float SpeedVal = 1.f;
59 	// Mouse speed unit
60 	float SpeedUnit = 1.f;
61 	// Actual speed factor (cached)
62 	float Speed = 1.f;
63 
64 
65 	void WindowToGame(int &x, int &y);
66 
67 	// Get if mouse is locked to the game window
68 	bool IsLockedToWindow();
69 	// Try locking mouse to the game window
70 	bool TryLockToWindow();
71 	// Unlock mouse from the game window
72 	void UnlockFromWindow();
73 
74 	// Tell if the mouse movement control is enabled
75 	bool IsControlEnabled() const;
76 	// Set base speed factor, which would serve as a mouse speed unit
77 	void SetSpeedUnit(float f);
78 	// Get base speed factor
79 	float GetSpeedUnit();
80 	// Set speed factors
81 	void SetSpeed(float speed);
82 	// Get speed factor
83 	float GetSpeed();
84 
85 	// Limits the area where the game cursor can move on virtual screen;
86 	// parameter must be in native game coordinates
87 	void SetMoveLimit(const Rect &r);
88 	// Set actual OS cursor position on screen; parameter must be in native game coordinates
89 	void SetPosition(const Point p);
90 
91 	void UpdateGraphicArea();
92 	void SetMovementControl(bool flag);
93 };
94 
95 } // namespace AGS3
96 
97 #endif
98