aboutsummaryrefslogtreecommitdiff
path: root/engines/m4/events.h
diff options
context:
space:
mode:
authorFilippos Karapetis2008-04-20 14:47:37 +0000
committerFilippos Karapetis2008-04-20 14:47:37 +0000
commit7ca439f410ac1c46a387567b30271ae4e4a2ed30 (patch)
tree4d4154169b074293581ad6a11ee821290418f4fb /engines/m4/events.h
parentd0590a09eac68d5cde64d37fb2e5bbd1471a676a (diff)
downloadscummvm-rg350-7ca439f410ac1c46a387567b30271ae4e4a2ed30.tar.gz
scummvm-rg350-7ca439f410ac1c46a387567b30271ae4e4a2ed30.tar.bz2
scummvm-rg350-7ca439f410ac1c46a387567b30271ae4e4a2ed30.zip
Initial import of the work in progress M4 engine
svn-id: r31600
Diffstat (limited to 'engines/m4/events.h')
-rw-r--r--engines/m4/events.h132
1 files changed, 132 insertions, 0 deletions
diff --git a/engines/m4/events.h b/engines/m4/events.h
new file mode 100644
index 0000000000..d261f29013
--- /dev/null
+++ b/engines/m4/events.h
@@ -0,0 +1,132 @@
+/* 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$
+ * $Id$
+ *
+ */
+
+#ifndef M4_EVENTS_H
+#define M4_EVENTS_H
+
+#include "common/events.h"
+#include "common/rect.h"
+
+#include "m4/globals.h"
+#include "m4/assets.h"
+#include "m4/sprite.h"
+#include "m4/graphics.h"
+#include "m4/console.h"
+
+namespace M4 {
+
+#define LEFT_BUTTON_DOWN 1 << 0
+#define RIGHT_BUTTON_DOWN 1 << 1
+
+enum M4EventType {
+ MEVENT_NO_EVENT, MEVENT_MOVE,
+ MEVENT_LEFT_CLICK, MEVENT_LEFT_HOLD, MEVENT_LEFT_DRAG, MEVENT_LEFT_RELEASE,
+ MEVENT_RIGHT_CLICK, MEVENT_RIGHT_HOLD, MEVENT_RIGHT_DRAG, MEVENT_RIGHT_RELEASE,
+ MEVENT_BOTH_CLICK, MEVENT_BOTH_HOLD, MEVENT_BOTH_DRAG, MEVENT_BOTH_RELEASE,
+ MEVENT_DOUBLECLICK, MEVENT_DOUBLECLICK_HOLD, MEVENT_DOUBLECLICK_DRAG, MEVENT_DOUBLECLICK_RELEASE,
+ KEVENT_KEY
+};
+
+enum M4MouseState {
+ MSTATE_NO_EVENT, MSTATE_LEFT_CLICK_DOWN, MSTATE_RIGHT_CLICK_DOWN, MSTATE_BOTH_CLICK_DOWN,
+ MSTATE_DOUBLECLICK_DOWN
+};
+
+enum M4CommonCursors {
+ CURSOR_ARROW = 0,
+ CURSOR_HOURGLASS = 5,
+ CURSOR_LOOK = 6,
+ CURSOR_TAKE = 8,
+ CURSOR_USE = 9
+};
+
+class M4Sprite;
+class SpriteAsset;
+
+class Events {
+private:
+ M4Engine *_vm;
+ Common::Event _event;
+ M4MouseState _mouseState;
+ int _keyCode;
+ int _mouseButtons;
+ Console *_console;
+public:
+ bool quitFlag;
+ Events(M4Engine *vm);
+
+ Common::Event &event() { return _event; }
+ Common::EventType type() { return _event.type; }
+
+ // M4-centric methods
+ M4EventType handleEvents();
+ bool kbdCheck(uint32 &keyCode);
+ int getMouseButtonsState() { return _mouseButtons; }
+ Console* getConsole() { return _console; }
+};
+
+
+class Mouse {
+private:
+ M4Engine *_vm;
+ int _currentCursor, _lockedCursor;
+ bool _locked;
+ bool _cursorOn;
+ M4Sprite *_cursor;
+ SpriteAsset *_cursorSprites;
+ Common::Rect _hideRect, _showRect;
+ Common::Point _currentPos;
+
+ void handleEvent(Common::Event &event);
+ bool inHideArea();
+ friend class Events;
+public:
+ Mouse(M4Engine *vm);
+ ~Mouse();
+
+ bool init(const char *seriesName, RGB8 *palette);
+ bool setCursorNum(int cursorIndex);
+ int getCursorNum() { return _currentCursor; }
+ int cursorCount();
+ Common::Point currentPos() const { return _currentPos; }
+ M4Sprite *cursor() { return _cursor; }
+ void cursorOn();
+ void cursorOff();
+ bool getCursorOn() { return _cursorOn; }
+ void lockCursor(int cursorIndex);
+ void unlockCursor();
+
+ const char *getVerb();
+
+ void resetMouse();
+ void setHideRect(Common::Rect &r);
+ void setShowRect(Common::Rect &r);
+ const Common::Rect *getHideRect();
+ const Common::Rect *getShowRect();
+};
+
+}
+
+#endif