diff options
author | Stephen Kennedy | 2008-07-21 00:11:25 +0000 |
---|---|---|
committer | Stephen Kennedy | 2008-07-21 00:11:25 +0000 |
commit | 757ed1a0945334162d253f819deb6ddd1ee18037 (patch) | |
tree | b3bac6e2eb26c99a0e71816547996777e1406ce3 /backends/common/keymap.h | |
parent | 4c730401fea19d9fd32c2408315d3c3e788ff1fa (diff) | |
download | scummvm-rg350-757ed1a0945334162d253f819deb6ddd1ee18037.tar.gz scummvm-rg350-757ed1a0945334162d253f819deb6ddd1ee18037.tar.bz2 scummvm-rg350-757ed1a0945334162d253f819deb6ddd1ee18037.zip |
Moved UserAction and HardwareKey classes into their own respective header files.
Added HardwareKeySet class to manage a devices set of hardware keys.
Started implementing Keymapper class.
svn-id: r33157
Diffstat (limited to 'backends/common/keymap.h')
-rw-r--r-- | backends/common/keymap.h | 101 |
1 files changed, 3 insertions, 98 deletions
diff --git a/backends/common/keymap.h b/backends/common/keymap.h index c03e2e03d5..a2e204827e 100644 --- a/backends/common/keymap.h +++ b/backends/common/keymap.h @@ -1,110 +1,15 @@ #ifndef COMMON_KEYMAP #define COMMON_KEYMAP +#include "backends/common/hardware-key.h" +#include "backends/common/user-action.h" #include "common/array.h" -#include "common/events.h" +#include "common/keyboard.h" #include "common/func.h" #include "common/hashmap.h" -#include "common/list.h" namespace Common { -enum UserActionType { - kGenericUserActionType, - - // common actions - kDirectionUpUserAction, - kDirectionDownUserAction, - kDirectionLeftUserAction, - kDirectionRightUserAction, - kLeftClickUserAction, - kRightClickUserAction, - kSaveUserAction, - kMenuUserAction, - - kUserActionTypeMax -}; - -enum UserActionCategory { - kGenericUserActionCategory, - // classes of action - probably need to be slightly more specific than this - kInGameUserAction, // effects the actual gameplay - kSystemUserAction, //show a menu / change volume / etc - - kUserActionCategoryMax -}; - -/** -* Describes an available hardware key -*/ -struct HardwareKey { - /** unique id used for saving/loading to config */ - int32 id; - /** Human readable description */ - String description; - /** - * The KeyState that is generated by the back-end - * when this hardware key is pressed. - */ - KeyState key; - - UserActionCategory preferredCategory; - UserActionType preferredType; - int16 group; - - HardwareKey(KeyState ks = KeyState(), String des = "", - UserActionCategory cat = kGenericUserActionCategory, - UserActionType ty = kGenericUserActionType, int gr = 0) { - key = ks; - description = des; - preferredCategory = cat; - preferredType = ty; - group = gr; - } -}; - -struct UserAction { - /** unique id used for saving/loading to config */ - int32 id; - /** Human readable description */ - String description; - /** Events to be sent when mapped key is pressed */ - List<Event> events; - UserActionCategory category; - UserActionType type; - int priority; - int group; - int flags; - - HardwareKey *hwKey; - - UserAction( String des = "", - UserActionCategory cat = kGenericUserActionCategory, - UserActionType ty = kGenericUserActionType, - int pr = 0, int gr = 0, int fl = 0 ) { - description = des; - category = cat; - type = ty; - priority = pr; - group = gr; - flags = fl; - hwKey = 0; - } -}; - -/** - * EqualTo function for KeyState - */ -template<> struct EqualTo<KeyState> - : public BinaryFunction<KeyState, KeyState, bool> { - - bool operator()(const KeyState &x, const KeyState &y) const { - return (x.keycode == y.keycode) - && (x.ascii == y.ascii) - && (x.flags == y.flags); - } -}; - /** * Hash function for KeyState */ |