Some keyboard input changes from teeworlds master

This commit is contained in:
def 2016-04-29 21:51:54 +02:00
parent 354696afb7
commit e8965bee68
6 changed files with 505 additions and 499 deletions

View file

@ -120,9 +120,14 @@ void CInput::ClearKeyStates()
mem_zero(m_aInputCount, sizeof(m_aInputCount)); mem_zero(m_aInputCount, sizeof(m_aInputCount));
} }
int CInput::KeyState(int Key) int CInput::KeyState(int Key) const
{ {
return m_aInputState[m_InputCurrent][Key]; return m_aInputState[m_InputCurrent][Key>=KEY_MOUSE_1 ? Key : SDL_GetScancodeFromKey(KeyToKeycode(Key))];
}
int CInput::KeyStateOld(int Key) const
{
return m_aInputState[m_InputCurrent^1][Key>=KEY_MOUSE_1 ? Key : SDL_GetScancodeFromKey(KeyToKeycode(Key))];
} }
int CInput::Update() int CInput::Update()
@ -162,6 +167,7 @@ int CInput::Update()
while(SDL_PollEvent(&Event)) while(SDL_PollEvent(&Event))
{ {
int Key = -1; int Key = -1;
int Scancode = 0;
int Action = IInput::FLAG_PRESS; int Action = IInput::FLAG_PRESS;
switch (Event.type) switch (Event.type)
{ {
@ -181,15 +187,13 @@ int CInput::Update()
} }
// handle keys // handle keys
case SDL_KEYDOWN: case SDL_KEYDOWN:
if(Event.key.keysym.sym == KEY_UNKNOWN) Key = KeycodeToKey(Event.key.keysym.sym);
continue; Scancode = Event.key.keysym.scancode;
Key = Event.key.keysym.scancode;
break; break;
case SDL_KEYUP: case SDL_KEYUP:
if(Event.key.keysym.sym == KEY_UNKNOWN)
continue;
Action = IInput::FLAG_RELEASE; Action = IInput::FLAG_RELEASE;
Key = Event.key.keysym.scancode; Key = KeycodeToKey(Event.key.keysym.sym);
Scancode = Event.key.keysym.scancode;
break; break;
// handle mouse buttons // handle mouse buttons
@ -213,6 +217,7 @@ int CInput::Update()
if(Event.button.button == 7) Key = KEY_MOUSE_7; // ignore_convention if(Event.button.button == 7) Key = KEY_MOUSE_7; // ignore_convention
if(Event.button.button == 8) Key = KEY_MOUSE_8; // ignore_convention if(Event.button.button == 8) Key = KEY_MOUSE_8; // ignore_convention
if(Event.button.button == 9) Key = KEY_MOUSE_9; // ignore_convention if(Event.button.button == 9) Key = KEY_MOUSE_9; // ignore_convention
Scancode = Key;
break; break;
case SDL_MOUSEWHEEL: case SDL_MOUSEWHEEL:
@ -233,12 +238,11 @@ int CInput::Update()
#endif #endif
} }
//
if(Key >= 0 && Key < 1024) if(Key >= 0 && Key < 1024)
{ {
m_aInputCount[m_InputCurrent][Key].m_Presses++; m_aInputCount[m_InputCurrent][Key].m_Presses++;
if(Action == IInput::FLAG_PRESS) if(Action == IInput::FLAG_PRESS)
m_aInputState[m_InputCurrent][Key] = 1; m_aInputState[m_InputCurrent][Scancode] = 1;
AddEvent(0, Key, Action); AddEvent(0, Key, Action);
} }

View file

@ -24,6 +24,15 @@ public:
virtual void Init(); virtual void Init();
int KeyState(int Key) const;
int KeyStateOld(int Key) const;
int KeyWasPressed(int Key) const { return KeyStateOld(Key); }
int KeyPressed(int Key) const { return KeyState(Key); }
int KeyReleases(int Key) const { return m_aInputCount[m_InputCurrent][Key].m_Releases; }
int KeyPresses(int Key) const { return m_aInputCount[m_InputCurrent][Key].m_Presses; }
int KeyDown(int Key) const { return KeyPressed(Key)&&!KeyWasPressed(Key); }
virtual void MouseRelative(float *x, float *y); virtual void MouseRelative(float *x, float *y);
virtual void MouseModeAbsolute(); virtual void MouseModeAbsolute();
virtual void MouseModeRelative(); virtual void MouseModeRelative();
@ -32,7 +41,6 @@ public:
virtual void SetClipboardText(const char *Text); virtual void SetClipboardText(const char *Text);
void ClearKeyStates(); void ClearKeyStates();
int KeyState(int Key);
int ButtonPressed(int Button) { return m_aInputState[m_InputCurrent][Button]; } int ButtonPressed(int Button) { return m_aInputState[m_InputCurrent][Button]; }

View file

@ -4,14 +4,105 @@
#error do not include this header! #error do not include this header!
#endif #endif
#include <string.h>
const char g_aaKeyStrings[512][20] = const char g_aaKeyStrings[512][20] =
{ {
"unknown", "unknown",
"&1", "&1",
"&2", "&2",
"&3", "&3",
"&4",
"&5",
"&6",
"&7",
"backspace",
"tab",
"&10",
"&11",
"&12",
"return",
"&14",
"&15",
"&16",
"&17",
"&18",
"&19",
"&20",
"&21",
"&22",
"&23",
"&24",
"&25",
"&26",
"escape",
"&28",
"&29",
"&30",
"&31",
"space",
"exclaim",
"quotedbl",
"hash",
"dollar",
"percent",
"ampersand",
"quote",
"leftparen",
"rightparen",
"asterix",
"plus",
"comma",
"minus",
"period",
"slash",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"colon",
"semicolon",
"less",
"equals",
"greater",
"question",
"at",
"&65",
"&66",
"&67",
"&68",
"&69",
"&70",
"&71",
"&72",
"&73",
"&74",
"&75",
"&76",
"&77",
"&78",
"&79",
"&80",
"&81",
"&82",
"&83",
"&84",
"&85",
"&86",
"&87",
"&88",
"&89",
"&90",
"leftbracket",
"backslash",
"rightbracket",
"caret",
"underscore",
"backquote",
"a", "a",
"b", "b",
"c", "c",
@ -38,33 +129,68 @@ const char g_aaKeyStrings[512][20] =
"x", "x",
"y", "y",
"z", "z",
"1", "&123",
"2", "&124",
"3", "&125",
"4", "&126",
"5", "delete",
"6", "&128",
"7", "&129",
"8", "&130",
"9", "&131",
"0", "&132",
"return", "&133",
"escape", "&134",
"backspace", "&135",
"tab", "&136",
"space", "&137",
"minus", "&138",
"equals", "&139",
"leftbracket", "&140",
"rightbracket", "&141",
"backslash", "&142",
"nonushash", "&143",
"semicolon", "&144",
"apostrophe", "&145",
"grave", "&146",
"comma", "&147",
"period", "&148",
"slash", "&149",
"&150",
"&151",
"&152",
"&153",
"&154",
"&155",
"&156",
"&157",
"&158",
"&159",
"&160",
"&161",
"&162",
"&163",
"&164",
"&165",
"&166",
"&167",
"&168",
"&169",
"&170",
"&171",
"&172",
"&173",
"&174",
"&175",
"&176",
"&177",
"&178",
"&179",
"&180",
"&181",
"&182",
"&183",
"&184",
"capslock", "capslock",
"f1", "f1",
"f2", "f2",
@ -84,7 +210,7 @@ const char g_aaKeyStrings[512][20] =
"insert", "insert",
"home", "home",
"pageup", "pageup",
"delete", "&204",
"end", "end",
"pagedown", "pagedown",
"right", "right",
@ -108,7 +234,7 @@ const char g_aaKeyStrings[512][20] =
"kp_9", "kp_9",
"kp_0", "kp_0",
"kp_period", "kp_period",
"nonusbackslash", "&228",
"application", "application",
"power", "power",
"kp_equals", "kp_equals",
@ -138,29 +264,29 @@ const char g_aaKeyStrings[512][20] =
"mute", "mute",
"volumeup", "volumeup",
"volumedown", "volumedown",
"&130", "&258",
"&131", "&259",
"&132", "&260",
"kp_comma", "kp_comma",
"kp_equalsas400", "kp_equalsas400",
"international1", "&263",
"international2", "&264",
"international3", "&265",
"international4", "&266",
"international5", "&267",
"international6", "&268",
"international7", "&269",
"international8", "&270",
"international9", "&271",
"lang1", "&272",
"lang2", "&273",
"lang3", "&274",
"lang4", "&275",
"lang5", "&276",
"lang6", "&277",
"lang7", "&278",
"lang8", "&279",
"lang9", "&280",
"alterase", "alterase",
"sysreq", "sysreq",
"cancel", "cancel",
@ -173,17 +299,17 @@ const char g_aaKeyStrings[512][20] =
"clearagain", "clearagain",
"crsel", "crsel",
"exsel", "exsel",
"&165", "&293",
"&166", "&294",
"&167", "&295",
"&168", "&296",
"&169", "&297",
"&170", "&298",
"&171", "&299",
"&172", "&300",
"&173", "&301",
"&174", "&302",
"&175", "&303",
"kp_00", "kp_00",
"kp_000", "kp_000",
"thousandsseparator", "thousandsseparator",
@ -230,8 +356,8 @@ const char g_aaKeyStrings[512][20] =
"kp_octal", "kp_octal",
"kp_decimal", "kp_decimal",
"kp_hexadecimal", "kp_hexadecimal",
"&222", "&350",
"&223", "&351",
"lctrl", "lctrl",
"lshift", "lshift",
"lalt", "lalt",
@ -240,134 +366,6 @@ const char g_aaKeyStrings[512][20] =
"rshift", "rshift",
"ralt", "ralt",
"rgui", "rgui",
"&232",
"&233",
"&234",
"&235",
"&236",
"&237",
"&238",
"&239",
"&240",
"&241",
"&242",
"&243",
"&244",
"&245",
"&246",
"&247",
"&248",
"&249",
"&250",
"&251",
"&252",
"&253",
"&254",
"&255",
"&256",
"mode",
"audionext",
"audioprev",
"audiostop",
"audioplay",
"audiomute",
"mediaselect",
"www",
"mail",
"calculator",
"computer",
"ac_search",
"ac_home",
"ac_back",
"ac_forward",
"ac_stop",
"ac_refresh",
"ac_bookmarks",
"brightnessdown",
"brightnessup",
"displayswitch",
"kbdillumtoggle",
"kbdillumdown",
"kbdillumup",
"eject",
"sleep",
"app1",
"app2",
"mouse1",
"mouse2",
"mouse3",
"mouse4",
"mouse5",
"mouse6",
"mouse7",
"mouse8",
"mousewheelup",
"mousewheeldown",
"mouse9",
"&296",
"&297",
"&298",
"&299",
"&300",
"&301",
"&302",
"&303",
"&304",
"&305",
"&306",
"&307",
"&308",
"&309",
"&310",
"&311",
"&312",
"&313",
"&314",
"&315",
"&316",
"&317",
"&318",
"&319",
"&320",
"&321",
"&322",
"&323",
"&324",
"&325",
"&326",
"&327",
"&328",
"&329",
"&330",
"&331",
"&332",
"&333",
"&334",
"&335",
"&336",
"&337",
"&338",
"&339",
"&340",
"&341",
"&342",
"&343",
"&344",
"&345",
"&346",
"&347",
"&348",
"&349",
"&350",
"&351",
"&352",
"&353",
"&354",
"&355",
"&356",
"&357",
"&358",
"&359",
"&360", "&360",
"&361", "&361",
"&362", "&362",
@ -393,43 +391,43 @@ const char g_aaKeyStrings[512][20] =
"&382", "&382",
"&383", "&383",
"&384", "&384",
"&385", "mode",
"&386", "audionext",
"&387", "audioprev",
"&388", "audiostop",
"&389", "audioplay",
"&390", "audiomute",
"&391", "mediaselect",
"&392", "www",
"&393", "mail",
"&394", "calculator",
"&395", "computer",
"&396", "ac_search",
"&397", "ac_home",
"&398", "ac_back",
"&399", "ac_forward",
"&400", "ac_stop",
"&401", "ac_refresh",
"&402", "ac_bookmarks",
"&403", "brightnessdown",
"&404", "brightnessup",
"&405", "displayswitch",
"&406", "kbdillumtoggle",
"&407", "kbdillumdown",
"&408", "kpdillumup",
"&409", "eject",
"&410", "sleep",
"&411", "mouse1",
"&412", "mouse2",
"&413", "mouse3",
"&414", "mouse4",
"&415", "mouse5",
"&416", "mouse6",
"&417", "mouse7",
"&418", "mouse8",
"&419", "mouse9",
"&420", "mousewheelup",
"&421", "mousewheeldown",
"&422", "&422",
"&423", "&423",
"&424", "&424",

View file

@ -40,8 +40,6 @@ protected:
int m_InputCurrent; int m_InputCurrent;
bool m_InputDispatched; bool m_InputDispatched;
int KeyWasPressed(int Key) { return m_aInputState[m_InputCurrent^1][Key]; }
public: public:
enum enum
{ {
@ -68,10 +66,10 @@ public:
} }
// keys // keys
int KeyPressed(int Key) { return m_aInputState[m_InputCurrent][Key]; } virtual int KeyPressed(int Key) const = 0;
int KeyReleases(int Key) { return m_aInputCount[m_InputCurrent][Key].m_Releases; } virtual int KeyReleases(int Key) const = 0;
int KeyPresses(int Key) { return m_aInputCount[m_InputCurrent][Key].m_Presses; } virtual int KeyPresses(int Key) const = 0;
int KeyDown(int Key) { return KeyPressed(Key)&&!KeyWasPressed(Key); } virtual int KeyDown(int Key) const = 0;
const char *KeyName(int Key) { return (Key >= 0 && Key < 512) ? g_aaKeyStrings[Key] : g_aaKeyStrings[0]; } const char *KeyName(int Key) { return (Key >= 0 && Key < 512) ? g_aaKeyStrings[Key] : g_aaKeyStrings[0]; }
// //

View file

@ -8,258 +8,256 @@ enum
{ {
KEY_FIRST = 0, KEY_FIRST = 0,
KEY_UNKNOWN = 0, KEY_UNKNOWN = 0,
KEY_A = 4, KEY_BACKSPACE = 8,
KEY_B = 5, KEY_TAB = 9,
KEY_C = 6, KEY_RETURN = 13,
KEY_D = 7, KEY_ESCAPE = 27,
KEY_E = 8, KEY_SPACE = 32,
KEY_F = 9, KEY_EXCLAIM = 33,
KEY_G = 10, KEY_QUOTEDBL = 34,
KEY_H = 11, KEY_HASH = 35,
KEY_I = 12, KEY_DOLLAR = 36,
KEY_J = 13, KEY_PERCENT = 37,
KEY_K = 14, KEY_AMPERSAND = 38,
KEY_L = 15, KEY_QUOTE = 39,
KEY_M = 16, KEY_LEFTPAREN = 40,
KEY_N = 17, KEY_RIGHTPAREN = 41,
KEY_O = 18, KEY_ASTERISK = 42,
KEY_P = 19, KEY_PLUS = 43,
KEY_Q = 20, KEY_COMMA = 44,
KEY_R = 21,
KEY_S = 22,
KEY_T = 23,
KEY_U = 24,
KEY_V = 25,
KEY_W = 26,
KEY_X = 27,
KEY_Y = 28,
KEY_Z = 29,
KEY_1 = 30,
KEY_2 = 31,
KEY_3 = 32,
KEY_4 = 33,
KEY_5 = 34,
KEY_6 = 35,
KEY_7 = 36,
KEY_8 = 37,
KEY_9 = 38,
KEY_0 = 39,
KEY_RETURN = 40,
KEY_ESCAPE = 41,
KEY_BACKSPACE = 42,
KEY_TAB = 43,
KEY_SPACE = 44,
KEY_MINUS = 45, KEY_MINUS = 45,
KEY_EQUALS = 46, KEY_PERIOD = 46,
KEY_LEFTBRACKET = 47, KEY_SLASH = 47,
KEY_RIGHTBRACKET = 48, KEY_0 = 48,
KEY_BACKSLASH = 49, KEY_1 = 49,
KEY_NONUSHASH = 50, KEY_2 = 50,
KEY_SEMICOLON = 51, KEY_3 = 51,
KEY_APOSTROPHE = 52, KEY_4 = 52,
KEY_GRAVE = 53, KEY_5 = 53,
KEY_COMMA = 54, KEY_6 = 54,
KEY_PERIOD = 55, KEY_7 = 55,
KEY_SLASH = 56, KEY_8 = 56,
KEY_CAPSLOCK = 57, KEY_9 = 57,
KEY_F1 = 58, KEY_COLON = 58,
KEY_F2 = 59, KEY_SEMICOLON = 59,
KEY_F3 = 60, KEY_LESS = 60,
KEY_F4 = 61, KEY_EQUALS = 61,
KEY_F5 = 62, KEY_GREATER = 62,
KEY_F6 = 63, KEY_QUESTION = 63,
KEY_F7 = 64, KEY_AT = 64,
KEY_F8 = 65, KEY_LEFTBRACKET = 91,
KEY_F9 = 66, KEY_BACKSLASH = 92,
KEY_F10 = 67, KEY_RIGHTBRACKET = 93,
KEY_F11 = 68, KEY_CARET = 94,
KEY_F12 = 69, KEY_UNDERSCORE = 95,
KEY_PRINTSCREEN = 70, KEY_BACKQUOTE = 96,
KEY_SCROLLLOCK = 71, KEY_A = 97,
KEY_PAUSE = 72, KEY_B = 98,
KEY_INSERT = 73, KEY_C = 99,
KEY_HOME = 74, KEY_D = 100,
KEY_PAGEUP = 75, KEY_E = 101,
KEY_DELETE = 76, KEY_F = 102,
KEY_END = 77, KEY_G = 103,
KEY_PAGEDOWN = 78, KEY_H = 104,
KEY_RIGHT = 79, KEY_I = 105,
KEY_LEFT = 80, KEY_J = 106,
KEY_DOWN = 81, KEY_K = 107,
KEY_UP = 82, KEY_L = 108,
KEY_NUMLOCKCLEAR = 83, KEY_M = 109,
KEY_KP_DIVIDE = 84, KEY_N = 110,
KEY_KP_MULTIPLY = 85, KEY_O = 111,
KEY_KP_MINUS = 86, KEY_P = 112,
KEY_KP_PLUS = 87, KEY_Q = 113,
KEY_KP_ENTER = 88, KEY_R = 114,
KEY_KP_1 = 89, KEY_S = 115,
KEY_KP_2 = 90, KEY_T = 116,
KEY_KP_3 = 91, KEY_U = 117,
KEY_KP_4 = 92, KEY_V = 118,
KEY_KP_5 = 93, KEY_W = 119,
KEY_KP_6 = 94, KEY_X = 120,
KEY_KP_7 = 95, KEY_Y = 121,
KEY_KP_8 = 96, KEY_Z = 122,
KEY_KP_9 = 97, KEY_DELETE = 127,
KEY_KP_0 = 98, KEY_CAPSLOCK = 185,
KEY_KP_PERIOD = 99, KEY_F1 = 186,
KEY_NONUSBACKSLASH = 100, KEY_F2 = 187,
KEY_APPLICATION = 101, KEY_F3 = 188,
KEY_POWER = 102, KEY_F4 = 189,
KEY_KP_EQUALS = 103, KEY_F5 = 190,
KEY_F13 = 104, KEY_F6 = 191,
KEY_F14 = 105, KEY_F7 = 192,
KEY_F15 = 106, KEY_F8 = 193,
KEY_F16 = 107, KEY_F9 = 194,
KEY_F17 = 108, KEY_F10 = 195,
KEY_F18 = 109, KEY_F11 = 196,
KEY_F19 = 110, KEY_F12 = 197,
KEY_F20 = 111, KEY_PRINTSCREEN = 198,
KEY_F21 = 112, KEY_SCROLLLOCK = 199,
KEY_F22 = 113, KEY_PAUSE = 200,
KEY_F23 = 114, KEY_INSERT = 201,
KEY_F24 = 115, KEY_HOME = 202,
KEY_EXECUTE = 116, KEY_PAGEUP = 203,
KEY_HELP = 117, KEY_END = 205,
KEY_MENU = 118, KEY_PAGEDOWN = 206,
KEY_SELECT = 119, KEY_RIGHT = 207,
KEY_STOP = 120, KEY_LEFT = 208,
KEY_AGAIN = 121, KEY_DOWN = 209,
KEY_UNDO = 122, KEY_UP = 210,
KEY_CUT = 123, KEY_NUMLOCKCLEAR = 211,
KEY_COPY = 124, KEY_KP_DIVIDE = 212,
KEY_PASTE = 125, KEY_KP_MULTIPLY = 213,
KEY_FIND = 126, KEY_KP_MINUS = 214,
KEY_MUTE = 127, KEY_KP_PLUS = 215,
KEY_VOLUMEUP = 128, KEY_KP_ENTER = 216,
KEY_VOLUMEDOWN = 129, KEY_KP_1 = 217,
KEY_KP_COMMA = 133, KEY_KP_2 = 218,
KEY_KP_EQUALSAS400 = 134, KEY_KP_3 = 219,
KEY_INTERNATIONAL1 = 135, KEY_KP_4 = 220,
KEY_INTERNATIONAL2 = 136, KEY_KP_5 = 221,
KEY_INTERNATIONAL3 = 137, KEY_KP_6 = 222,
KEY_INTERNATIONAL4 = 138, KEY_KP_7 = 223,
KEY_INTERNATIONAL5 = 139, KEY_KP_8 = 224,
KEY_INTERNATIONAL6 = 140, KEY_KP_9 = 225,
KEY_INTERNATIONAL7 = 141, KEY_KP_0 = 226,
KEY_INTERNATIONAL8 = 142, KEY_KP_PERIOD = 227,
KEY_INTERNATIONAL9 = 143, KEY_APPLICATION = 229,
KEY_LANG1 = 144, KEY_POWER = 230,
KEY_LANG2 = 145, KEY_KP_EQUALS = 231,
KEY_LANG3 = 146, KEY_F13 = 232,
KEY_LANG4 = 147, KEY_F14 = 233,
KEY_LANG5 = 148, KEY_F15 = 234,
KEY_LANG6 = 149, KEY_F16 = 235,
KEY_LANG7 = 150, KEY_F17 = 236,
KEY_LANG8 = 151, KEY_F18 = 237,
KEY_LANG9 = 152, KEY_F19 = 238,
KEY_ALTERASE = 153, KEY_F20 = 239,
KEY_SYSREQ = 154, KEY_F21 = 240,
KEY_CANCEL = 155, KEY_F22 = 241,
KEY_CLEAR = 156, KEY_F23 = 242,
KEY_PRIOR = 157, KEY_F24 = 243,
KEY_RETURN2 = 158, KEY_EXECUTE = 244,
KEY_SEPARATOR = 159, KEY_HELP = 245,
KEY_OUT = 160, KEY_MENU = 246,
KEY_OPER = 161, KEY_SELECT = 247,
KEY_CLEARAGAIN = 162, KEY_STOP = 248,
KEY_CRSEL = 163, KEY_AGAIN = 249,
KEY_EXSEL = 164, KEY_UNDO = 250,
KEY_KP_00 = 176, KEY_CUT = 251,
KEY_KP_000 = 177, KEY_COPY = 252,
KEY_THOUSANDSSEPARATOR = 178, KEY_PASTE = 253,
KEY_DECIMALSEPARATOR = 179, KEY_FIND = 254,
KEY_CURRENCYUNIT = 180, KEY_MUTE = 255,
KEY_CURRENCYSUBUNIT = 181, KEY_VOLUMEUP = 256,
KEY_KP_LEFTPAREN = 182, KEY_VOLUMEDOWN = 257,
KEY_KP_RIGHTPAREN = 183, KEY_KP_COMMA = 261,
KEY_KP_LEFTBRACE = 184, KEY_KP_EQUALSAS400 = 262,
KEY_KP_RIGHTBRACE = 185, KEY_ALTERASE = 281,
KEY_KP_TAB = 186, KEY_SYSREQ = 282,
KEY_KP_BACKSPACE = 187, KEY_CANCEL = 283,
KEY_KP_A = 188, KEY_CLEAR = 284,
KEY_KP_B = 189, KEY_PRIOR = 285,
KEY_KP_C = 190, KEY_RETURN2 = 286,
KEY_KP_D = 191, KEY_SEPARATOR = 287,
KEY_KP_E = 192, KEY_OUT = 288,
KEY_KP_F = 193, KEY_OPER = 289,
KEY_KP_XOR = 194, KEY_CLEARAGAIN = 290,
KEY_KP_POWER = 195, KEY_CRSEL = 291,
KEY_KP_PERCENT = 196, KEY_EXSEL = 292,
KEY_KP_LESS = 197, KEY_KP_00 = 304,
KEY_KP_GREATER = 198, KEY_KP_000 = 305,
KEY_KP_AMPERSAND = 199, KEY_THOUSANDSSEPARATOR = 306,
KEY_KP_DBLAMPERSAND = 200, KEY_DECIMALSEPARATOR = 307,
KEY_KP_VERTICALBAR = 201, KEY_CURRENCYUNIT = 308,
KEY_KP_DBLVERTICALBAR = 202, KEY_CURRENCYSUBUNIT = 309,
KEY_KP_COLON = 203, KEY_KP_LEFTPAREN = 310,
KEY_KP_HASH = 204, KEY_KP_RIGHTPAREN = 311,
KEY_KP_SPACE = 205, KEY_KP_LEFTBRACE = 312,
KEY_KP_AT = 206, KEY_KP_RIGHTBRACE = 313,
KEY_KP_EXCLAM = 207, KEY_KP_TAB = 314,
KEY_KP_MEMSTORE = 208, KEY_KP_BACKSPACE = 315,
KEY_KP_MEMRECALL = 209, KEY_KP_A = 316,
KEY_KP_MEMCLEAR = 210, KEY_KP_B = 317,
KEY_KP_MEMADD = 211, KEY_KP_C = 318,
KEY_KP_MEMSUBTRACT = 212, KEY_KP_D = 319,
KEY_KP_MEMMULTIPLY = 213, KEY_KP_E = 320,
KEY_KP_MEMDIVIDE = 214, KEY_KP_F = 321,
KEY_KP_PLUSMINUS = 215, KEY_KP_XOR = 322,
KEY_KP_CLEAR = 216, KEY_KP_POWER = 323,
KEY_KP_CLEARENTRY = 217, KEY_KP_PERCENT = 324,
KEY_KP_BINARY = 218, KEY_KP_LESS = 325,
KEY_KP_OCTAL = 219, KEY_KP_GREATER = 326,
KEY_KP_DECIMAL = 220, KEY_KP_AMPERSAND = 327,
KEY_KP_HEXADECIMAL = 221, KEY_KP_DBLAMPERSAND = 328,
KEY_LCTRL = 224, KEY_KP_VERTICALBAR = 329,
KEY_LSHIFT = 225, KEY_KP_DBLVERTICALBAR = 330,
KEY_LALT = 226, KEY_KP_COLON = 331,
KEY_LGUI = 227, KEY_KP_HASH = 332,
KEY_RCTRL = 228, KEY_KP_SPACE = 333,
KEY_RSHIFT = 229, KEY_KP_AT = 334,
KEY_RALT = 230, KEY_KP_EXCLAM = 335,
KEY_RGUI = 231, KEY_KP_MEMSTORE = 336,
KEY_MODE = 257, KEY_KP_MEMRECALL = 337,
KEY_AUDIONEXT = 258, KEY_KP_MEMCLEAR = 338,
KEY_AUDIOPREV = 259, KEY_KP_MEMADD = 339,
KEY_AUDIOSTOP = 260, KEY_KP_MEMSUBTRACT = 340,
KEY_AUDIOPLAY = 261, KEY_KP_MEMMULTIPLY = 341,
KEY_AUDIOMUTE = 262, KEY_KP_MEMDIVIDE = 342,
KEY_MEDIASELECT = 263, KEY_KP_PLUSMINUS = 343,
KEY_WWW = 264, KEY_KP_CLEAR = 344,
KEY_MAIL = 265, KEY_KP_CLEARENTRY = 345,
KEY_CALCULATOR = 266, KEY_KP_BINARY = 346,
KEY_COMPUTER = 267, KEY_KP_OCTAL = 347,
KEY_AC_SEARCH = 268, KEY_KP_DECIMAL = 348,
KEY_AC_HOME = 269, KEY_KP_HEXADECIMAL = 349,
KEY_AC_BACK = 270, KEY_LCTRL = 352,
KEY_AC_FORWARD = 271, KEY_LSHIFT = 353,
KEY_AC_STOP = 272, KEY_LALT = 354,
KEY_AC_REFRESH = 273, KEY_LGUI = 355,
KEY_AC_BOOKMARKS = 274, KEY_RCTRL = 356,
KEY_BRIGHTNESSDOWN = 275, KEY_RSHIFT = 357,
KEY_BRIGHTNESSUP = 276, KEY_RALT = 358,
KEY_DISPLAYSWITCH = 277, KEY_RGUI = 359,
KEY_KBDILLUMTOGGLE = 278, KEY_MODE = 385,
KEY_KBDILLUMDOWN = 279, KEY_AUDIONEXT = 386,
KEY_KBDILLUMUP = 280, KEY_AUDIOPREV = 387,
KEY_EJECT = 281, KEY_AUDIOSTOP = 388,
KEY_SLEEP = 282, KEY_AUDIOPLAY = 389,
KEY_APP1 = 283, KEY_AUDIOMUTE = 390,
KEY_APP2 = 284, KEY_MEDIASELECT = 391,
KEY_MOUSE_1 = 285, KEY_WWW = 392,
KEY_MOUSE_2 = 286, KEY_MAIL = 393,
KEY_MOUSE_3 = 287, KEY_CALCULATOR = 394,
KEY_MOUSE_4 = 288, KEY_COMPUTER = 395,
KEY_MOUSE_5 = 289, KEY_AC_SEARCH = 396,
KEY_MOUSE_6 = 290, KEY_AC_HOME = 397,
KEY_MOUSE_7 = 291, KEY_AC_BACK = 398,
KEY_MOUSE_8 = 292, KEY_AC_FORWARD = 399,
KEY_MOUSE_WHEEL_UP = 293, KEY_AC_STOP = 400,
KEY_MOUSE_WHEEL_DOWN = 294, KEY_AC_REFRESH = 401,
KEY_MOUSE_9 = 295, KEY_AC_BOOKMARKS = 402,
KEY_LAST = 512, KEY_BRIGHTNESSDOWN = 403,
KEY_BRIGHTNESSUP = 404,
KEY_DISPLAYSWITCH = 405,
KEY_KBDILLUMTOGGLE = 406,
KEY_KBDILLUMDOWN = 407,
KEY_KBDILLUMUP = 408,
KEY_EJECT = 409,
KEY_SLEEP = 410,
KEY_MOUSE_1 = 411,
KEY_MOUSE_2 = 412,
KEY_MOUSE_3 = 413,
KEY_MOUSE_4 = 414,
KEY_MOUSE_5 = 415,
KEY_MOUSE_6 = 416,
KEY_MOUSE_7 = 417,
KEY_MOUSE_8 = 418,
KEY_MOUSE_9 = 419,
KEY_MOUSE_WHEEL_UP = 420,
KEY_MOUSE_WHEEL_DOWN = 421,
KEY_LAST,
}; };
inline int KeyToKeycode(int Key) { return (Key>=0x80) ? (Key-0x80)|(1<<30) : Key; };
inline int KeycodeToKey(int Keycode) { return (Keycode&(1<<30)) ? Keycode-(1<<30)+0x80 : Keycode; };
#endif #endif

View file

@ -89,7 +89,7 @@ void CBinds::SetDefaults()
Bind(KEY_F1, "toggle_local_console"); Bind(KEY_F1, "toggle_local_console");
Bind(KEY_F2, "toggle_remote_console"); Bind(KEY_F2, "toggle_remote_console");
Bind(KEY_TAB, "+scoreboard"); Bind(KEY_TAB, "+scoreboard");
Bind(KEY_GRAVE, "+statboard"); Bind(KEY_CARET, "+statboard");
Bind(KEY_F10, "screenshot"); Bind(KEY_F10, "screenshot");
Bind('a', "+left"); Bind('a', "+left");