00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KEYBOARDCONFIG_H
00023 #define KEYBOARDCONFIG_H
00024
00025 #include <SDL_types.h>
00026 #include <string>
00027
00031 struct KeyFunction
00032 {
00033 const char* configField;
00034 int defaultValue;
00035 std::string caption;
00036 int value;
00037 };
00038
00039 class Setup_Keyboard;
00040
00041 class KeyboardConfig
00042 {
00043 public:
00047 void init();
00048
00052 void retrieve();
00053
00057 void store();
00058
00062 void makeDefault();
00063
00067 bool hasConflicts();
00068
00072 void callbackNewKey();
00073
00077 int getKeyValue(int index) const
00078 { return mKey[index].value; }
00079
00083 int getNewKeyIndex() const
00084 { return mNewKeyIndex; }
00085
00089 bool isEnabled() const
00090 { return mEnabled; }
00091
00095 const std::string &getKeyCaption(int index) const
00096 { return mKey[index].caption; }
00097
00101 int getKeyIndex(int keyValue) const;
00102
00106 int getKeyEmoteOffset(int keyValue) const;
00107
00111 void setEnabled(bool flag)
00112 { mEnabled = flag; }
00113
00117 void setNewKeyIndex(int value)
00118 { mNewKeyIndex = value; }
00119
00123 void setNewKey(int value)
00124 { mKey[mNewKeyIndex].value = value; }
00125
00129 void setSetupKeyboard(Setup_Keyboard *setupKey)
00130 { mSetupKey = setupKey; }
00131
00135 bool isKeyActive(int index);
00136
00140 void refreshActiveKeys();
00141
00149 enum KeyAction
00150 {
00151 KEY_NO_VALUE = -1,
00152 KEY_MOVE_UP,
00153 KEY_MOVE_DOWN,
00154 KEY_MOVE_LEFT,
00155 KEY_MOVE_RIGHT,
00156 KEY_ATTACK,
00157 KEY_EMOTE,
00158 KEY_TALK,
00159 KEY_TARGET,
00160 KEY_TARGET_CLOSEST,
00161 KEY_TARGET_NPC,
00162 KEY_TARGET_PLAYER,
00163 KEY_PICKUP,
00164 KEY_HIDE_WINDOWS,
00165 KEY_SIT,
00166 KEY_SCREENSHOT,
00167 KEY_TRADE,
00168 KEY_PATHFIND,
00169 KEY_SHORTCUT_1,
00170 KEY_SHORTCUT_2,
00171 KEY_SHORTCUT_3,
00172 KEY_SHORTCUT_4,
00173 KEY_SHORTCUT_5,
00174 KEY_SHORTCUT_6,
00175 KEY_SHORTCUT_7,
00176 KEY_SHORTCUT_8,
00177 KEY_SHORTCUT_9,
00178 KEY_SHORTCUT_10,
00179 KEY_SHORTCUT_11,
00180 KEY_SHORTCUT_12,
00181 KEY_WINDOW_HELP,
00182 KEY_WINDOW_STATUS,
00183 KEY_WINDOW_INVENTORY,
00184 KEY_WINDOW_EQUIPMENT,
00185 KEY_WINDOW_SKILL,
00186 KEY_WINDOW_MINIMAP,
00187 KEY_WINDOW_CHAT,
00188 KEY_WINDOW_SHORTCUT,
00189 KEY_WINDOW_SETUP,
00190 KEY_WINDOW_DEBUG,
00191 KEY_WINDOW_EMOTE,
00192 KEY_WINDOW_EMOTE_SHORTCUT,
00193 KEY_EMOTE_1,
00194 KEY_EMOTE_2,
00195 KEY_EMOTE_3,
00196 KEY_EMOTE_4,
00197 KEY_EMOTE_5,
00198 KEY_EMOTE_6,
00199 KEY_EMOTE_7,
00200 KEY_EMOTE_8,
00201 KEY_EMOTE_9,
00202 KEY_EMOTE_10,
00203 KEY_EMOTE_11,
00204 KEY_EMOTE_12,
00205 KEY_TOGGLE_CHAT,
00206 KEY_SCROLL_CHAT_UP,
00207 KEY_SCROLL_CHAT_DOWN,
00208 KEY_PREV_CHAT_TAB,
00209 KEY_NEXT_CHAT_TAB,
00210 KEY_OK,
00211 KEY_QUIT,
00212 KEY_IGNORE_INPUT_1,
00213 KEY_IGNORE_INPUT_2,
00214 KEY_TOTAL
00215 };
00216
00217 private:
00218 int mNewKeyIndex;
00219 bool mEnabled;
00221 Setup_Keyboard *mSetupKey;
00223 KeyFunction mKey[KEY_TOTAL];
00225 Uint8 *mActiveKeys;
00226 };
00227
00228 extern KeyboardConfig keyboard;
00229
00230 #endif