From 30ef016b0a14f36dc480284e2d775295b5501dd4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 8 Apr 2012 19:41:19 +0300 Subject: Move most input code from keyboardconfig to inputmanager. --- src/keyboardconfig.h | 101 ++------------------------------------------------- 1 file changed, 4 insertions(+), 97 deletions(-) (limited to 'src/keyboardconfig.h') 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 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: @@ -83,37 +50,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. */ @@ -131,56 +67,27 @@ class KeyboardConfig void setEnabled(bool flag) { 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 */ -- cgit v1.2.3-70-g09d2