diff options
author | Paul Gilbert | 2011-04-13 21:08:05 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-04-13 21:08:05 +1000 |
commit | e6090415b62907b1ccc3163a43e04e8cea992693 (patch) | |
tree | 7d1bb5dd19985f98a1fd988626e46ebc7b886845 /engines/tsage/events.h | |
parent | aadb4f74591f4044c82cf9de5cbac1694b9cd55c (diff) | |
parent | a2d1fdd3655a27e23a3df0bb68f32d27cd4b3319 (diff) | |
download | scummvm-rg350-e6090415b62907b1ccc3163a43e04e8cea992693.tar.gz scummvm-rg350-e6090415b62907b1ccc3163a43e04e8cea992693.tar.bz2 scummvm-rg350-e6090415b62907b1ccc3163a43e04e8cea992693.zip |
Merge remote branch 'remotes/dreammaster/tsage'
Diffstat (limited to 'engines/tsage/events.h')
-rw-r--r-- | engines/tsage/events.h | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/engines/tsage/events.h b/engines/tsage/events.h new file mode 100644 index 0000000000..d8f58a4ce2 --- /dev/null +++ b/engines/tsage/events.h @@ -0,0 +1,109 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: https://scummvm-misc.svn.sourceforge.net/svnroot/scummvm-misc/trunk/engines/tsage/events.h $ + * $Id: events.h 212 2011-02-06 10:19:01Z dreammaster $ + * + */ + +#ifndef TSAGE_EVENTS_H +#define TSAGE_EVENTS_H + +#include "common/events.h" +#include "common/array.h" +#include "common/str.h" +#include "graphics/surface.h" +#include "tsage/saveload.h" + +namespace tSage { + +enum EventType {EVENT_NONE = 0, EVENT_BUTTON_DOWN = 1, EVENT_BUTTON_UP = 2, EVENT_KEYPRESS = 4, + EVENT_MOUSE_MOVE = 8}; + +enum ButtonShiftFlags {BTNSHIFT_LEFT = 0, BTNSHIFT_RIGHT = 3, BTNSHIFT_MIDDLE = 4}; + +// Intrinisc game delay between execution frames. This runs at 60Hz +#define GAME_FRAME_TIME (1000 / 60) + +class GfxManager; + +class Event { +public: + EventType eventType; + Common::Point mousePos; + int btnState; + Common::KeyState kbd; + int ctr; + GfxManager *gfxMan; + bool handled; +}; + +enum CursorType { + OBJECT_STUNNER = 0, OBJECT_SCANNER = 1, OBJECT_STASIS_BOX = 2, + OBJECT_INFODISK = 3, OBJECT_STASIS_NEGATOR = 4, OBJECT_KEY_DEVICE = 5, OBJECT_MEDKIT = 6, + OBJECT_LADDER = 7, OBJECT_ROPE = 8, OBJECT_KEY = 9, OBJECT_TRANSLATOR = 10, OBJECT_ALE = 11, + OBJECT_PAPER = 12, OBJECT_WALDOS = 13, OBJECT_STASIS_BOX2 = 14, OBJECT_RING = 15, + OBJECT_CLOAK = 16, OBJECT_TUNIC = 17, OBJECT_CANDLE = 18, OBJECT_STRAW = 19, OBJECT_SCIMITAR = 20, + OBJECT_SWORD = 21, OBJECT_HELMET = 22, OBJECT_ITEMS = 23, OBJECT_CONCENTRATOR = 24, + OBJECT_NULLIFIER = 25, OBJECT_PEG = 26, OBJECT_VIAL = 27, OBJECT_JACKET = 28, + OBJECT_TUNIC2 = 29, OBJECT_BONE = 30, OBJECT_EMPTY_JAR = 31, OBJECT_JAR = 32, + + CURSOR_WALK = 0x100, CURSOR_LOOK = 0x200, CURSOR_700 = 700, CURSOR_USE = 0x400, CURSOR_TALK = 0x800, + CURSOR_NONE = -1, CURSOR_CROSSHAIRS = -2, CURSOR_ARROW = -3 +}; + +class EventsClass: public SaveListener { +private: + Common::Event _event; + uint32 _frameNumber; + uint32 _prevDelayFrame; + uint32 _priorFrameTime; +public: + EventsClass(); + + Common::Point _mousePos; + CursorType _currentCursor; + + void setCursor(CursorType cursorType); + void setCursor(Graphics::Surface &cursor, int transColour, const Common::Point &hotspot, CursorType cursorId); + void setCursorFromFlag(); + CursorType getCursor() const { return _currentCursor; } + void showCursor(); + void hideCursor(); + + bool pollEvent(); + void waitForPress(int eventMask = EVENT_BUTTON_DOWN | EVENT_KEYPRESS); + + bool getEvent(Event &evt, int eventMask = ~EVENT_MOUSE_MOVE); + Common::Event event() { return _event; } + Common::EventType type() { return _event.type; } + uint32 getFrameNumber() const { return _frameNumber; } + void delay(int numFrames); + + virtual void listenerSynchronise(Serialiser &s) { + s.syncAsUint32LE(_frameNumber); + s.syncAsUint32LE(_prevDelayFrame); + // TODO: Synchronise unknown stuff + } +}; + +} // End of namespace tSage + +#endif |