From 443813146a327504a07a507f43117d92296ca8a7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 9 Mar 2012 15:36:51 +0300 Subject: Move getting keys from game to keyboard config. --- src/keyboardconfig.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/keyboardconfig.h') 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 +#include #include +//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. -- cgit v1.2.3-60-g2f50