Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
272 lines (266 sloc) 7.18 KB
/************************************************************************************
* * The MIT License (MIT)
**
** Copyright (c) 2015-2016 Serg "EXL" Koles
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and associated documentation files (the "Software"), to deal
** in the Software without restriction, including without limitation the rights
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
** copies of the Software, and to permit persons to whom the Software is
** furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in all
** copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
** SOFTWARE.
************************************************************************************/
#ifndef SDL2KEYHELPER_H
#define SDL2KEYHELPER_H
// Old Scancodes from SDL 1.2
typedef enum {
OLDK_UNKNOWN = 0,
OLDK_FIRST = 0,
OLDK_BACKSPACE = 8,
OLDK_TAB = 9,
OLDK_CLEAR = 12,
OLDK_RETURN = 13,
OLDK_PAUSE = 19,
OLDK_ESCAPE = 27,
OLDK_SPACE = 32,
OLDK_EXCLAIM = 33,
OLDK_QUOTEDBL = 34,
OLDK_HASH = 35,
OLDK_DOLLAR = 36,
OLDK_AMPERSAND = 38,
OLDK_QUOTE = 39,
OLDK_LEFTPAREN = 40,
OLDK_RIGHTPAREN = 41,
OLDK_ASTERISK = 42,
OLDK_PLUS = 43,
OLDK_COMMA = 44,
OLDK_MINUS = 45,
OLDK_PERIOD = 46,
OLDK_SLASH = 47,
OLDK_0 = 48,
OLDK_1 = 49,
OLDK_2 = 50,
OLDK_3 = 51,
OLDK_4 = 52,
OLDK_5 = 53,
OLDK_6 = 54,
OLDK_7 = 55,
OLDK_8 = 56,
OLDK_9 = 57,
OLDK_COLON = 58,
OLDK_SEMICOLON = 59,
OLDK_LESS = 60,
OLDK_EQUALS = 61,
OLDK_GREATER = 62,
OLDK_QUESTION = 63,
OLDK_AT = 64,
OLDK_LEFTBRACKET = 91,
OLDK_BACKSLASH = 92,
OLDK_RIGHTBRACKET = 93,
OLDK_CARET = 94,
OLDK_UNDERSCORE = 95,
OLDK_BACKQUOTE = 96,
OLDK_a = 97,
OLDK_b = 98,
OLDK_c = 99,
OLDK_d = 100,
OLDK_e = 101,
OLDK_f = 102,
OLDK_g = 103,
OLDK_h = 104,
OLDK_i = 105,
OLDK_j = 106,
OLDK_k = 107,
OLDK_l = 108,
OLDK_m = 109,
OLDK_n = 110,
OLDK_o = 111,
OLDK_p = 112,
OLDK_q = 113,
OLDK_r = 114,
OLDK_s = 115,
OLDK_t = 116,
OLDK_u = 117,
OLDK_v = 118,
OLDK_w = 119,
OLDK_x = 120,
OLDK_y = 121,
OLDK_z = 122,
OLDK_DELETE = 127,
OLDK_WORLD_0 = 160, /* 0xA0 */
OLDK_WORLD_1 = 161,
OLDK_WORLD_2 = 162,
OLDK_WORLD_3 = 163,
OLDK_WORLD_4 = 164,
OLDK_WORLD_5 = 165,
OLDK_WORLD_6 = 166,
OLDK_WORLD_7 = 167,
OLDK_WORLD_8 = 168,
OLDK_WORLD_9 = 169,
OLDK_WORLD_10 = 170,
OLDK_WORLD_11 = 171,
OLDK_WORLD_12 = 172,
OLDK_WORLD_13 = 173,
OLDK_WORLD_14 = 174,
OLDK_WORLD_15 = 175,
OLDK_WORLD_16 = 176,
OLDK_WORLD_17 = 177,
OLDK_WORLD_18 = 178,
OLDK_WORLD_19 = 179,
OLDK_WORLD_20 = 180,
OLDK_WORLD_21 = 181,
OLDK_WORLD_22 = 182,
OLDK_WORLD_23 = 183,
OLDK_WORLD_24 = 184,
OLDK_WORLD_25 = 185,
OLDK_WORLD_26 = 186,
OLDK_WORLD_27 = 187,
OLDK_WORLD_28 = 188,
OLDK_WORLD_29 = 189,
OLDK_WORLD_30 = 190,
OLDK_WORLD_31 = 191,
OLDK_WORLD_32 = 192,
OLDK_WORLD_33 = 193,
OLDK_WORLD_34 = 194,
OLDK_WORLD_35 = 195,
OLDK_WORLD_36 = 196,
OLDK_WORLD_37 = 197,
OLDK_WORLD_38 = 198,
OLDK_WORLD_39 = 199,
OLDK_WORLD_40 = 200,
OLDK_WORLD_41 = 201,
OLDK_WORLD_42 = 202,
OLDK_WORLD_43 = 203,
OLDK_WORLD_44 = 204,
OLDK_WORLD_45 = 205,
OLDK_WORLD_46 = 206,
OLDK_WORLD_47 = 207,
OLDK_WORLD_48 = 208,
OLDK_WORLD_49 = 209,
OLDK_WORLD_50 = 210,
OLDK_WORLD_51 = 211,
OLDK_WORLD_52 = 212,
OLDK_WORLD_53 = 213,
OLDK_WORLD_54 = 214,
OLDK_WORLD_55 = 215,
OLDK_WORLD_56 = 216,
OLDK_WORLD_57 = 217,
OLDK_WORLD_58 = 218,
OLDK_WORLD_59 = 219,
OLDK_WORLD_60 = 220,
OLDK_WORLD_61 = 221,
OLDK_WORLD_62 = 222,
OLDK_WORLD_63 = 223,
OLDK_WORLD_64 = 224,
OLDK_WORLD_65 = 225,
OLDK_WORLD_66 = 226,
OLDK_WORLD_67 = 227,
OLDK_WORLD_68 = 228,
OLDK_WORLD_69 = 229,
OLDK_WORLD_70 = 230,
OLDK_WORLD_71 = 231,
OLDK_WORLD_72 = 232,
OLDK_WORLD_73 = 233,
OLDK_WORLD_74 = 234,
OLDK_WORLD_75 = 235,
OLDK_WORLD_76 = 236,
OLDK_WORLD_77 = 237,
OLDK_WORLD_78 = 238,
OLDK_WORLD_79 = 239,
OLDK_WORLD_80 = 240,
OLDK_WORLD_81 = 241,
OLDK_WORLD_82 = 242,
OLDK_WORLD_83 = 243,
OLDK_WORLD_84 = 244,
OLDK_WORLD_85 = 245,
OLDK_WORLD_86 = 246,
OLDK_WORLD_87 = 247,
OLDK_WORLD_88 = 248,
OLDK_WORLD_89 = 249,
OLDK_WORLD_90 = 250,
OLDK_WORLD_91 = 251,
OLDK_WORLD_92 = 252,
OLDK_WORLD_93 = 253,
OLDK_WORLD_94 = 254,
OLDK_WORLD_95 = 255,
OLDK_KP0 = 256,
OLDK_KP1 = 257,
OLDK_KP2 = 258,
OLDK_KP3 = 259,
OLDK_KP4 = 260,
OLDK_KP5 = 261,
OLDK_KP6 = 262,
OLDK_KP7 = 263,
OLDK_KP8 = 264,
OLDK_KP9 = 265,
OLDK_KP_PERIOD = 266,
OLDK_KP_DIVIDE = 267,
OLDK_KP_MULTIPLY = 268,
OLDK_KP_MINUS = 269,
OLDK_KP_PLUS = 270,
OLDK_KP_ENTER = 271,
OLDK_KP_EQUALS = 272,
OLDK_UP = 273,
OLDK_DOWN = 274,
OLDK_RIGHT = 275,
OLDK_LEFT = 276,
OLDK_INSERT = 277,
OLDK_HOME = 278,
OLDK_END = 279,
OLDK_PAGEUP = 280,
OLDK_PAGEDOWN = 281,
OLDK_F1 = 282,
OLDK_F2 = 283,
OLDK_F3 = 284,
OLDK_F4 = 285,
OLDK_F5 = 286,
OLDK_F6 = 287,
OLDK_F7 = 288,
OLDK_F8 = 289,
OLDK_F9 = 290,
OLDK_F10 = 291,
OLDK_F11 = 292,
OLDK_F12 = 293,
OLDK_F13 = 294,
OLDK_F14 = 295,
OLDK_F15 = 296,
OLDK_NUMLOCK = 300,
OLDK_CAPSLOCK = 301,
OLDK_SCROLLOCK = 302,
OLDK_RSHIFT = 303,
OLDK_LSHIFT = 304,
OLDK_RCTRL = 305,
OLDK_LCTRL = 306,
OLDK_RALT = 307,
OLDK_LALT = 308,
OLDK_RMETA = 309,
OLDK_LMETA = 310,
OLDK_LSUPER = 311, /**< Left "Windows" key */
OLDK_RSUPER = 312, /**< Right "Windows" key */
OLDK_MODE = 313, /**< "Alt Gr" key */
OLDK_COMPOSE = 314, /**< Multi-key compose key */
OLDK_HELP = 315,
OLDK_PRINT = 316,
OLDK_SYSREQ = 317,
OLDK_BREAK = 318,
OLDK_MENU = 319,
OLDK_POWER = 320, /**< Power Macintosh power key */
OLDK_EURO = 321, /**< Some european keyboards */
OLDK_UNDO = 322, /**< Atari keyboard has Undo */
OLDK_LAST
} OLDKey;
int getOldAsciiKeyCode(int newKeyCode);
int getUpperChar(int smallCharKeyCode);
int patchAndroidKeysDpadSDL2(int keyCode);
#endif // SDL2KEYHELPER_H