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;
52 
53  Graphics::Surface _invCursor;
54  bool checkForNextFrameCounter();
55  bool checkForNextTimerUpdate();
56  void nextFrame();
57  void nextTimer();
58  void keyControl(Common::KeyCode keycode, bool isKeyDown);
59  void actionControl(Common::CustomEventType action, bool isKeyDown);
60 public:
61  CursorType _cursorId;
62  CursorType _normalMouse;
63  bool _leftButton, _rightButton;
64  bool _middleButton;
65  bool _wheelUp, _wheelDown;
66  Common::Point _mousePos;
67  int _mouseCol, _mouseRow;
68  bool _cursorExitFlag;
69  int _vbCount;
70 public:
75 
80 
84  uint32 getFrameCounter() { return _frameCounter; }
85 
89  void forceSetCursor(CursorType cursorId);
90 
94  void setNormalCursor(CursorType cursorId);
95 
99  void setCursor(CursorType cursorId);
100 
105 
109  CursorType getCursor() const { return _cursorId; }
110 
114  void showCursor();
115 
119  void hideCursor();
120 
124  bool isCursorVisible();
125 
126  void pollEvents(bool skipTimers = false);
127 
128  void pollEventsAndWait();
129 
130  void zeroKeysActions();
131 
132  bool getAction(Common::CustomEventType &action);
133 
134  bool isKeyActionPending() const;
135 
136  void delay(int time = 5);
137 
138  void debounceLeft();
139 
140  void clearEvents();
141 
142  void waitKeyActionMouse();
143 
144  Common::Point &getMousePos() { return _mousePos; }
145 
146  Common::Point calcRawMouse();
147 
148  int checkMouseBox1(Common::Array<Common::Rect> &rects);
149 
150  bool isKeyActionMousePressed();
151 
152  void centerMousePos();
153  void restrictMouse();
154 };
155 
156 } // End of namespace Access
157 
158 #endif /* ACCESS_EVENTS_H */
Definition: managed_surface.h:51
void forceSetCursor(CursorType cursorId)
uint32 getFrameCounter()
Definition: events.h:84
Definition: surface.h:67
Definition: events.h:44
Definition: access.h:121
Definition: rect.h:524
uint32 CustomEventType
Definition: events.h:204
EventsManager(AccessEngine *vm)
CursorType getCursor() const
Definition: events.h:109
void setCursor(CursorType cursorId)
void setNormalCursor(CursorType cursorId)
Definition: rect.h:144
Definition: access.h:62
void setCursorData(Graphics::ManagedSurface *src, const Common::Rect &r)