#include <keyboardconfig.h>
Definition at line 41 of file keyboardconfig.h.
Public Types | |
enum | KeyAction { KEY_NO_VALUE = -1, KEY_MOVE_UP, KEY_MOVE_DOWN, KEY_MOVE_LEFT, KEY_MOVE_RIGHT, KEY_ATTACK, KEY_EMOTE, KEY_TALK, KEY_TARGET, KEY_TARGET_CLOSEST, KEY_TARGET_NPC, KEY_TARGET_PLAYER, KEY_PICKUP, KEY_HIDE_WINDOWS, KEY_SIT, KEY_SCREENSHOT, KEY_TRADE, KEY_PATHFIND, KEY_SHORTCUT_1, KEY_SHORTCUT_2, KEY_SHORTCUT_3, KEY_SHORTCUT_4, KEY_SHORTCUT_5, KEY_SHORTCUT_6, KEY_SHORTCUT_7, KEY_SHORTCUT_8, KEY_SHORTCUT_9, KEY_SHORTCUT_10, KEY_SHORTCUT_11, KEY_SHORTCUT_12, KEY_WINDOW_HELP, KEY_WINDOW_STATUS, KEY_WINDOW_INVENTORY, KEY_WINDOW_EQUIPMENT, KEY_WINDOW_SKILL, KEY_WINDOW_MINIMAP, KEY_WINDOW_CHAT, KEY_WINDOW_SHORTCUT, KEY_WINDOW_SETUP, KEY_WINDOW_DEBUG, KEY_WINDOW_EMOTE, KEY_WINDOW_EMOTE_SHORTCUT, KEY_EMOTE_1, KEY_EMOTE_2, KEY_EMOTE_3, KEY_EMOTE_4, KEY_EMOTE_5, KEY_EMOTE_6, KEY_EMOTE_7, KEY_EMOTE_8, KEY_EMOTE_9, KEY_EMOTE_10, KEY_EMOTE_11, KEY_EMOTE_12, KEY_TOGGLE_CHAT, KEY_SCROLL_CHAT_UP, KEY_SCROLL_CHAT_DOWN, KEY_PREV_CHAT_TAB, KEY_NEXT_CHAT_TAB, KEY_OK, KEY_QUIT, KEY_IGNORE_INPUT_1, KEY_IGNORE_INPUT_2, KEY_TOTAL } |
All the key functions. More... | |
Public Member Functions | |
void | init () |
Initializes the keyboard config explicitly. | |
void | retrieve () |
Retrieve the key values from config file. | |
void | store () |
Store the key values to config file. | |
void | makeDefault () |
Make the keys their default values. | |
bool | hasConflicts () |
Determines if any key assignments are the same as each other. | |
void | callbackNewKey () |
Calls a function back so the key re-assignment(s) can be seen. | |
int | getKeyValue (int index) const |
Obtain the value stored in memory. | |
int | getNewKeyIndex () const |
Get the index of the new key to be assigned. | |
bool | isEnabled () const |
Get the enable flag, which will stop the user from doing actions. | |
const std::string & | getKeyCaption (int index) const |
Get the key caption, providing more meaning to the user. | |
int | getKeyIndex (int keyValue) const |
Get the key function index by providing the keys value. | |
int | getKeyEmoteOffset (int keyValue) const |
Get the key function index for an emote by providing the offset value. | |
void | setEnabled (bool flag) |
Set the enable flag, which will stop the user from doing actions. | |
void | setNewKeyIndex (int value) |
Set the index of the new key to be assigned. | |
void | setNewKey (int value) |
Set the value of the new key. | |
void | setSetupKeyboard (Setup_Keyboard *setupKey) |
Set a reference to the key setup window. | |
bool | isKeyActive (int index) |
Checks if the key is active, by providing the key function index. | |
void | refreshActiveKeys () |
Takes a snapshot of all the active keys. | |
Private Attributes | |
int | mNewKeyIndex |
Index of new key to be assigned. | |
bool | mEnabled |
Flag to respond to key input. | |
Setup_Keyboard * | mSetupKey |
Reference to setup window. | |
KeyFunction | mKey [KEY_TOTAL] |
Pointer to all the key data. | |
Uint8 * | mActiveKeys |
Stores a list of all the keys. |
All the key functions.
KEY_NO_VALUE is used in initialization, and should be unchanged. KEY_TOTAL should always be last (used as a conditional in loops). The key assignment view gets arranged according to the order of these values.
Definition at line 149 of file keyboardconfig.h.
void KeyboardConfig::init | ( | ) |
void KeyboardConfig::retrieve | ( | ) |
void KeyboardConfig::store | ( | ) |
void KeyboardConfig::makeDefault | ( | ) |
bool KeyboardConfig::hasConflicts | ( | ) |
Determines if any key assignments are the same as each other.
No need to parse the square matrix: only check one triangle that's enough to detect conflicts
Definition at line 145 of file keyboardconfig.cpp.
void KeyboardConfig::callbackNewKey | ( | ) |
Calls a function back so the key re-assignment(s) can be seen.
Definition at line 170 of file keyboardconfig.cpp.
int KeyboardConfig::getKeyValue | ( | int | index | ) | const [inline] |
int KeyboardConfig::getNewKeyIndex | ( | ) | const [inline] |
bool KeyboardConfig::isEnabled | ( | ) | const [inline] |
Get the enable flag, which will stop the user from doing actions.
Definition at line 89 of file keyboardconfig.h.
const std::string& KeyboardConfig::getKeyCaption | ( | int | index | ) | const [inline] |
Get the key caption, providing more meaning to the user.
Definition at line 95 of file keyboardconfig.h.
int KeyboardConfig::getKeyIndex | ( | int | keyValue | ) | const |
Get the key function index by providing the keys value.
Definition at line 175 of file keyboardconfig.cpp.
int KeyboardConfig::getKeyEmoteOffset | ( | int | keyValue | ) | const |
Get the key function index for an emote by providing the offset value.
Definition at line 188 of file keyboardconfig.cpp.
void KeyboardConfig::setEnabled | ( | bool | flag | ) | [inline] |
Set the enable flag, which will stop the user from doing actions.
Definition at line 111 of file keyboardconfig.h.
void KeyboardConfig::setNewKeyIndex | ( | int | value | ) | [inline] |
void KeyboardConfig::setNewKey | ( | int | value | ) | [inline] |
void KeyboardConfig::setSetupKeyboard | ( | Setup_Keyboard * | setupKey | ) | [inline] |
bool KeyboardConfig::isKeyActive | ( | int | index | ) |
Checks if the key is active, by providing the key function index.
Definition at line 200 of file keyboardconfig.cpp.
void KeyboardConfig::refreshActiveKeys | ( | ) |
int KeyboardConfig::mNewKeyIndex [private] |
bool KeyboardConfig::mEnabled [private] |
Setup_Keyboard* KeyboardConfig::mSetupKey [private] |
KeyFunction KeyboardConfig::mKey[KEY_TOTAL] [private] |
Uint8* KeyboardConfig::mActiveKeys [private] |