aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorEugene Sandulenko2009-01-11 00:20:27 +0000
committerEugene Sandulenko2009-01-11 00:20:27 +0000
commit83972e2001e0654e057b5a4930cd2cbc05165786 (patch)
tree1137fef4016651c2ad56aa44024649c80d0a939f /common
parent326df55debb696f73c33450569af4a6d0c60b0fd (diff)
parentfe39d4f5075cc723945ca813142d02983069d0d5 (diff)
downloadscummvm-rg350-83972e2001e0654e057b5a4930cd2cbc05165786.tar.gz
scummvm-rg350-83972e2001e0654e057b5a4930cd2cbc05165786.tar.bz2
scummvm-rg350-83972e2001e0654e057b5a4930cd2cbc05165786.zip
Merge in Virtual Keybpard & KeyMapper branch,
- Merge is perfromed in order to not let rotting the code - Makefile modifications were avoided Stuff to resolve: - Circular dependency of common/vkeybd from graphics/ - Make it compilable (?) - Add some keyboards - Decide on the key bindings svn-id: r35813
Diffstat (limited to 'common')
-rw-r--r--common/events.h15
-rw-r--r--common/keyboard.h4
-rw-r--r--common/stack.h6
3 files changed, 22 insertions, 3 deletions
diff --git a/common/events.h b/common/events.h
index 0f0b0cf783..f6a07e3341 100644
--- a/common/events.h
+++ b/common/events.h
@@ -125,6 +125,7 @@ struct Event {
Event() : type(EVENT_INVALID), synthetic(false) {}
};
+class Keymapper;
/**
* The EventManager provides user input events to the client code.
@@ -141,6 +142,12 @@ public:
RBUTTON = 1 << 1
};
+
+ /**
+ * Initialise the event manager.
+ * @note called after graphics system has been set up
+ */
+ virtual void init() {}
/**
* Get the next event in the event queue.
* @param event point to an Event struct, which will be filled with the event data.
@@ -149,9 +156,9 @@ public:
virtual bool pollEvent(Common::Event &event) = 0;
/**
- * Pushes a "fake" event of the specified type into the event queue
+ * Pushes a "fake" event into the event queue
*/
- virtual void pushEvent(Common::Event event) = 0;
+ virtual void pushEvent(const Common::Event &event) = 0;
/** Register random source so it can be serialized in game test purposes **/
virtual void registerRandomSource(Common::RandomSource &rnd, const char *name) = 0;
@@ -195,6 +202,10 @@ public:
// TODO: Consider removing OSystem::getScreenChangeID and
// replacing it by a generic getScreenChangeID method here
+#ifdef ENABLE_KEYMAPPER
+ virtual Common::Keymapper *getKeymapper() = 0;
+#endif
+
protected:
Common::Queue<Common::Event> artificialEventQueue;
diff --git a/common/keyboard.h b/common/keyboard.h
index 9b6558dbff..6a4445728f 100644
--- a/common/keyboard.h
+++ b/common/keyboard.h
@@ -259,6 +259,10 @@ struct KeyState {
keycode = KEYCODE_INVALID;
ascii = flags = 0;
}
+
+ bool operator ==(const KeyState &x) const {
+ return keycode == x.keycode && ascii == x.ascii && flags == x.flags;
+ }
};
} // End of namespace Common
diff --git a/common/stack.h b/common/stack.h
index 876efacc3f..238d0f6433 100644
--- a/common/stack.h
+++ b/common/stack.h
@@ -88,7 +88,11 @@ protected:
public:
Stack<T>() {}
Stack<T>(const Array<T> &stackContent) : _stack(stackContent) {}
-
+
+ Stack<T>& operator=(const Stack<T> &st) {
+ _stack = st._stack;
+ return *this;
+ }
bool empty() const {
return _stack.empty();
}