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 SHERLOCK_EVENTS_H
23#define SHERLOCK_EVENTS_H
24
25#include "common/scummsys.h"
26#include "common/events.h"
27#include "common/queue.h"
28#include "sherlock/image_file.h"
29
30namespace Sherlock {
31
32#define GAME_FRAME_RATE 30
33#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
34
35enum CursorId { ARROW = 0, MAGNIFY = 1, WAIT = 2, EXIT_ZONES_START = 5, INVALID_CURSOR = -1 };
36
37class SherlockEngine;
38
39class Events {
40private:
41 SherlockEngine *_vm;
42 uint32 _frameCounter;
43 uint32 _priorFrameTime;
44 ImageFile *_cursorImages;
45 int _mouseButtons;
46 Common::Point _mousePos;
47 int _waitCounter;
48 uint _frameRate;
49
53 bool checkForNextFrameCounter();
54public:
55 CursorId _cursorId;
56 bool _pressed;
57 bool _released;
58 bool _rightPressed;
59 bool _rightReleased;
60 bool _oldButtons;
61 bool _oldRightButton;
62 bool _firstPress;
65 Common::Point _hotspotPos;
66public:
68 ~Events();
69
73 void loadCursors(const Common::Path &filename);
74
78 void setCursor(CursorId cursorId);
79
83 void setCursor(const Graphics::Surface &src, int hotspotX = 0, int hotspotY = 0);
84
88 void setCursor(CursorId cursorId, const Common::Point &cursorPos, const Graphics::Surface &surface);
89
94
98 void showCursor();
99
104
108 CursorId getCursor() const;
109
113 bool isCursorVisible() const;
114
119
125
129 void warpMouse(const Common::Point &pt);
130
134 void warpMouse();
135
139 Common::Point screenMousePos() const { return _mousePos; }
140
145
149 void setFrameRate(int newRate);
150
155
159 uint32 getFrameCounter() const { return _frameCounter; }
160
164 bool kbHit() const { return !_pendingKeys.empty(); }
165
169 bool actionHit() const { return !_pendingActions.empty(); }
170
175
180
185
190
195
199 void wait(int numFrames);
200
204 bool delay(uint32 time, bool interruptable = false);
205
213
218
223
228};
229
230} // End of namespace Sherlock
231
232#endif /* SHERLOCK_EVENTS_H */
Definition: path.h:52
Definition: events.h:39
bool delay(uint32 time, bool interruptable=false)
void warpMouse(const Common::Point &pt)
void pollEventsAndWait()
Common::CustomEventType getAction()
void setCursor(CursorId cursorId)
Common::Point screenMousePos() const
Definition: events.h:139
void setCursor(CursorId cursorId, const Common::Point &cursorPos, const Graphics::Surface &surface)
Common::Point mousePos() const
void loadCursors(const Common::Path &filename)
void setFrameRate(int newRate)
void wait(int numFrames)
bool actionHit() const
Definition: events.h:169
bool kbHit() const
Definition: events.h:164
Common::KeyState getKey()
bool isCursorVisible() const
void animateCursorIfNeeded()
CursorId getCursor() const
void setCursor(const Graphics::Surface &src, int hotspotX=0, int hotspotY=0)
uint32 getFrameCounter() const
Definition: events.h:159
Definition: image_file.h:78
Definition: sherlock.h:206
uint32 CustomEventType
Definition: events.h:212
Definition: keyboard.h:294
Definition: rect.h:144
Definition: surface.h:67