From dcd4f9ae7aa9d041467a5835b30a149cb168ae28 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Sun, 29 Jun 2014 21:02:09 +0200 Subject: [PATCH] moving to sdl2, mouse input lags; do not use! --- scripts/SDL_keysym.h | 311 ------------- scripts/SDL_scancode.h | 401 ++++++++++++++++ scripts/gen_keys.py | 19 +- src/engine/client/client.cpp | 8 +- src/engine/client/input.cpp | 12 + src/engine/client/keynames.h | 558 +++++++++++------------ src/engine/input.h | 2 +- src/engine/keys.h | 498 ++++++++++---------- src/game/client/components/maplayers.cpp | 2 +- src/game/editor/editor.cpp | 20 +- 10 files changed, 976 insertions(+), 855 deletions(-) delete mode 100644 scripts/SDL_keysym.h create mode 100644 scripts/SDL_scancode.h diff --git a/scripts/SDL_keysym.h b/scripts/SDL_keysym.h deleted file mode 100644 index ff44a035f..000000000 --- a/scripts/SDL_keysym.h +++ /dev/null @@ -1,311 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2006 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org -*/ - -#ifndef _SDL_keysym_h -#define _SDL_keysym_h - -/* What we really want is a mapping of every raw key on the keyboard. - To support international keyboards, we use the range 0xA1 - 0xFF - as international virtual keycodes. We'll follow in the footsteps of X11... - The names of the keys - */ - -typedef enum { - /* The keyboard syms have been cleverly chosen to map to ASCII */ - SDLK_UNKNOWN = 0, - SDLK_FIRST = 0, - SDLK_BACKSPACE = 8, - SDLK_TAB = 9, - SDLK_CLEAR = 12, - SDLK_RETURN = 13, - SDLK_PAUSE = 19, - SDLK_ESCAPE = 27, - SDLK_SPACE = 32, - SDLK_EXCLAIM = 33, - SDLK_QUOTEDBL = 34, - SDLK_HASH = 35, - SDLK_DOLLAR = 36, - SDLK_AMPERSAND = 38, - SDLK_QUOTE = 39, - SDLK_LEFTPAREN = 40, - SDLK_RIGHTPAREN = 41, - SDLK_ASTERISK = 42, - SDLK_PLUS = 43, - SDLK_COMMA = 44, - SDLK_MINUS = 45, - SDLK_PERIOD = 46, - SDLK_SLASH = 47, - SDLK_0 = 48, - SDLK_1 = 49, - SDLK_2 = 50, - SDLK_3 = 51, - SDLK_4 = 52, - SDLK_5 = 53, - SDLK_6 = 54, - SDLK_7 = 55, - SDLK_8 = 56, - SDLK_9 = 57, - SDLK_COLON = 58, - SDLK_SEMICOLON = 59, - SDLK_LESS = 60, - SDLK_EQUALS = 61, - SDLK_GREATER = 62, - SDLK_QUESTION = 63, - SDLK_AT = 64, - /* - Skip uppercase letters - */ - SDLK_LEFTBRACKET = 91, - SDLK_BACKSLASH = 92, - SDLK_RIGHTBRACKET = 93, - SDLK_CARET = 94, - SDLK_UNDERSCORE = 95, - SDLK_BACKQUOTE = 96, - SDLK_a = 97, - SDLK_b = 98, - SDLK_c = 99, - SDLK_d = 100, - SDLK_e = 101, - SDLK_f = 102, - SDLK_g = 103, - SDLK_h = 104, - SDLK_i = 105, - SDLK_j = 106, - SDLK_k = 107, - SDLK_l = 108, - SDLK_m = 109, - SDLK_n = 110, - SDLK_o = 111, - SDLK_p = 112, - SDLK_q = 113, - SDLK_r = 114, - SDLK_s = 115, - SDLK_t = 116, - SDLK_u = 117, - SDLK_v = 118, - SDLK_w = 119, - SDLK_x = 120, - SDLK_y = 121, - SDLK_z = 122, - SDLK_DELETE = 127, - /* End of ASCII mapped keysyms */ - - /* International keyboard syms */ - SDLK_WORLD_0 = 160, /* 0xA0 */ - SDLK_WORLD_1 = 161, - SDLK_WORLD_2 = 162, - SDLK_WORLD_3 = 163, - SDLK_WORLD_4 = 164, - SDLK_WORLD_5 = 165, - SDLK_WORLD_6 = 166, - SDLK_WORLD_7 = 167, - SDLK_WORLD_8 = 168, - SDLK_WORLD_9 = 169, - SDLK_WORLD_10 = 170, - SDLK_WORLD_11 = 171, - SDLK_WORLD_12 = 172, - SDLK_WORLD_13 = 173, - SDLK_WORLD_14 = 174, - SDLK_WORLD_15 = 175, - SDLK_WORLD_16 = 176, - SDLK_WORLD_17 = 177, - SDLK_WORLD_18 = 178, - SDLK_WORLD_19 = 179, - SDLK_WORLD_20 = 180, - SDLK_WORLD_21 = 181, - SDLK_WORLD_22 = 182, - SDLK_WORLD_23 = 183, - SDLK_WORLD_24 = 184, - SDLK_WORLD_25 = 185, - SDLK_WORLD_26 = 186, - SDLK_WORLD_27 = 187, - SDLK_WORLD_28 = 188, - SDLK_WORLD_29 = 189, - SDLK_WORLD_30 = 190, - SDLK_WORLD_31 = 191, - SDLK_WORLD_32 = 192, - SDLK_WORLD_33 = 193, - SDLK_WORLD_34 = 194, - SDLK_WORLD_35 = 195, - SDLK_WORLD_36 = 196, - SDLK_WORLD_37 = 197, - SDLK_WORLD_38 = 198, - SDLK_WORLD_39 = 199, - SDLK_WORLD_40 = 200, - SDLK_WORLD_41 = 201, - SDLK_WORLD_42 = 202, - SDLK_WORLD_43 = 203, - SDLK_WORLD_44 = 204, - SDLK_WORLD_45 = 205, - SDLK_WORLD_46 = 206, - SDLK_WORLD_47 = 207, - SDLK_WORLD_48 = 208, - SDLK_WORLD_49 = 209, - SDLK_WORLD_50 = 210, - SDLK_WORLD_51 = 211, - SDLK_WORLD_52 = 212, - SDLK_WORLD_53 = 213, - SDLK_WORLD_54 = 214, - SDLK_WORLD_55 = 215, - SDLK_WORLD_56 = 216, - SDLK_WORLD_57 = 217, - SDLK_WORLD_58 = 218, - SDLK_WORLD_59 = 219, - SDLK_WORLD_60 = 220, - SDLK_WORLD_61 = 221, - SDLK_WORLD_62 = 222, - SDLK_WORLD_63 = 223, - SDLK_WORLD_64 = 224, - SDLK_WORLD_65 = 225, - SDLK_WORLD_66 = 226, - SDLK_WORLD_67 = 227, - SDLK_WORLD_68 = 228, - SDLK_WORLD_69 = 229, - SDLK_WORLD_70 = 230, - SDLK_WORLD_71 = 231, - SDLK_WORLD_72 = 232, - SDLK_WORLD_73 = 233, - SDLK_WORLD_74 = 234, - SDLK_WORLD_75 = 235, - SDLK_WORLD_76 = 236, - SDLK_WORLD_77 = 237, - SDLK_WORLD_78 = 238, - SDLK_WORLD_79 = 239, - SDLK_WORLD_80 = 240, - SDLK_WORLD_81 = 241, - SDLK_WORLD_82 = 242, - SDLK_WORLD_83 = 243, - SDLK_WORLD_84 = 244, - SDLK_WORLD_85 = 245, - SDLK_WORLD_86 = 246, - SDLK_WORLD_87 = 247, - SDLK_WORLD_88 = 248, - SDLK_WORLD_89 = 249, - SDLK_WORLD_90 = 250, - SDLK_WORLD_91 = 251, - SDLK_WORLD_92 = 252, - SDLK_WORLD_93 = 253, - SDLK_WORLD_94 = 254, - SDLK_WORLD_95 = 255, /* 0xFF */ - - /* Numeric keypad */ - SDLK_KP0 = 256, - SDLK_KP1 = 257, - SDLK_KP2 = 258, - SDLK_KP3 = 259, - SDLK_KP4 = 260, - SDLK_KP5 = 261, - SDLK_KP6 = 262, - SDLK_KP7 = 263, - SDLK_KP8 = 264, - SDLK_KP9 = 265, - SDLK_KP_PERIOD = 266, - SDLK_KP_DIVIDE = 267, - SDLK_KP_MULTIPLY = 268, - SDLK_KP_MINUS = 269, - SDLK_KP_PLUS = 270, - SDLK_KP_ENTER = 271, - SDLK_KP_EQUALS = 272, - - /* Arrows + Home/End pad */ - SDLK_UP = 273, - SDLK_DOWN = 274, - SDLK_RIGHT = 275, - SDLK_LEFT = 276, - SDLK_INSERT = 277, - SDLK_HOME = 278, - SDLK_END = 279, - SDLK_PAGEUP = 280, - SDLK_PAGEDOWN = 281, - - /* Function keys */ - SDLK_F1 = 282, - SDLK_F2 = 283, - SDLK_F3 = 284, - SDLK_F4 = 285, - SDLK_F5 = 286, - SDLK_F6 = 287, - SDLK_F7 = 288, - SDLK_F8 = 289, - SDLK_F9 = 290, - SDLK_F10 = 291, - SDLK_F11 = 292, - SDLK_F12 = 293, - SDLK_F13 = 294, - SDLK_F14 = 295, - SDLK_F15 = 296, - - /* Key state modifier keys */ - SDLK_NUMLOCK = 300, - SDLK_CAPSLOCK = 301, - SDLK_SCROLLOCK = 302, - SDLK_RSHIFT = 303, - SDLK_LSHIFT = 304, - SDLK_RCTRL = 305, - SDLK_LCTRL = 306, - SDLK_RALT = 307, - SDLK_LALT = 308, - SDLK_RMETA = 309, - SDLK_LMETA = 310, - SDLK_LSUPER = 311, /* Left "Windows" key */ - SDLK_RSUPER = 312, /* Right "Windows" key */ - SDLK_MODE = 313, /* "Alt Gr" key */ - SDLK_COMPOSE = 314, /* Multi-key compose key */ - - /* Miscellaneous function keys */ - SDLK_HELP = 315, - SDLK_PRINT = 316, - SDLK_SYSREQ = 317, - SDLK_BREAK = 318, - SDLK_MENU = 319, - SDLK_POWER = 320, /* Power Macintosh power key */ - SDLK_EURO = 321, /* Some european keyboards */ - SDLK_UNDO = 322, /* Atari keyboard has Undo */ - - /* Add any other keys here */ - - SDLK_LAST -} SDLKey; - -/* Enumeration of valid key mods (possibly OR'd together) */ -typedef enum { - KMOD_NONE = 0x0000, - KMOD_LSHIFT= 0x0001, - KMOD_RSHIFT= 0x0002, - KMOD_LCTRL = 0x0040, - KMOD_RCTRL = 0x0080, - KMOD_LALT = 0x0100, - KMOD_RALT = 0x0200, - KMOD_LMETA = 0x0400, - KMOD_RMETA = 0x0800, - KMOD_NUM = 0x1000, - KMOD_CAPS = 0x2000, - KMOD_MODE = 0x4000, - KMOD_RESERVED = 0x8000 -} SDLMod; - -#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) -#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) -#define KMOD_ALT (KMOD_LALT|KMOD_RALT) -#define KMOD_META (KMOD_LMETA|KMOD_RMETA) - -#endif /* _SDL_keysym_h */ diff --git a/scripts/SDL_scancode.h b/scripts/SDL_scancode.h new file mode 100644 index 000000000..d3f874811 --- /dev/null +++ b/scripts/SDL_scancode.h @@ -0,0 +1,401 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_scancode.h + * + * Defines keyboard scancodes. + */ + +#ifndef _SDL_scancode_h +#define _SDL_scancode_h + +#include "SDL_stdinc.h" + +/** + * \brief The SDL keyboard scancode representation. + * + * Values of this type are used to represent keyboard keys, among other places + * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the + * SDL_Event structure. + * + * The values in this enumeration are based on the USB usage page standard: + * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf + */ +typedef enum +{ + SDL_SCANCODE_UNKNOWN = 0, + + /** + * \name Usage page 0x07 + * + * These values are from usage page 0x07 (USB keyboard page). + */ + /*@{*/ + + SDL_SCANCODE_A = 4, + SDL_SCANCODE_B = 5, + SDL_SCANCODE_C = 6, + SDL_SCANCODE_D = 7, + SDL_SCANCODE_E = 8, + SDL_SCANCODE_F = 9, + SDL_SCANCODE_G = 10, + SDL_SCANCODE_H = 11, + SDL_SCANCODE_I = 12, + SDL_SCANCODE_J = 13, + SDL_SCANCODE_K = 14, + SDL_SCANCODE_L = 15, + SDL_SCANCODE_M = 16, + SDL_SCANCODE_N = 17, + SDL_SCANCODE_O = 18, + SDL_SCANCODE_P = 19, + SDL_SCANCODE_Q = 20, + SDL_SCANCODE_R = 21, + SDL_SCANCODE_S = 22, + SDL_SCANCODE_T = 23, + SDL_SCANCODE_U = 24, + SDL_SCANCODE_V = 25, + SDL_SCANCODE_W = 26, + SDL_SCANCODE_X = 27, + SDL_SCANCODE_Y = 28, + SDL_SCANCODE_Z = 29, + + SDL_SCANCODE_1 = 30, + SDL_SCANCODE_2 = 31, + SDL_SCANCODE_3 = 32, + SDL_SCANCODE_4 = 33, + SDL_SCANCODE_5 = 34, + SDL_SCANCODE_6 = 35, + SDL_SCANCODE_7 = 36, + SDL_SCANCODE_8 = 37, + SDL_SCANCODE_9 = 38, + SDL_SCANCODE_0 = 39, + + SDL_SCANCODE_RETURN = 40, + SDL_SCANCODE_ESCAPE = 41, + SDL_SCANCODE_BACKSPACE = 42, + SDL_SCANCODE_TAB = 43, + SDL_SCANCODE_SPACE = 44, + + SDL_SCANCODE_MINUS = 45, + SDL_SCANCODE_EQUALS = 46, + SDL_SCANCODE_LEFTBRACKET = 47, + SDL_SCANCODE_RIGHTBRACKET = 48, + SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return + * key on ISO keyboards and at the right end + * of the QWERTY row on ANSI keyboards. + * Produces REVERSE SOLIDUS (backslash) and + * VERTICAL LINE in a US layout, REVERSE + * SOLIDUS and VERTICAL LINE in a UK Mac + * layout, NUMBER SIGN and TILDE in a UK + * Windows layout, DOLLAR SIGN and POUND SIGN + * in a Swiss German layout, NUMBER SIGN and + * APOSTROPHE in a German layout, GRAVE + * ACCENT and POUND SIGN in a French Mac + * layout, and ASTERISK and MICRO SIGN in a + * French Windows layout. + */ + SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code + * instead of 49 for the same key, but all + * OSes I've seen treat the two codes + * identically. So, as an implementor, unless + * your keyboard generates both of those + * codes and your OS treats them differently, + * you should generate SDL_SCANCODE_BACKSLASH + * instead of this code. As a user, you + * should not rely on this code because SDL + * will never generate it with most (all?) + * keyboards. + */ + SDL_SCANCODE_SEMICOLON = 51, + SDL_SCANCODE_APOSTROPHE = 52, + SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI + * and ISO keyboards). Produces GRAVE ACCENT and + * TILDE in a US Windows layout and in US and UK + * Mac layouts on ANSI keyboards, GRAVE ACCENT + * and NOT SIGN in a UK Windows layout, SECTION + * SIGN and PLUS-MINUS SIGN in US and UK Mac + * layouts on ISO keyboards, SECTION SIGN and + * DEGREE SIGN in a Swiss German layout (Mac: + * only on ISO keyboards), CIRCUMFLEX ACCENT and + * DEGREE SIGN in a German layout (Mac: only on + * ISO keyboards), SUPERSCRIPT TWO and TILDE in a + * French Windows layout, COMMERCIAL AT and + * NUMBER SIGN in a French Mac layout on ISO + * keyboards, and LESS-THAN SIGN and GREATER-THAN + * SIGN in a Swiss German, German, or French Mac + * layout on ANSI keyboards. + */ + SDL_SCANCODE_COMMA = 54, + SDL_SCANCODE_PERIOD = 55, + SDL_SCANCODE_SLASH = 56, + + SDL_SCANCODE_CAPSLOCK = 57, + + SDL_SCANCODE_F1 = 58, + SDL_SCANCODE_F2 = 59, + SDL_SCANCODE_F3 = 60, + SDL_SCANCODE_F4 = 61, + SDL_SCANCODE_F5 = 62, + SDL_SCANCODE_F6 = 63, + SDL_SCANCODE_F7 = 64, + SDL_SCANCODE_F8 = 65, + SDL_SCANCODE_F9 = 66, + SDL_SCANCODE_F10 = 67, + SDL_SCANCODE_F11 = 68, + SDL_SCANCODE_F12 = 69, + + SDL_SCANCODE_PRINTSCREEN = 70, + SDL_SCANCODE_SCROLLLOCK = 71, + SDL_SCANCODE_PAUSE = 72, + SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but + does send code 73, not 117) */ + SDL_SCANCODE_HOME = 74, + SDL_SCANCODE_PAGEUP = 75, + SDL_SCANCODE_DELETE = 76, + SDL_SCANCODE_END = 77, + SDL_SCANCODE_PAGEDOWN = 78, + SDL_SCANCODE_RIGHT = 79, + SDL_SCANCODE_LEFT = 80, + SDL_SCANCODE_DOWN = 81, + SDL_SCANCODE_UP = 82, + + SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards + */ + SDL_SCANCODE_KP_DIVIDE = 84, + SDL_SCANCODE_KP_MULTIPLY = 85, + SDL_SCANCODE_KP_MINUS = 86, + SDL_SCANCODE_KP_PLUS = 87, + SDL_SCANCODE_KP_ENTER = 88, + SDL_SCANCODE_KP_1 = 89, + SDL_SCANCODE_KP_2 = 90, + SDL_SCANCODE_KP_3 = 91, + SDL_SCANCODE_KP_4 = 92, + SDL_SCANCODE_KP_5 = 93, + SDL_SCANCODE_KP_6 = 94, + SDL_SCANCODE_KP_7 = 95, + SDL_SCANCODE_KP_8 = 96, + SDL_SCANCODE_KP_9 = 97, + SDL_SCANCODE_KP_0 = 98, + SDL_SCANCODE_KP_PERIOD = 99, + + SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO + * keyboards have over ANSI ones, + * located between left shift and Y. + * Produces GRAVE ACCENT and TILDE in a + * US or UK Mac layout, REVERSE SOLIDUS + * (backslash) and VERTICAL LINE in a + * US or UK Windows layout, and + * LESS-THAN SIGN and GREATER-THAN SIGN + * in a Swiss German, German, or French + * layout. */ + SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */ + SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag, + * not a physical key - but some Mac keyboards + * do have a power key. */ + SDL_SCANCODE_KP_EQUALS = 103, + SDL_SCANCODE_F13 = 104, + SDL_SCANCODE_F14 = 105, + SDL_SCANCODE_F15 = 106, + SDL_SCANCODE_F16 = 107, + SDL_SCANCODE_F17 = 108, + SDL_SCANCODE_F18 = 109, + SDL_SCANCODE_F19 = 110, + SDL_SCANCODE_F20 = 111, + SDL_SCANCODE_F21 = 112, + SDL_SCANCODE_F22 = 113, + SDL_SCANCODE_F23 = 114, + SDL_SCANCODE_F24 = 115, + SDL_SCANCODE_EXECUTE = 116, + SDL_SCANCODE_HELP = 117, + SDL_SCANCODE_MENU = 118, + SDL_SCANCODE_SELECT = 119, + SDL_SCANCODE_STOP = 120, + SDL_SCANCODE_AGAIN = 121, /**< redo */ + SDL_SCANCODE_UNDO = 122, + SDL_SCANCODE_CUT = 123, + SDL_SCANCODE_COPY = 124, + SDL_SCANCODE_PASTE = 125, + SDL_SCANCODE_FIND = 126, + SDL_SCANCODE_MUTE = 127, + SDL_SCANCODE_VOLUMEUP = 128, + SDL_SCANCODE_VOLUMEDOWN = 129, +/* not sure whether there's a reason to enable these */ +/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */ +/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */ +/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */ + SDL_SCANCODE_KP_COMMA = 133, + SDL_SCANCODE_KP_EQUALSAS400 = 134, + + SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see + footnotes in USB doc */ + SDL_SCANCODE_INTERNATIONAL2 = 136, + SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */ + SDL_SCANCODE_INTERNATIONAL4 = 138, + SDL_SCANCODE_INTERNATIONAL5 = 139, + SDL_SCANCODE_INTERNATIONAL6 = 140, + SDL_SCANCODE_INTERNATIONAL7 = 141, + SDL_SCANCODE_INTERNATIONAL8 = 142, + SDL_SCANCODE_INTERNATIONAL9 = 143, + SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */ + SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */ + SDL_SCANCODE_LANG3 = 146, /**< Katakana */ + SDL_SCANCODE_LANG4 = 147, /**< Hiragana */ + SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */ + SDL_SCANCODE_LANG6 = 149, /**< reserved */ + SDL_SCANCODE_LANG7 = 150, /**< reserved */ + SDL_SCANCODE_LANG8 = 151, /**< reserved */ + SDL_SCANCODE_LANG9 = 152, /**< reserved */ + + SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */ + SDL_SCANCODE_SYSREQ = 154, + SDL_SCANCODE_CANCEL = 155, + SDL_SCANCODE_CLEAR = 156, + SDL_SCANCODE_PRIOR = 157, + SDL_SCANCODE_RETURN2 = 158, + SDL_SCANCODE_SEPARATOR = 159, + SDL_SCANCODE_OUT = 160, + SDL_SCANCODE_OPER = 161, + SDL_SCANCODE_CLEARAGAIN = 162, + SDL_SCANCODE_CRSEL = 163, + SDL_SCANCODE_EXSEL = 164, + + SDL_SCANCODE_KP_00 = 176, + SDL_SCANCODE_KP_000 = 177, + SDL_SCANCODE_THOUSANDSSEPARATOR = 178, + SDL_SCANCODE_DECIMALSEPARATOR = 179, + SDL_SCANCODE_CURRENCYUNIT = 180, + SDL_SCANCODE_CURRENCYSUBUNIT = 181, + SDL_SCANCODE_KP_LEFTPAREN = 182, + SDL_SCANCODE_KP_RIGHTPAREN = 183, + SDL_SCANCODE_KP_LEFTBRACE = 184, + SDL_SCANCODE_KP_RIGHTBRACE = 185, + SDL_SCANCODE_KP_TAB = 186, + SDL_SCANCODE_KP_BACKSPACE = 187, + SDL_SCANCODE_KP_A = 188, + SDL_SCANCODE_KP_B = 189, + SDL_SCANCODE_KP_C = 190, + SDL_SCANCODE_KP_D = 191, + SDL_SCANCODE_KP_E = 192, + SDL_SCANCODE_KP_F = 193, + SDL_SCANCODE_KP_XOR = 194, + SDL_SCANCODE_KP_POWER = 195, + SDL_SCANCODE_KP_PERCENT = 196, + SDL_SCANCODE_KP_LESS = 197, + SDL_SCANCODE_KP_GREATER = 198, + SDL_SCANCODE_KP_AMPERSAND = 199, + SDL_SCANCODE_KP_DBLAMPERSAND = 200, + SDL_SCANCODE_KP_VERTICALBAR = 201, + SDL_SCANCODE_KP_DBLVERTICALBAR = 202, + SDL_SCANCODE_KP_COLON = 203, + SDL_SCANCODE_KP_HASH = 204, + SDL_SCANCODE_KP_SPACE = 205, + SDL_SCANCODE_KP_AT = 206, + SDL_SCANCODE_KP_EXCLAM = 207, + SDL_SCANCODE_KP_MEMSTORE = 208, + SDL_SCANCODE_KP_MEMRECALL = 209, + SDL_SCANCODE_KP_MEMCLEAR = 210, + SDL_SCANCODE_KP_MEMADD = 211, + SDL_SCANCODE_KP_MEMSUBTRACT = 212, + SDL_SCANCODE_KP_MEMMULTIPLY = 213, + SDL_SCANCODE_KP_MEMDIVIDE = 214, + SDL_SCANCODE_KP_PLUSMINUS = 215, + SDL_SCANCODE_KP_CLEAR = 216, + SDL_SCANCODE_KP_CLEARENTRY = 217, + SDL_SCANCODE_KP_BINARY = 218, + SDL_SCANCODE_KP_OCTAL = 219, + SDL_SCANCODE_KP_DECIMAL = 220, + SDL_SCANCODE_KP_HEXADECIMAL = 221, + + SDL_SCANCODE_LCTRL = 224, + SDL_SCANCODE_LSHIFT = 225, + SDL_SCANCODE_LALT = 226, /**< alt, option */ + SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */ + SDL_SCANCODE_RCTRL = 228, + SDL_SCANCODE_RSHIFT = 229, + SDL_SCANCODE_RALT = 230, /**< alt gr, option */ + SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */ + + SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered + * by any of the above, but since there's a + * special KMOD_MODE for it I'm adding it here + */ + + /*@}*//*Usage page 0x07*/ + + /** + * \name Usage page 0x0C + * + * These values are mapped from usage page 0x0C (USB consumer page). + */ + /*@{*/ + + SDL_SCANCODE_AUDIONEXT = 258, + SDL_SCANCODE_AUDIOPREV = 259, + SDL_SCANCODE_AUDIOSTOP = 260, + SDL_SCANCODE_AUDIOPLAY = 261, + SDL_SCANCODE_AUDIOMUTE = 262, + SDL_SCANCODE_MEDIASELECT = 263, + SDL_SCANCODE_WWW = 264, + SDL_SCANCODE_MAIL = 265, + SDL_SCANCODE_CALCULATOR = 266, + SDL_SCANCODE_COMPUTER = 267, + SDL_SCANCODE_AC_SEARCH = 268, + SDL_SCANCODE_AC_HOME = 269, + SDL_SCANCODE_AC_BACK = 270, + SDL_SCANCODE_AC_FORWARD = 271, + SDL_SCANCODE_AC_STOP = 272, + SDL_SCANCODE_AC_REFRESH = 273, + SDL_SCANCODE_AC_BOOKMARKS = 274, + + /*@}*//*Usage page 0x0C*/ + + /** + * \name Walther keys + * + * These are values that Christian Walther added (for mac keyboard?). + */ + /*@{*/ + + SDL_SCANCODE_BRIGHTNESSDOWN = 275, + SDL_SCANCODE_BRIGHTNESSUP = 276, + SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display + switch, video mode switch */ + SDL_SCANCODE_KBDILLUMTOGGLE = 278, + SDL_SCANCODE_KBDILLUMDOWN = 279, + SDL_SCANCODE_KBDILLUMUP = 280, + SDL_SCANCODE_EJECT = 281, + SDL_SCANCODE_SLEEP = 282, + + SDL_SCANCODE_APP1 = 283, + SDL_SCANCODE_APP2 = 284, + + /*@}*//*Walther keys*/ + + /* Add any other keys here. */ + + SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes + for array bounds */ +} SDL_Scancode; + +#endif /* _SDL_scancode_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/scripts/gen_keys.py b/scripts/gen_keys.py index 51a659d73..3325f27c3 100644 --- a/scripts/gen_keys.py +++ b/scripts/gen_keys.py @@ -9,16 +9,27 @@ for i in range(0, 512): print >>f, "#ifndef ENGINE_KEYS_H" print >>f, "#define ENGINE_KEYS_H" + +# KEY_EXECUTE already exists on windows platforms +print >>f, "#if defined(CONF_FAMILY_WINDOWS)" +print >>f, " #undef KEY_EXECUTE" +print >>f, "#endif" + print >>f, '/* AUTO GENERATED! DO NOT EDIT MANUALLY! */' print >>f, "enum" print >>f, "{" +print >>f, "\tKEY_FIRST = 0," + highestid = 0 -for line in open("scripts/SDL_keysym.h"): +for line in open("scripts/SDL_scancode.h"): l = line.strip().split("=") - if len(l) == 2 and "SDLK_" in line: - key = l[0].strip().replace("SDLK_", "KEY_") + if len(l) == 2 and "SDL_SCANCODE_" in line: + key = l[0].strip().replace("SDL_SCANCODE_", "KEY_") + value = int(l[1].split(",")[0].strip()) + if key[0:2] == "/*": + continue print >>f, "\t%s = %d,"%(key, value) keynames[value] = key.replace("KEY_", "").lower() @@ -53,7 +64,7 @@ print >>f, '#endif' print >>f, '' print >>f, "#include " print >>f, "" -print >>f, "const char g_aaKeyStrings[512][16] =" +print >>f, "const char g_aaKeyStrings[512][20] =" print >>f, "{" for n in keynames: print >>f, '\t"%s",'%n diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 4c76b1ff2..bb8314783 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1850,19 +1850,19 @@ void CClient::Run() } // panic quit button - if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyPressed('q')) + if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyPressed(KEY_Q)) { Quit(); break; } - if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown('d')) + if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown(KEY_D)) g_Config.m_Debug ^= 1; - if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown('g')) + if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown(KEY_G)) g_Config.m_DbgGraphs ^= 1; - if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown('e')) + if(Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown(KEY_E)) { g_Config.m_ClEditor = g_Config.m_ClEditor^1; Input()->MouseModeRelative(); diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index 8bf7ce00c..8ebcbf5ef 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -155,6 +155,16 @@ int CInput::Update() int Action = IInput::FLAG_PRESS; switch (Event.type) { + case SDL_TEXTINPUT: + { + int TextLength, i; + TextLength = strlen(Event.text.text); + for(i = 0; i < TextLength; i++) + { + AddEvent(Event.text.text[i], 0, 0); + } + } + // handle keys case SDL_KEYDOWN: Key = SDL_GetScancodeFromName(SDL_GetKeyName(Event.key.keysym.sym)); @@ -188,6 +198,8 @@ int CInput::Update() case SDL_MOUSEWHEEL: if(Event.wheel.y > 0) Key = KEY_MOUSE_WHEEL_UP; // ignore_convention if(Event.wheel.y < 0) Key = KEY_MOUSE_WHEEL_DOWN; // ignore_convention + AddEvent(0, Key, Action); + Action = IInput::FLAG_RELEASE; break; // other messages diff --git a/src/engine/client/keynames.h b/src/engine/client/keynames.h index 538f17431..28099b1d7 100644 --- a/src/engine/client/keynames.h +++ b/src/engine/client/keynames.h @@ -1,5 +1,3 @@ -/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ -/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* AUTO GENERATED! DO NOT EDIT MANUALLY! */ #ifndef KEYS_INCLUDE @@ -8,105 +6,12 @@ #include -const char g_aaKeyStrings[512][16] = +const char g_aaKeyStrings[512][20] = { - "first", + "unknown", "&1", "&2", "&3", - "&4", - "&5", - "&6", - "&7", - "backspace", - "tab", - "&10", - "&11", - "clear", - "return", - "&14", - "&15", - "&16", - "&17", - "&18", - "pause", - "&20", - "&21", - "&22", - "&23", - "&24", - "&25", - "&26", - "escape", - "&28", - "&29", - "&30", - "&31", - "space", - "exclaim", - "quotedbl", - "hash", - "dollar", - "&37", - "ampersand", - "quote", - "leftparen", - "rightparen", - "asterisk", - "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", "b", "c", @@ -133,165 +38,34 @@ const char g_aaKeyStrings[512][16] = "x", "y", "z", - "&123", - "&124", - "&125", - "&126", - "delete", - "&128", - "&129", - "&130", - "&131", - "&132", - "&133", - "&134", - "&135", - "&136", - "&137", - "&138", - "&139", - "&140", - "&141", - "&142", - "&143", - "&144", - "&145", - "&146", - "&147", - "&148", - "&149", - "&150", - "&151", - "&152", - "&153", - "&154", - "&155", - "&156", - "&157", - "&158", - "&159", - "world_0", - "world_1", - "world_2", - "world_3", - "world_4", - "world_5", - "world_6", - "world_7", - "world_8", - "world_9", - "world_10", - "world_11", - "world_12", - "world_13", - "world_14", - "world_15", - "world_16", - "world_17", - "world_18", - "world_19", - "world_20", - "world_21", - "world_22", - "world_23", - "world_24", - "world_25", - "world_26", - "world_27", - "world_28", - "world_29", - "world_30", - "world_31", - "world_32", - "world_33", - "world_34", - "world_35", - "world_36", - "world_37", - "world_38", - "world_39", - "world_40", - "world_41", - "world_42", - "world_43", - "world_44", - "world_45", - "world_46", - "world_47", - "world_48", - "world_49", - "world_50", - "world_51", - "world_52", - "world_53", - "world_54", - "world_55", - "world_56", - "world_57", - "world_58", - "world_59", - "world_60", - "world_61", - "world_62", - "world_63", - "world_64", - "world_65", - "world_66", - "world_67", - "world_68", - "world_69", - "world_70", - "world_71", - "world_72", - "world_73", - "world_74", - "world_75", - "world_76", - "world_77", - "world_78", - "world_79", - "world_80", - "world_81", - "world_82", - "world_83", - "world_84", - "world_85", - "world_86", - "world_87", - "world_88", - "world_89", - "world_90", - "world_91", - "world_92", - "world_93", - "world_94", - "world_95", - "kp0", - "kp1", - "kp2", - "kp3", - "kp4", - "kp5", - "kp6", - "kp7", - "kp8", - "kp9", - "kp_period", - "kp_divide", - "kp_multiply", - "kp_minus", - "kp_plus", - "kp_enter", - "kp_equals", - "up", - "down", - "right", - "left", - "insert", - "home", - "end", - "pageup", - "pagedown", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "0", + "return", + "escape", + "backspace", + "tab", + "space", + "minus", + "equals", + "leftbracket", + "rightbracket", + "backslash", + "nonushash", + "semicolon", + "apostrophe", + "grave", + "comma", + "period", + "slash", + "capslock", "f1", "f2", "f3", @@ -304,35 +78,221 @@ const char g_aaKeyStrings[512][16] = "f10", "f11", "f12", + "printscreen", + "scrolllock", + "pause", + "insert", + "home", + "pageup", + "delete", + "end", + "pagedown", + "right", + "left", + "down", + "up", + "numlockclear", + "kp_divide", + "kp_multiply", + "kp_minus", + "kp_plus", + "kp_enter", + "kp_1", + "kp_2", + "kp_3", + "kp_4", + "kp_5", + "kp_6", + "kp_7", + "kp_8", + "kp_9", + "kp_0", + "kp_period", + "nonusbackslash", + "application", + "power", + "kp_equals", "f13", "f14", "f15", - "&297", - "&298", - "&299", - "numlock", - "capslock", - "scrollock", - "rshift", - "lshift", - "rctrl", - "lctrl", - "ralt", - "lalt", - "rmeta", - "lmeta", - "lsuper", - "rsuper", - "mode", - "compose", + "f16", + "f17", + "f18", + "f19", + "f20", + "f21", + "f22", + "f23", + "f24", + "execute", "help", - "print", - "sysreq", - "break", "menu", - "power", - "euro", + "select", + "stop", + "again", "undo", + "cut", + "copy", + "paste", + "find", + "mute", + "volumeup", + "volumedown", + "&130", + "&131", + "&132", + "kp_comma", + "kp_equalsas400", + "international1", + "international2", + "international3", + "international4", + "international5", + "international6", + "international7", + "international8", + "international9", + "lang1", + "lang2", + "lang3", + "lang4", + "lang5", + "lang6", + "lang7", + "lang8", + "lang9", + "alterase", + "sysreq", + "cancel", + "clear", + "prior", + "return2", + "separator", + "out", + "oper", + "clearagain", + "crsel", + "exsel", + "&165", + "&166", + "&167", + "&168", + "&169", + "&170", + "&171", + "&172", + "&173", + "&174", + "&175", + "kp_00", + "kp_000", + "thousandsseparator", + "decimalseparator", + "currencyunit", + "currencysubunit", + "kp_leftparen", + "kp_rightparen", + "kp_leftbrace", + "kp_rightbrace", + "kp_tab", + "kp_backspace", + "kp_a", + "kp_b", + "kp_c", + "kp_d", + "kp_e", + "kp_f", + "kp_xor", + "kp_power", + "kp_percent", + "kp_less", + "kp_greater", + "kp_ampersand", + "kp_dblampersand", + "kp_verticalbar", + "kp_dblverticalbar", + "kp_colon", + "kp_hash", + "kp_space", + "kp_at", + "kp_exclam", + "kp_memstore", + "kp_memrecall", + "kp_memclear", + "kp_memadd", + "kp_memsubtract", + "kp_memmultiply", + "kp_memdivide", + "kp_plusminus", + "kp_clear", + "kp_clearentry", + "kp_binary", + "kp_octal", + "kp_decimal", + "kp_hexadecimal", + "&222", + "&223", + "lctrl", + "lshift", + "lalt", + "lgui", + "rctrl", + "rshift", + "ralt", + "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", @@ -343,7 +303,45 @@ const char g_aaKeyStrings[512][16] = "mouse8", "mousewheelup", "mousewheeldown", - "mouse9", + "&295", + "&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", diff --git a/src/engine/input.h b/src/engine/input.h index 93ceccd20..72a561dd7 100644 --- a/src/engine/input.h +++ b/src/engine/input.h @@ -5,7 +5,7 @@ #include "kernel.h" -extern const char g_aaKeyStrings[512][16]; +extern const char g_aaKeyStrings[512][20]; class IInput : public IInterface { diff --git a/src/engine/keys.h b/src/engine/keys.h index 9a138b973..0c8677c35 100644 --- a/src/engine/keys.h +++ b/src/engine/keys.h @@ -1,254 +1,264 @@ -/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ -/* If you are missing that file, acquire a complete release at teeworlds.com. */ #ifndef ENGINE_KEYS_H #define ENGINE_KEYS_H +#if defined(CONF_FAMILY_WINDOWS) + #undef KEY_EXECUTE +#endif /* AUTO GENERATED! DO NOT EDIT MANUALLY! */ enum { - KEY_UNKNOWN = 0, KEY_FIRST = 0, - KEY_BACKSPACE = 8, - KEY_TAB = 9, - KEY_CLEAR = 12, - KEY_RETURN = 13, - KEY_PAUSE = 19, - KEY_ESCAPE = 27, - KEY_SPACE = 32, - KEY_EXCLAIM = 33, - KEY_QUOTEDBL = 34, - KEY_HASH = 35, - KEY_DOLLAR = 36, - KEY_AMPERSAND = 38, - KEY_QUOTE = 39, - KEY_LEFTPAREN = 40, - KEY_RIGHTPAREN = 41, - KEY_ASTERISK = 42, - KEY_PLUS = 43, - KEY_COMMA = 44, + KEY_UNKNOWN = 0, + KEY_A = 4, + KEY_B = 5, + KEY_C = 6, + KEY_D = 7, + KEY_E = 8, + KEY_F = 9, + KEY_G = 10, + KEY_H = 11, + KEY_I = 12, + KEY_J = 13, + KEY_K = 14, + KEY_L = 15, + KEY_M = 16, + KEY_N = 17, + KEY_O = 18, + KEY_P = 19, + KEY_Q = 20, + 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_PERIOD = 46, - KEY_SLASH = 47, - KEY_0 = 48, - KEY_1 = 49, - KEY_2 = 50, - KEY_3 = 51, - KEY_4 = 52, - KEY_5 = 53, - KEY_6 = 54, - KEY_7 = 55, - KEY_8 = 56, - KEY_9 = 57, - KEY_COLON = 58, - KEY_SEMICOLON = 59, - KEY_LESS = 60, - KEY_EQUALS = 61, - KEY_GREATER = 62, - KEY_QUESTION = 63, - KEY_AT = 64, - KEY_LEFTBRACKET = 91, - KEY_BACKSLASH = 92, - KEY_RIGHTBRACKET = 93, - KEY_CARET = 94, - KEY_UNDERSCORE = 95, - KEY_BACKQUOTE = 96, - KEY_a = 97, - KEY_b = 98, - KEY_c = 99, - KEY_d = 100, - KEY_e = 101, - KEY_f = 102, - KEY_g = 103, - KEY_h = 104, - KEY_i = 105, - KEY_j = 106, - KEY_k = 107, - KEY_l = 108, - KEY_m = 109, - KEY_n = 110, - KEY_o = 111, - KEY_p = 112, - KEY_q = 113, - KEY_r = 114, - KEY_s = 115, - KEY_t = 116, - KEY_u = 117, - KEY_v = 118, - KEY_w = 119, - KEY_x = 120, - KEY_y = 121, - KEY_z = 122, - KEY_DELETE = 127, - KEY_WORLD_0 = 160, - KEY_WORLD_1 = 161, - KEY_WORLD_2 = 162, - KEY_WORLD_3 = 163, - KEY_WORLD_4 = 164, - KEY_WORLD_5 = 165, - KEY_WORLD_6 = 166, - KEY_WORLD_7 = 167, - KEY_WORLD_8 = 168, - KEY_WORLD_9 = 169, - KEY_WORLD_10 = 170, - KEY_WORLD_11 = 171, - KEY_WORLD_12 = 172, - KEY_WORLD_13 = 173, - KEY_WORLD_14 = 174, - KEY_WORLD_15 = 175, - KEY_WORLD_16 = 176, - KEY_WORLD_17 = 177, - KEY_WORLD_18 = 178, - KEY_WORLD_19 = 179, - KEY_WORLD_20 = 180, - KEY_WORLD_21 = 181, - KEY_WORLD_22 = 182, - KEY_WORLD_23 = 183, - KEY_WORLD_24 = 184, - KEY_WORLD_25 = 185, - KEY_WORLD_26 = 186, - KEY_WORLD_27 = 187, - KEY_WORLD_28 = 188, - KEY_WORLD_29 = 189, - KEY_WORLD_30 = 190, - KEY_WORLD_31 = 191, - KEY_WORLD_32 = 192, - KEY_WORLD_33 = 193, - KEY_WORLD_34 = 194, - KEY_WORLD_35 = 195, - KEY_WORLD_36 = 196, - KEY_WORLD_37 = 197, - KEY_WORLD_38 = 198, - KEY_WORLD_39 = 199, - KEY_WORLD_40 = 200, - KEY_WORLD_41 = 201, - KEY_WORLD_42 = 202, - KEY_WORLD_43 = 203, - KEY_WORLD_44 = 204, - KEY_WORLD_45 = 205, - KEY_WORLD_46 = 206, - KEY_WORLD_47 = 207, - KEY_WORLD_48 = 208, - KEY_WORLD_49 = 209, - KEY_WORLD_50 = 210, - KEY_WORLD_51 = 211, - KEY_WORLD_52 = 212, - KEY_WORLD_53 = 213, - KEY_WORLD_54 = 214, - KEY_WORLD_55 = 215, - KEY_WORLD_56 = 216, - KEY_WORLD_57 = 217, - KEY_WORLD_58 = 218, - KEY_WORLD_59 = 219, - KEY_WORLD_60 = 220, - KEY_WORLD_61 = 221, - KEY_WORLD_62 = 222, - KEY_WORLD_63 = 223, - KEY_WORLD_64 = 224, - KEY_WORLD_65 = 225, - KEY_WORLD_66 = 226, - KEY_WORLD_67 = 227, - KEY_WORLD_68 = 228, - KEY_WORLD_69 = 229, - KEY_WORLD_70 = 230, - KEY_WORLD_71 = 231, - KEY_WORLD_72 = 232, - KEY_WORLD_73 = 233, - KEY_WORLD_74 = 234, - KEY_WORLD_75 = 235, - KEY_WORLD_76 = 236, - KEY_WORLD_77 = 237, - KEY_WORLD_78 = 238, - KEY_WORLD_79 = 239, - KEY_WORLD_80 = 240, - KEY_WORLD_81 = 241, - KEY_WORLD_82 = 242, - KEY_WORLD_83 = 243, - KEY_WORLD_84 = 244, - KEY_WORLD_85 = 245, - KEY_WORLD_86 = 246, - KEY_WORLD_87 = 247, - KEY_WORLD_88 = 248, - KEY_WORLD_89 = 249, - KEY_WORLD_90 = 250, - KEY_WORLD_91 = 251, - KEY_WORLD_92 = 252, - KEY_WORLD_93 = 253, - KEY_WORLD_94 = 254, - KEY_WORLD_95 = 255, - KEY_KP0 = 256, - KEY_KP1 = 257, - KEY_KP2 = 258, - KEY_KP3 = 259, - KEY_KP4 = 260, - KEY_KP5 = 261, - KEY_KP6 = 262, - KEY_KP7 = 263, - KEY_KP8 = 264, - KEY_KP9 = 265, - KEY_KP_PERIOD = 266, - KEY_KP_DIVIDE = 267, - KEY_KP_MULTIPLY = 268, - KEY_KP_MINUS = 269, - KEY_KP_PLUS = 270, - KEY_KP_ENTER = 271, - KEY_KP_EQUALS = 272, - KEY_UP = 273, - KEY_DOWN = 274, - KEY_RIGHT = 275, - KEY_LEFT = 276, - KEY_INSERT = 277, - KEY_HOME = 278, - KEY_END = 279, - KEY_PAGEUP = 280, - KEY_PAGEDOWN = 281, - KEY_F1 = 282, - KEY_F2 = 283, - KEY_F3 = 284, - KEY_F4 = 285, - KEY_F5 = 286, - KEY_F6 = 287, - KEY_F7 = 288, - KEY_F8 = 289, - KEY_F9 = 290, - KEY_F10 = 291, - KEY_F11 = 292, - KEY_F12 = 293, - KEY_F13 = 294, - KEY_F14 = 295, - KEY_F15 = 296, - KEY_NUMLOCK = 300, - KEY_CAPSLOCK = 301, - KEY_SCROLLOCK = 302, - KEY_RSHIFT = 303, - KEY_LSHIFT = 304, - KEY_RCTRL = 305, - KEY_LCTRL = 306, - KEY_RALT = 307, - KEY_LALT = 308, - KEY_RMETA = 309, - KEY_LMETA = 310, - KEY_LSUPER = 311, - KEY_RSUPER = 312, - KEY_MODE = 313, - KEY_COMPOSE = 314, - KEY_HELP = 315, - KEY_PRINT = 316, - KEY_SYSREQ = 317, - KEY_BREAK = 318, - KEY_MENU = 319, - KEY_POWER = 320, - KEY_EURO = 321, - KEY_UNDO = 322, - KEY_MOUSE_1 = 323, - KEY_MOUSE_2 = 324, - KEY_MOUSE_3 = 325, - KEY_MOUSE_4 = 326, - KEY_MOUSE_5 = 327, - KEY_MOUSE_6 = 328, - KEY_MOUSE_7 = 329, - KEY_MOUSE_8 = 330, - KEY_MOUSE_WHEEL_UP = 331, - KEY_MOUSE_WHEEL_DOWN = 332, - KEY_MOUSE_9 = 333, + KEY_EQUALS = 46, + KEY_LEFTBRACKET = 47, + KEY_RIGHTBRACKET = 48, + KEY_BACKSLASH = 49, + KEY_NONUSHASH = 50, + KEY_SEMICOLON = 51, + KEY_APOSTROPHE = 52, + KEY_GRAVE = 53, + KEY_COMMA = 54, + KEY_PERIOD = 55, + KEY_SLASH = 56, + KEY_CAPSLOCK = 57, + KEY_F1 = 58, + KEY_F2 = 59, + KEY_F3 = 60, + KEY_F4 = 61, + KEY_F5 = 62, + KEY_F6 = 63, + KEY_F7 = 64, + KEY_F8 = 65, + KEY_F9 = 66, + KEY_F10 = 67, + KEY_F11 = 68, + KEY_F12 = 69, + KEY_PRINTSCREEN = 70, + KEY_SCROLLLOCK = 71, + KEY_PAUSE = 72, + KEY_INSERT = 73, + KEY_HOME = 74, + KEY_PAGEUP = 75, + KEY_DELETE = 76, + KEY_END = 77, + KEY_PAGEDOWN = 78, + KEY_RIGHT = 79, + KEY_LEFT = 80, + KEY_DOWN = 81, + KEY_UP = 82, + KEY_NUMLOCKCLEAR = 83, + KEY_KP_DIVIDE = 84, + KEY_KP_MULTIPLY = 85, + KEY_KP_MINUS = 86, + KEY_KP_PLUS = 87, + KEY_KP_ENTER = 88, + KEY_KP_1 = 89, + KEY_KP_2 = 90, + KEY_KP_3 = 91, + KEY_KP_4 = 92, + KEY_KP_5 = 93, + KEY_KP_6 = 94, + KEY_KP_7 = 95, + KEY_KP_8 = 96, + KEY_KP_9 = 97, + KEY_KP_0 = 98, + KEY_KP_PERIOD = 99, + KEY_NONUSBACKSLASH = 100, + KEY_APPLICATION = 101, + KEY_POWER = 102, + KEY_KP_EQUALS = 103, + KEY_F13 = 104, + KEY_F14 = 105, + KEY_F15 = 106, + KEY_F16 = 107, + KEY_F17 = 108, + KEY_F18 = 109, + KEY_F19 = 110, + KEY_F20 = 111, + KEY_F21 = 112, + KEY_F22 = 113, + KEY_F23 = 114, + KEY_F24 = 115, + KEY_EXECUTE = 116, + KEY_HELP = 117, + KEY_MENU = 118, + KEY_SELECT = 119, + KEY_STOP = 120, + KEY_AGAIN = 121, + KEY_UNDO = 122, + KEY_CUT = 123, + KEY_COPY = 124, + KEY_PASTE = 125, + KEY_FIND = 126, + KEY_MUTE = 127, + KEY_VOLUMEUP = 128, + KEY_VOLUMEDOWN = 129, + KEY_KP_COMMA = 133, + KEY_KP_EQUALSAS400 = 134, + KEY_INTERNATIONAL1 = 135, + KEY_INTERNATIONAL2 = 136, + KEY_INTERNATIONAL3 = 137, + KEY_INTERNATIONAL4 = 138, + KEY_INTERNATIONAL5 = 139, + KEY_INTERNATIONAL6 = 140, + KEY_INTERNATIONAL7 = 141, + KEY_INTERNATIONAL8 = 142, + KEY_INTERNATIONAL9 = 143, + KEY_LANG1 = 144, + KEY_LANG2 = 145, + KEY_LANG3 = 146, + KEY_LANG4 = 147, + KEY_LANG5 = 148, + KEY_LANG6 = 149, + KEY_LANG7 = 150, + KEY_LANG8 = 151, + KEY_LANG9 = 152, + KEY_ALTERASE = 153, + KEY_SYSREQ = 154, + KEY_CANCEL = 155, + KEY_CLEAR = 156, + KEY_PRIOR = 157, + KEY_RETURN2 = 158, + KEY_SEPARATOR = 159, + KEY_OUT = 160, + KEY_OPER = 161, + KEY_CLEARAGAIN = 162, + KEY_CRSEL = 163, + KEY_EXSEL = 164, + KEY_KP_00 = 176, + KEY_KP_000 = 177, + KEY_THOUSANDSSEPARATOR = 178, + KEY_DECIMALSEPARATOR = 179, + KEY_CURRENCYUNIT = 180, + KEY_CURRENCYSUBUNIT = 181, + KEY_KP_LEFTPAREN = 182, + KEY_KP_RIGHTPAREN = 183, + KEY_KP_LEFTBRACE = 184, + KEY_KP_RIGHTBRACE = 185, + KEY_KP_TAB = 186, + KEY_KP_BACKSPACE = 187, + KEY_KP_A = 188, + KEY_KP_B = 189, + KEY_KP_C = 190, + KEY_KP_D = 191, + KEY_KP_E = 192, + KEY_KP_F = 193, + KEY_KP_XOR = 194, + KEY_KP_POWER = 195, + KEY_KP_PERCENT = 196, + KEY_KP_LESS = 197, + KEY_KP_GREATER = 198, + KEY_KP_AMPERSAND = 199, + KEY_KP_DBLAMPERSAND = 200, + KEY_KP_VERTICALBAR = 201, + KEY_KP_DBLVERTICALBAR = 202, + KEY_KP_COLON = 203, + KEY_KP_HASH = 204, + KEY_KP_SPACE = 205, + KEY_KP_AT = 206, + KEY_KP_EXCLAM = 207, + KEY_KP_MEMSTORE = 208, + KEY_KP_MEMRECALL = 209, + KEY_KP_MEMCLEAR = 210, + KEY_KP_MEMADD = 211, + KEY_KP_MEMSUBTRACT = 212, + KEY_KP_MEMMULTIPLY = 213, + KEY_KP_MEMDIVIDE = 214, + KEY_KP_PLUSMINUS = 215, + KEY_KP_CLEAR = 216, + KEY_KP_CLEARENTRY = 217, + KEY_KP_BINARY = 218, + KEY_KP_OCTAL = 219, + KEY_KP_DECIMAL = 220, + KEY_KP_HEXADECIMAL = 221, + KEY_LCTRL = 224, + KEY_LSHIFT = 225, + KEY_LALT = 226, + KEY_LGUI = 227, + KEY_RCTRL = 228, + KEY_RSHIFT = 229, + KEY_RALT = 230, + KEY_RGUI = 231, + KEY_MODE = 257, + KEY_AUDIONEXT = 258, + KEY_AUDIOPREV = 259, + KEY_AUDIOSTOP = 260, + KEY_AUDIOPLAY = 261, + KEY_AUDIOMUTE = 262, + KEY_MEDIASELECT = 263, + KEY_WWW = 264, + KEY_MAIL = 265, + KEY_CALCULATOR = 266, + KEY_COMPUTER = 267, + KEY_AC_SEARCH = 268, + KEY_AC_HOME = 269, + KEY_AC_BACK = 270, + KEY_AC_FORWARD = 271, + KEY_AC_STOP = 272, + KEY_AC_REFRESH = 273, + KEY_AC_BOOKMARKS = 274, + KEY_BRIGHTNESSDOWN = 275, + KEY_BRIGHTNESSUP = 276, + KEY_DISPLAYSWITCH = 277, + KEY_KBDILLUMTOGGLE = 278, + KEY_KBDILLUMDOWN = 279, + KEY_KBDILLUMUP = 280, + KEY_EJECT = 281, + KEY_SLEEP = 282, + KEY_APP1 = 283, + KEY_APP2 = 284, + KEY_MOUSE_1 = 285, + KEY_MOUSE_2 = 286, + KEY_MOUSE_3 = 287, + KEY_MOUSE_4 = 288, + KEY_MOUSE_5 = 289, + KEY_MOUSE_6 = 290, + KEY_MOUSE_7 = 291, + KEY_MOUSE_8 = 292, + KEY_MOUSE_WHEEL_UP = 293, + KEY_MOUSE_WHEEL_DOWN = 294, + KEY_MOUSE_9 = 295, KEY_LAST, }; diff --git a/src/game/client/components/maplayers.cpp b/src/game/client/components/maplayers.cpp index f6ec74548..55a812337 100644 --- a/src/game/client/components/maplayers.cpp +++ b/src/game/client/components/maplayers.cpp @@ -283,7 +283,7 @@ void CMapLayers::OnRender() Render = true; } - if(Render && pLayer->m_Type == LAYERTYPE_TILES && Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown(KEY_KP0)) + if(Render && pLayer->m_Type == LAYERTYPE_TILES && Input()->KeyPressed(KEY_LCTRL) && Input()->KeyPressed(KEY_LSHIFT) && Input()->KeyDown(KEY_KP_0)) { CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer; CTile *pTiles = (CTile *)pLayers->Map()->GetData(pTMap->m_Data); diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 2e0284f28..99ebe369b 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -824,7 +824,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Bottom.HSplitTop(2.5f, 0, &TB_Bottom); // ctrl+o to open - if(Input()->KeyDown('o') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)) && m_Dialog == DIALOG_NONE) + if(Input()->KeyDown(KEY_O) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)) && m_Dialog == DIALOG_NONE) { if(HasUnsavedData()) { @@ -839,7 +839,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) } // ctrl+s to save - if(Input()->KeyDown('s') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)) && m_Dialog == DIALOG_NONE) + if(Input()->KeyDown(KEY_S) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)) && m_Dialog == DIALOG_NONE) { if(m_aFileName[0] && m_ValidSaveFilename) { @@ -858,7 +858,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); static int s_HqButton = 0; if(DoButton_Editor(&s_HqButton, "HD", m_ShowDetail, &Button, 0, "[ctrl+h] Toggle High Detail") || - (Input()->KeyDown('h') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) + (Input()->KeyDown(KEY_H) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) { m_ShowDetail = !m_ShowDetail; } @@ -869,7 +869,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(40.0f, &Button, &TB_Top); static int s_AnimateButton = 0; if(DoButton_Editor(&s_AnimateButton, "Anim", m_Animate, &Button, 0, "[ctrl+m] Toggle animation") || - (Input()->KeyDown('m') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) + (Input()->KeyDown(KEY_M) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) { m_AnimateStart = time_get(); m_Animate = !m_Animate; @@ -881,7 +881,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(40.0f, &Button, &TB_Top); static int s_ProofButton = 0; if(DoButton_Editor(&s_ProofButton, "Proof", m_ProofBorders, &Button, 0, "[ctrl+p] Toggles proof borders. These borders represent what a player maximum can see.") || - (Input()->KeyDown('p') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) + (Input()->KeyDown(KEY_P) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) { m_ProofBorders = !m_ProofBorders; } @@ -892,7 +892,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(40.0f, &Button, &TB_Top); static int s_TileInfoButton = 0; if(DoButton_Editor(&s_TileInfoButton, "Info", m_ShowTileInfo, &Button, 0, "[ctrl+i] Show tile informations") || - (Input()->KeyDown('i') && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) + (Input()->KeyDown(KEY_I) && (Input()->KeyPressed(KEY_LCTRL) || Input()->KeyPressed(KEY_RCTRL)))) { m_ShowTileInfo = !m_ShowTileInfo; m_ShowEnvelopePreview = SHOWENV_NONE; @@ -951,7 +951,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) // flip buttons TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); static int s_FlipXButton = 0; - if(DoButton_Ex(&s_FlipXButton, "X/X", Enabled, &Button, 0, "[N] Flip brush horizontal", CUI::CORNER_L) || Input()->KeyDown('n')) + if(DoButton_Ex(&s_FlipXButton, "X/X", Enabled, &Button, 0, "[N] Flip brush horizontal", CUI::CORNER_L) || Input()->KeyDown(KEY_N)) { for(int i = 0; i < m_Brush.m_lLayers.size(); i++) m_Brush.m_lLayers[i]->BrushFlipX(); @@ -959,7 +959,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); static int s_FlipyButton = 0; - if(DoButton_Ex(&s_FlipyButton, "Y/Y", Enabled, &Button, 0, "[M] Flip brush vertical", CUI::CORNER_R) || Input()->KeyDown('m')) + if(DoButton_Ex(&s_FlipyButton, "Y/Y", Enabled, &Button, 0, "[M] Flip brush vertical", CUI::CORNER_R) || Input()->KeyDown(KEY_M)) { for(int i = 0; i < m_Brush.m_lLayers.size(); i++) m_Brush.m_lLayers[i]->BrushFlipY(); @@ -984,7 +984,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(5.0f, &Button, &TB_Top); TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); static int s_CcwButton = 0; - if(DoButton_Ex(&s_CcwButton, "CCW", Enabled, &Button, 0, "[R] Rotates the brush counter clockwise", CUI::CORNER_L) || Input()->KeyDown('r')) + if(DoButton_Ex(&s_CcwButton, "CCW", Enabled, &Button, 0, "[R] Rotates the brush counter clockwise", CUI::CORNER_L) || Input()->KeyDown(KEY_R)) { for(int i = 0; i < m_Brush.m_lLayers.size(); i++) m_Brush.m_lLayers[i]->BrushRotate(-s_RotationAmount/360.0f*pi*2); @@ -992,7 +992,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); static int s_CwButton = 0; - if(DoButton_Ex(&s_CwButton, "CW", Enabled, &Button, 0, "[T] Rotates the brush clockwise", CUI::CORNER_R) || Input()->KeyDown('t')) + if(DoButton_Ex(&s_CwButton, "CW", Enabled, &Button, 0, "[T] Rotates the brush clockwise", CUI::CORNER_R) || Input()->KeyDown(KEY_T)) { for(int i = 0; i < m_Brush.m_lLayers.size(); i++) m_Brush.m_lLayers[i]->BrushRotate(s_RotationAmount/360.0f*pi*2);