diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-08 02:53:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-08 03:27:51 +0300 |
commit | ad0fcc99678c13c6f6ebacead6ba2d573294163d (patch) | |
tree | d6550eb1ab13382544d7eb674b596a16c003302e /src/keyboardconfig.h | |
parent | 4f73caba4497344c50ea245673493941d277699f (diff) | |
download | manaplus-ad0fcc99678c13c6f6ebacead6ba2d573294163d.tar.gz manaplus-ad0fcc99678c13c6f6ebacead6ba2d573294163d.tar.bz2 manaplus-ad0fcc99678c13c6f6ebacead6ba2d573294163d.tar.xz manaplus-ad0fcc99678c13c6f6ebacead6ba2d573294163d.zip |
Allow assign 3 keys to any action.
Diffstat (limited to 'src/keyboardconfig.h')
-rw-r--r-- | src/keyboardconfig.h | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index 3299dcf51..5ebbe075e 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.h @@ -41,19 +41,35 @@ typedef KeysVector::const_iterator KeysVectorCIter; typedef std::map<int, KeysVector> KeyToActionMap; typedef KeyToActionMap::iterator KeyToActionMapIter; +enum KeyTypes +{ + INPUT_UNKNOWN = 0, + INPUT_KEYBOARD = 1, + INPUT_MOUSE = 2, + INPUT_JOYSTICK = 3 +}; + +struct KeyItem +{ + KeyItem() : type(-1), value(-1) + { } + + KeyItem(int type0, int value0) : type(type0), value(value0) + { } + + int type; + + int value; +}; + +#define KeyFunctionSize 3 + /** * Each key represents a key function. Such as 'Move up', 'Attack' etc. */ struct KeyFunction { - const char* configField; /** Field index that is in the config file. */ - int defaultValue; /** The default key value used. */ - 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 */ + KeyItem values[KeyFunctionSize]; }; class Setup_Keyboard; @@ -94,11 +110,7 @@ class KeyboardConfig /** * Obtain the value stored in memory. */ - int getKeyValue(int index) const - { return mKey[index].value; } - - bool isSeparator(int index) const - { return !*mKey[index].configField; } + int getKeyValue(int index) const; /** * Get the index of the new key to be assigned. |