diff options
author | Stephen Kennedy | 2008-08-18 10:07:11 +0000 |
---|---|---|
committer | Stephen Kennedy | 2008-08-18 10:07:11 +0000 |
commit | d92909203b56d9b3fa6c4989bdeb83dbed5b94d5 (patch) | |
tree | 350de91c678c790dde49487804b02e1bb317f1d2 /backends/keymapper/hardware-key.h | |
parent | 63c4a61032bd97b478de9cbf82510f461d08f653 (diff) | |
download | scummvm-rg350-d92909203b56d9b3fa6c4989bdeb83dbed5b94d5.tar.gz scummvm-rg350-d92909203b56d9b3fa6c4989bdeb83dbed5b94d5.tar.bz2 scummvm-rg350-d92909203b56d9b3fa6c4989bdeb83dbed5b94d5.zip |
- proper init of virtual keyboard now implemented (involved added EventManager::init() which is called after screen has been initialised)
- changed HardwareKey / Action id field to an array of 4 chars instead of int32. Means that the keymap key/value pairs in config file are more readable.
svn-id: r33986
Diffstat (limited to 'backends/keymapper/hardware-key.h')
-rw-r--r-- | backends/keymapper/hardware-key.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/backends/keymapper/hardware-key.h b/backends/keymapper/hardware-key.h index 8807e6db9f..85badae3cc 100644 --- a/backends/keymapper/hardware-key.h +++ b/backends/keymapper/hardware-key.h @@ -30,12 +30,14 @@ namespace Common { +#define HWKEY_ID_SIZE (4) + /** * Describes an available hardware key */ struct HardwareKey { /** unique id used for saving/loading to config */ - int32 id; + char id[HWKEY_ID_SIZE]; /** Human readable description */ String description; /** @@ -48,15 +50,12 @@ struct HardwareKey { ActionType preferredType; int16 group; - HardwareKey(int32 i, KeyState ks = KeyState(), String des = "", + HardwareKey(const char *i, KeyState ks = KeyState(), String des = "", ActionCategory cat = kGenericActionCategory, - ActionType ty = kGenericActionType, int gr = 0) { - id = i; - key = ks; - description = des; - preferredCategory = cat; - preferredType = ty; - group = gr; + ActionType ty = kGenericActionType, int gr = 0) + : key(ks), description(des), preferredCategory(cat), preferredType(ty), group(gr) { + assert(i); + strncpy(id, i, HWKEY_ID_SIZE); } }; @@ -82,10 +81,10 @@ public: ++_count; } - const HardwareKey *findHardwareKey(int32 id) const { + const HardwareKey *findHardwareKey(const char *id) const { List<const HardwareKey*>::iterator it; for (it = _keys.begin(); it != _keys.end(); it++) { - if ((*it)->id == id) + if (strncmp((*it)->id, id, HWKEY_ID_SIZE) == 0) return (*it); } return 0; |