diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-03-24 04:26:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-03-26 21:45:24 +0300 |
commit | 36e5d21fe06709ba4d12a8619af07b86a676cf8c (patch) | |
tree | a9209e16e6f31cd74047f86ef1e642f467e128e2 /src/keyboardconfig.h | |
parent | 0921a130f0241a17ffcedf92d602808e18f1614b (diff) | |
download | mv-36e5d21fe06709ba4d12a8619af07b86a676cf8c.tar.gz mv-36e5d21fe06709ba4d12a8619af07b86a676cf8c.tar.bz2 mv-36e5d21fe06709ba4d12a8619af07b86a676cf8c.tar.xz mv-36e5d21fe06709ba4d12a8619af07b86a676cf8c.zip |
Redesign input handling.
Diffstat (limited to 'src/keyboardconfig.h')
-rw-r--r-- | src/keyboardconfig.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index 009ede631..a7542f17c 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.h @@ -27,9 +27,19 @@ #include <SDL_keyboard.h> #include <string> +#include <vector> + +#include "actionmanager.h" union SDL_Event; +typedef std::vector<int> KeysVector; +typedef KeysVector::iterator KeysVectorIter; +typedef KeysVector::const_iterator KeysVectorCIter; + +typedef std::map<int, KeysVector> KeyToActionMap; +typedef KeyToActionMap::iterator KeyToActionMapIter; + /** * Each key represents a key function. Such as 'Move up', 'Attack' etc. */ @@ -40,6 +50,10 @@ struct KeyFunction std::string caption; /** The caption value for the key function. */ int value; /** The actual value that is used. */ int grp; /** The key group */ + ActionFuncPtr action; /** The key action function */ + int modKeyIndex; /** Modifier what enable this key action */ + int priority; /** Action priority */ + int condition; /** Condition for allow use key */ }; class Setup_Keyboard; @@ -110,11 +124,6 @@ class KeyboardConfig 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(const SDL_Event &event) const; - - /** * Set the enable flag, which will stop the user from doing actions. */ void setEnabled(bool flag) @@ -162,6 +171,10 @@ class KeyboardConfig void unassignKey(); + void updateKeyActionMap(); + + bool triggerAction(const SDL_Event &event); + /** * All the key functions. * KEY_NO_VALUE is used in initialization, and should be unchanged. @@ -360,6 +373,8 @@ class KeyboardConfig Uint8 *mActiveKeys; /**< Stores a list of all the keys */ std::string mBindError; + + KeyToActionMap mKeyToAction; }; extern KeyboardConfig keyboard; |