1 // Copyright Ferdinand Majerech 2014. 2 // Distributed under the Boost Software License, Version 1.0. 3 // (See accompanying file LICENSE_1_0.txt or copy at 4 // http://www.boost.org/LICENSE_1_0.txt) 5 6 7 /// A type-safe key code enum. 8 module platform.key; 9 10 11 import derelict.sdl2.sdl; 12 13 14 /** A type-safe key code enum. 15 * 16 * Enumerates keycodes (e.g. Key.Y refers to where Y is in the current keyboard layout), 17 * not scancodes (where Y would refer to a physical key where Y can be found on a 18 * US QWERTY keyboard). Scancodes are unsafe because keyboards have various keys and 19 * some platforms (e.g. Solaris) report completely different scancodes than others. 20 */ 21 enum Key: SDL_Keycode 22 { 23 Unknown = SDLK_UNKNOWN, 24 Return = SDLK_RETURN, 25 Escape = SDLK_ESCAPE, 26 Backspace = SDLK_BACKSPACE, 27 Tab = SDLK_TAB, 28 Space = SDLK_SPACE, 29 Exclaim = SDLK_EXCLAIM, 30 QuoteDbl = SDLK_QUOTEDBL, 31 Hash = SDLK_HASH, 32 Percent = SDLK_PERCENT, 33 Dollar = SDLK_DOLLAR, 34 Ampersand = SDLK_AMPERSAND, 35 Quote = SDLK_QUOTE, 36 Leftparen = SDLK_LEFTPAREN, 37 Rightparen = SDLK_RIGHTPAREN, 38 Asterisk = SDLK_ASTERISK, 39 Plus = SDLK_PLUS, 40 Comma = SDLK_COMMA, 41 Minus = SDLK_MINUS, 42 Period = SDLK_PERIOD, 43 Slash = SDLK_SLASH, 44 Zero = SDLK_0, 45 One = SDLK_1, 46 Two = SDLK_2, 47 Three = SDLK_3, 48 Four = SDLK_4, 49 Five = SDLK_5, 50 Six = SDLK_6, 51 Seven = SDLK_7, 52 Eight = SDLK_8, 53 Nine = SDLK_9, 54 KP_Binary = SDLK_KP_BINARY, 55 Colon = SDLK_COLON, 56 Semicolon = SDLK_SEMICOLON, 57 Less = SDLK_LESS, 58 Equals = SDLK_EQUALS, 59 Greater = SDLK_GREATER, 60 Question = SDLK_QUESTION, 61 At = SDLK_AT, 62 63 LeftBracket = SDLK_LEFTBRACKET, 64 Backslash = SDLK_BACKSLASH, 65 RightBracket = SDLK_RIGHTBRACKET, 66 Caret = SDLK_CARET, 67 Underscore = SDLK_UNDERSCORE, 68 Backquote = SDLK_BACKQUOTE, 69 A = SDLK_a, 70 B = SDLK_b, 71 C = SDLK_c, 72 D = SDLK_d, 73 E = SDLK_e, 74 F = SDLK_f, 75 G = SDLK_g, 76 H = SDLK_h, 77 I = SDLK_i, 78 J = SDLK_j, 79 K = SDLK_k, 80 L = SDLK_l, 81 M = SDLK_m, 82 N = SDLK_n, 83 O = SDLK_o, 84 P = SDLK_p, 85 Q = SDLK_q, 86 R = SDLK_r, 87 S = SDLK_s, 88 T = SDLK_t, 89 U = SDLK_u, 90 V = SDLK_v, 91 W = SDLK_w, 92 X = SDLK_x, 93 Y = SDLK_y, 94 Z = SDLK_z, 95 96 CapsLock = SDLK_CAPSLOCK, 97 98 F1 = SDLK_F1, 99 F2 = SDLK_F2, 100 F3 = SDLK_F3, 101 F4 = SDLK_F4, 102 F5 = SDLK_F5, 103 F6 = SDLK_F6, 104 F7 = SDLK_F7, 105 F8 = SDLK_F8, 106 F9 = SDLK_F9, 107 F10 = SDLK_F10, 108 F11 = SDLK_F11, 109 F12 = SDLK_F12, 110 111 PrintScreen = SDLK_PRINTSCREEN, 112 ScrollLock = SDLK_SCROLLLOCK, 113 Pause = SDLK_PAUSE, 114 Insert = SDLK_INSERT, 115 Home = SDLK_HOME, 116 PageUp = SDLK_PAGEUP, 117 Delete = SDLK_DELETE, 118 End = SDLK_END, 119 PageDown = SDLK_PAGEDOWN, 120 Right = SDLK_RIGHT, 121 Left = SDLK_LEFT, 122 Down = SDLK_DOWN, 123 Up = SDLK_UP, 124 125 NumLockClear = SDLK_NUMLOCKCLEAR, 126 KP_Divide = SDLK_KP_DIVIDE, 127 KP_Multiply = SDLK_KP_MULTIPLY, 128 KP_Minus = SDLK_KP_MINUS, 129 KP_Plus = SDLK_KP_PLUS, 130 KP_Enter = SDLK_KP_ENTER, 131 KP_1 = SDLK_KP_1, 132 KP_2 = SDLK_KP_2, 133 KP_3 = SDLK_KP_3, 134 KP_4 = SDLK_KP_4, 135 KP_5 = SDLK_KP_5, 136 KP_6 = SDLK_KP_6, 137 KP_7 = SDLK_KP_7, 138 KP_8 = SDLK_KP_8, 139 KP_9 = SDLK_KP_9, 140 KP_0 = SDLK_KP_0, 141 KP_Period = SDLK_KP_PERIOD, 142 143 Application = SDLK_APPLICATION, 144 Power = SDLK_POWER, 145 KP_Equals = SDLK_KP_EQUALS, 146 F13 = SDLK_F13, 147 F14 = SDLK_F14, 148 F15 = SDLK_F15, 149 F16 = SDLK_F16, 150 F17 = SDLK_F17, 151 F18 = SDLK_F18, 152 F19 = SDLK_F19, 153 F20 = SDLK_F20, 154 F21 = SDLK_F21, 155 F22 = SDLK_F22, 156 F23 = SDLK_F23, 157 F24 = SDLK_F24, 158 Execute = SDLK_EXECUTE, 159 Help = SDLK_HELP, 160 Menu = SDLK_MENU, 161 Select = SDLK_SELECT, 162 Stop = SDLK_STOP, 163 Again = SDLK_AGAIN, 164 Undo = SDLK_UNDO, 165 Cut = SDLK_CUT, 166 Copy = SDLK_COPY, 167 Paste = SDLK_PASTE, 168 Find = SDLK_FIND, 169 Mute = SDLK_MUTE, 170 VolumeUp = SDLK_VOLUMEUP, 171 VolumeDown = SDLK_VOLUMEDOWN, 172 KP_Comma = SDLK_KP_COMMA, 173 KP_EqualsAS400 = SDLK_KP_EQUALSAS400, 174 175 AltErase = SDLK_ALTERASE, 176 SysReq = SDLK_SYSREQ, 177 Cancel = SDLK_CANCEL, 178 Clear = SDLK_CLEAR, 179 Prior = SDLK_PRIOR, 180 Return2 = SDLK_RETURN2, 181 Separator = SDLK_SEPARATOR, 182 Out = SDLK_OUT, 183 Oper = SDLK_OPER, 184 ClearAgain = SDLK_CLEARAGAIN, 185 CrSel = SDLK_CRSEL, 186 ExSel = SDLK_EXSEL, 187 188 KP_00 = SDLK_KP_00, 189 KP_000 = SDLK_KP_000, 190 ThousandsSeparator = SDLK_THOUSANDSSEPARATOR, 191 DecimalSeparator = SDLK_DECIMALSEPARATOR, 192 CurrencyUnit = SDLK_CURRENCYUNIT, 193 CurrencySubunit = SDLK_CURRENCYSUBUNIT, 194 KP_LeftParen = SDLK_KP_LEFTPAREN, 195 KP_RightParen = SDLK_KP_RIGHTPAREN, 196 KP_LeftBrace = SDLK_KP_LEFTBRACE, 197 KP_RightBrace = SDLK_KP_RIGHTBRACE, 198 KP_Tab = SDLK_KP_TAB, 199 KP_Backspace = SDLK_KP_BACKSPACE, 200 KP_A = SDLK_KP_A, 201 KP_B = SDLK_KP_B, 202 KP_C = SDLK_KP_C, 203 KP_D = SDLK_KP_D, 204 KP_E = SDLK_KP_E, 205 KP_F = SDLK_KP_F, 206 SDLK_KP_XOR, 207 208 KP_Power = SDLK_KP_POWER, 209 KP_Percent = SDLK_KP_PERCENT, 210 KP_Less = SDLK_KP_LESS, 211 KP_Greater = SDLK_KP_GREATER, 212 KP_Ampersand = SDLK_KP_AMPERSAND, 213 KP_DblAmpersand = SDLK_KP_DBLAMPERSAND, 214 KP_VerticalBar = SDLK_KP_VERTICALBAR, 215 KP_DblVerticalBar = SDLK_KP_DBLVERTICALBAR, 216 KP_Colon = SDLK_KP_COLON, 217 KP_Hash = SDLK_KP_HASH, 218 KP_Space = SDLK_KP_SPACE, 219 KP_At = SDLK_KP_AT, 220 KP_Exclam = SDLK_KP_EXCLAM, 221 KP_MemStore = SDLK_KP_MEMSTORE, 222 KP_MemRecall = SDLK_KP_MEMRECALL, 223 KP_MemClear = SDLK_KP_MEMCLEAR, 224 KP_MemAdd = SDLK_KP_MEMADD, 225 KP_MemSubtract = SDLK_KP_MEMSUBTRACT, 226 KP_MemMultiply = SDLK_KP_MEMMULTIPLY, 227 KP_MemDivide = SDLK_KP_MEMDIVIDE, 228 KP_Plusminus = SDLK_KP_PLUSMINUS, 229 KP_Clear = SDLK_KP_CLEAR, 230 KP_ClearEntry = SDLK_KP_CLEARENTRY, 231 KP_Octal = SDLK_KP_OCTAL, 232 KP_Decimal = SDLK_KP_DECIMAL, 233 KP_Hexadecimal = SDLK_KP_HEXADECIMAL, 234 235 LCtrl = SDLK_LCTRL, 236 LShift = SDLK_LSHIFT, 237 LAlt = SDLK_LALT, 238 LGui = SDLK_LGUI, 239 RCtrl = SDLK_RCTRL, 240 RShift = SDLK_RSHIFT, 241 RAlt = SDLK_RALT, 242 RGui = SDLK_RGUI, 243 244 Mode = SDLK_MODE, 245 246 AudioNext = SDLK_AUDIONEXT, 247 AudioStop = SDLK_AUDIOSTOP, 248 AudioPrev = SDLK_AUDIOPREV, 249 AudioPlay = SDLK_AUDIOPLAY, 250 AudioMute = SDLK_AUDIOMUTE, 251 MediaSelect = SDLK_MEDIASELECT, 252 WWW = SDLK_WWW, 253 Mail = SDLK_MAIL, 254 Calculator = SDLK_CALCULATOR, 255 Computer = SDLK_COMPUTER, 256 AC_Search = SDLK_AC_SEARCH, 257 AC_Home = SDLK_AC_HOME, 258 AC_Back = SDLK_AC_BACK, 259 AC_Forward = SDLK_AC_FORWARD, 260 AC_Stop = SDLK_AC_STOP, 261 AC_Refresh = SDLK_AC_REFRESH, 262 AC_Bookmarks = SDLK_AC_BOOKMARKS, 263 264 BrightnessDown = SDLK_BRIGHTNESSDOWN, 265 BrightnessUp = SDLK_BRIGHTNESSUP, 266 DisplaySwitch = SDLK_DISPLAYSWITCH, 267 KBDillumToggle = SDLK_KBDILLUMTOGGLE, 268 KBDillumDown = SDLK_KBDILLUMDOWN, 269 KBDillumUp = SDLK_KBDILLUMUP, 270 Eject = SDLK_EJECT, 271 Sleep = SDLK_SLEEP 272 }