From 36e5d21fe06709ba4d12a8619af07b86a676cf8c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Mar 2012 04:26:57 +0300 Subject: Redesign input handling. --- src/keyboardconfig.h | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src/keyboardconfig.h') 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 #include +#include + +#include "actionmanager.h" union SDL_Event; +typedef std::vector KeysVector; +typedef KeysVector::iterator KeysVectorIter; +typedef KeysVector::const_iterator KeysVectorCIter; + +typedef std::map 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; @@ -109,11 +123,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. */ @@ -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; -- cgit v1.2.3-60-g2f50