ScummVM API documentation
events.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 ACCESS_EVENTS_H
23 #define ACCESS_EVENTS_H
24 
25 #include "common/scummsys.h"
26 #include "common/events.h"
27 #include "common/stack.h"
28 
29 namespace Access {
30 
31 enum CursorType {
32  CURSOR_NONE = -1,
33  CURSOR_ARROW = 0, CURSOR_CROSSHAIRS, CURSOR_2, CURSOR_3, CURSOR_LOOK,
34  CURSOR_USE, CURSOR_TAKE, CURSOR_CLIMB, CURSOR_TALK, CURSOR_HELP,
35  CURSOR_INVENTORY = 99
36 };
37 
38 #define GAME_FRAME_RATE 100
39 #define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
40 #define GAME_TIMER_TIME 15
41 
42 class AccessEngine;
43 
45 private:
46  AccessEngine *_vm;
47  uint32 _frameCounter;
48  uint32 _priorFrameTime;
49  uint32 _priorTimerTime;
50  Common::KeyCode _keyCode;
51 
52  Graphics::Surface _invCursor;
53  bool checkForNextFrameCounter();
54  bool checkForNextTimerUpdate();
55  void nextFrame();
56  void nextTimer();
57  void keyControl(Common::KeyCode keycode, bool isKeyDown);
58 public:
59  CursorType _cursorId;
60  CursorType _normalMouse;
61  bool _leftButton, _rightButton;
62  bool _middleButton;
63  bool _wheelUp, _wheelDown;
64  Common::Point _mousePos;
65  int _mouseCol, _mouseRow;
66  bool _cursorExitFlag;
67  int _vbCount;
68 public:
73 
78 
82  uint32 getFrameCounter() { return _frameCounter; }
83 
87  void forceSetCursor(CursorType cursorId);
88 
92  void setNormalCursor(CursorType cursorId);
93 
97  void setCursor(CursorType cursorId);
98 
103 
107  CursorType getCursor() const { return _cursorId; }
108 
112  void showCursor();
113 
117  void hideCursor();
118 
122  bool isCursorVisible();
123 
124  void pollEvents(bool skipTimers = false);
125 
126  void pollEventsAndWait();
127 
128  void zeroKeys();
129 
130  bool getKey(Common::KeyState &key);
131 
132  bool isKeyPending() const;
133 
134  void delay(int time = 5);
135 
136  void debounceLeft();
137 
138  void clearEvents();
139 
140  void waitKeyMouse();
141 
142  Common::Point &getMousePos() { return _mousePos; }
143 
144  Common::Point calcRawMouse();
145 
146  int checkMouseBox1(Common::Array<Common::Rect> &rects);
147 
148  bool isKeyMousePressed();
149 
150  void centerMousePos();
151  void restrictMouse();
152 };
153 
154 } // End of namespace Access
155 
156 #endif /* ACCESS_EVENTS_H */
Definition: managed_surface.h:51
void forceSetCursor(CursorType cursorId)
uint32 getFrameCounter()
Definition: events.h:82
Definition: surface.h:67
Definition: events.h:44
Definition: access.h:84
Definition: rect.h:144
EventsManager(AccessEngine *vm)
CursorType getCursor() const
Definition: events.h:107
void setCursor(CursorType cursorId)
void setNormalCursor(CursorType cursorId)
Definition: rect.h:45
Definition: keyboard.h:294
Definition: access.h:62
void setCursorData(Graphics::ManagedSurface *src, const Common::Rect &r)