diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-03-09 15:36:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-03-09 15:36:51 +0300 |
commit | 443813146a327504a07a507f43117d92296ca8a7 (patch) | |
tree | 073f9dcbc4b776675e299f5c5c9df1555cf73ee6 /src/keyboardconfig.h | |
parent | e11249023c8945fb817469b3b4362dcd8c2fd9f0 (diff) | |
download | manaplus-443813146a327504a07a507f43117d92296ca8a7.tar.gz manaplus-443813146a327504a07a507f43117d92296ca8a7.tar.bz2 manaplus-443813146a327504a07a507f43117d92296ca8a7.tar.xz manaplus-443813146a327504a07a507f43117d92296ca8a7.zip |
Move getting keys from game to keyboard config.
Diffstat (limited to 'src/keyboardconfig.h')
-rw-r--r-- | src/keyboardconfig.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index 1c91159ac..55e795e61 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.h @@ -24,9 +24,13 @@ #define KEYBOARDCONFIG_H #include <SDL_types.h> +#include <SDL_keyboard.h> #include <string> +//enum SDLKey; +union SDL_Event; + /** * Each key represents a key function. Such as 'Move up', 'Attack' etc. */ @@ -104,12 +108,12 @@ class KeyboardConfig /** * Get the key function index by providing the keys value. */ - int getKeyIndex(int keyValue, int grp = 1) const; + int getKeyIndex(const SDL_Event &event, int grp = 1) const; /** * Get the key function index for an emote by providing the offset value. */ - int getKeyEmoteOffset(int keyValue) const; + int getKeyEmoteOffset(const SDL_Event &event) const; /** * Set the enable flag, which will stop the user from doing actions. @@ -126,8 +130,7 @@ class KeyboardConfig /** * Set the value of the new key. */ - void setNewKey(int value) - { mKey[mNewKeyIndex].value = value; } + void setNewKey(const SDL_Event &event); /** * Set a reference to the key setup window. @@ -152,6 +155,10 @@ class KeyboardConfig const std::string &getBindError() const { return mBindError; } + SDLKey getKeyFromEvent(const SDL_Event &event) const; + + void unassignKey(); + /** * All the key functions. * KEY_NO_VALUE is used in initialization, and should be unchanged. |