diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-08 19:41:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-08 19:41:19 +0300 |
commit | 30ef016b0a14f36dc480284e2d775295b5501dd4 (patch) | |
tree | a269c0983efb8dc9160bfe10b1dba26a302aff0c /src/keyboardconfig.h | |
parent | 25a6eae7f4fb561bbf930be28ee09510b40ebc80 (diff) | |
download | plus-30ef016b0a14f36dc480284e2d775295b5501dd4.tar.gz plus-30ef016b0a14f36dc480284e2d775295b5501dd4.tar.bz2 plus-30ef016b0a14f36dc480284e2d775295b5501dd4.tar.xz plus-30ef016b0a14f36dc480284e2d775295b5501dd4.zip |
Move most input code from keyboardconfig to inputmanager.
Diffstat (limited to 'src/keyboardconfig.h')
-rw-r--r-- | src/keyboardconfig.h | 101 |
1 files changed, 4 insertions, 97 deletions
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index 79719518b..3f3e5f95d 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.h @@ -42,39 +42,6 @@ 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 -{ - KeyItem values[KeyFunctionSize]; -}; - -class Setup_Keyboard; - class KeyboardConfig { public: @@ -84,37 +51,6 @@ class KeyboardConfig void init(); /** - * Retrieve the key values from config file. - */ - void retrieve(); - - /** - * Store the key values to config file. - */ - void store(); - - /** - * Make the keys their default values. - */ - void makeDefault(); - - /** - * Determines if any key assignments are the same as each other. - */ - bool hasConflicts(int &key1, int &key2); - - /** - * Calls a function back so the key re-assignment(s) can be seen. - */ - void callbackNewKey(); - - /** - * Get the index of the new key to be assigned. - */ - int getNewKeyIndex() const - { return mNewKeyIndex; } - - /** * Get the enable flag, which will stop the user from doing actions. */ bool isEnabled() const @@ -132,55 +68,26 @@ class KeyboardConfig { mEnabled = flag; } /** - * Set the index of the new key to be assigned. - */ - void setNewKeyIndex(int value) - { mNewKeyIndex = value; } - - /** - * Set the value of the new key. - */ - void setNewKey(const SDL_Event &event); - - /** - * Set a reference to the key setup window. - */ - void setSetupKeyboard(Setup_Keyboard *setupKey) - { mSetupKey = setupKey; } - - /** - * Checks if the key is active, by providing the key function index. - */ - bool isActionActive(int index) const; - - /** * Takes a snapshot of all the active keys. */ void refreshActiveKeys(); - std::string getKeyValueString(int index) const; - std::string getKeyShortString(const std::string &key) const; - std::string getKeyStringLong(int index) const; - SDLKey getKeyFromEvent(const SDL_Event &event) const; int getKeyValueFromEvent(const SDL_Event &event) const; - void unassignKey(); - void updateKeyActionMap(); bool triggerAction(const SDL_Event &event); - private: - int mNewKeyIndex; /**< Index of new key to be assigned */ - bool mEnabled; /**< Flag to respond to key input */ + std::string getKeyName(int key); - Setup_Keyboard *mSetupKey; /**< Reference to setup window */ + bool isActionActive(int index) const; - KeyFunction mKey[Input::KEY_TOTAL]; /**< Pointer to all the key data */ + private: + bool mEnabled; /**< Flag to respond to key input */ Uint8 *mActiveKeys; /**< Stores a list of all the keys */ |