summaryrefslogtreecommitdiff
path: root/src/keyboardconfig.cpp
diff options
context:
space:
mode:
authorJoshua Langley <joshlangley[at]optusnet.com.au>2007-08-19 08:34:48 +0000
committerJoshua Langley <joshlangley[at]optusnet.com.au>2007-08-19 08:34:48 +0000
commitfd168c24b9bc45c4bc6c092d072fef835063918e (patch)
tree0ebae915bb6c0ca92b5628c783d371b5bfcf0140 /src/keyboardconfig.cpp
parentfccffaf115ebd6b3f08cb9e5636a5da5cffe35e0 (diff)
downloadmana-fd168c24b9bc45c4bc6c092d072fef835063918e.tar.gz
mana-fd168c24b9bc45c4bc6c092d072fef835063918e.tar.bz2
mana-fd168c24b9bc45c4bc6c092d072fef835063918e.tar.xz
mana-fd168c24b9bc45c4bc6c092d072fef835063918e.zip
v0.0.23 - src/keyboardconfig.cpp, src/keyboardconfig.h - minor cleanup.
Diffstat (limited to 'src/keyboardconfig.cpp')
-rw-r--r--src/keyboardconfig.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index 73912000..047f576a 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -29,25 +29,33 @@
#include "gui/setup_keyboard.h"
-void KeyboardConfig::init()
+struct KeyData
{
- mKey[KEY_MOVE_UP] = KeyFunction("keyMoveUp", SDLK_UP, "Move Up");
- mKey[KEY_MOVE_DOWN] = KeyFunction("keyMoveDown", SDLK_DOWN, "Move Down");
- mKey[KEY_MOVE_LEFT] = KeyFunction("keyMoveLeft", SDLK_LEFT, "Move Left");
- mKey[KEY_MOVE_RIGHT] =
- KeyFunction("keyMoveRight", SDLK_RIGHT, "Move Right");
+ const char *configField;
+ int defaultValue;
+ const char *caption;
+};
- mKey[KEY_ATTACK] = KeyFunction("keyAttack", SDLK_LCTRL, "Attack");
- mKey[KEY_TARGET] = KeyFunction("keyTarget", SDLK_LSHIFT, "Target");
- mKey[KEY_TARGET_CLOSEST] =
- KeyFunction("keyTargetClosest", SDLK_a, "Target Closest");
- mKey[KEY_PICKUP] = KeyFunction("keyPickup", SDLK_z, "Pickup");
- mKey[KEY_HIDE_WINDOWS] =
- KeyFunction("keyHideWindows", SDLK_h, "Hide Windows");
- mKey[KEY_SIT] = KeyFunction("keyBeingSit", SDLK_g, "Sit");
+static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = {
+ {"keyMoveUp", SDLK_UP, "Move Up"},
+ {"keyMoveDown", SDLK_DOWN, "Move Down"},
+ {"keyMoveLeft", SDLK_LEFT, "Move Left"},
+ {"keyMoveRight", SDLK_RIGHT, "Move Right"},
+ {"keyAttack", SDLK_LCTRL, "Attack"},
+ {"keyTarget", SDLK_LSHIFT, "Target"},
+ {"keyTargetClosest", SDLK_a, "Target Closest"},
+ {"keyPickup", SDLK_z, "Pickup"},
+ {"keyHideWindows", SDLK_h, "Hide Windows"},
+ {"keyBeingSit", SDLK_g, "Sit"}
+};
+void KeyboardConfig::init()
+{
for (int i = 0; i < KEY_TOTAL; i++)
{
+ mKey[i].configField = keyData[i].configField;
+ mKey[i].defaultValue = keyData[i].defaultValue;
+ mKey[i].caption = keyData[i].caption;
mKey[i].value = KEY_NO_VALUE;
}
mNewKeyIndex = KEY_NO_VALUE;