1 // Emacs style mode select -*- C++ -*- 2 //----------------------------------------------------------------------------- 3 // 4 // $Id: keys.h 1466 2019-10-01 02:37:37Z wesleyjohnson $ 5 // 6 // Copyright (C) 1998-2010 by DooM Legacy Team. 7 // 8 // This program is free software; you can redistribute it and/or 9 // modify it under the terms of the GNU General Public License 10 // as published by the Free Software Foundation; either version 2 11 // of the License, or (at your option) any later version. 12 // 13 // This program is distributed in the hope that it will be useful, 14 // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 // GNU General Public License for more details. 17 // 18 //----------------------------------------------------------------------------- 19 20 #ifndef KEYS_H 21 #define KEYS_H 22 23 enum aux_controller_e 24 { 25 MOUSEBUTTONS = 8, 26 MAXJOYSTICKS = 4, // "Only" 4 joysticks per machine. 27 JOYBUTTONS = 16, // Max number of buttons for a joystick. 28 JOYHATBUTTONS = 4, // Four hat directions. 29 XBOXTRIGGERS = 2, // Two triggers on Xbox-like controllers. 30 }; 31 32 /// These are the key event codes posted by the keyboard handler, and closely match the SDLKey symbols. 33 /// 0-127 are ASCII codes. The codes KEY_NUMKB- are reserved for virtual keys. 34 enum key_input_e 35 { 36 KEY_NULL = 0, // null key, triggers nothing 37 38 KEY_BACKSPACE = 8, 39 KEY_TAB = 9, 40 KEY_ENTER = 13, 41 KEY_PAUSE = 19, 42 KEY_ESCAPE = 27, 43 KEY_SPACE = 32, 44 45 // numbers 46 // big letters 47 KEY_BACKQUOTE = 96, 48 KEY_CONSOLE = KEY_BACKQUOTE, 49 // small letters 50 KEY_DELETE = 127, // ascii ends here 51 52 // SDL international keys 160-255 53 54 // keypad 55 KEY_KEYPAD0 = 256, 56 KEY_KEYPAD1, 57 KEY_KEYPAD2, 58 KEY_KEYPAD3, 59 KEY_KEYPAD4, 60 KEY_KEYPAD5, 61 KEY_KEYPAD6, 62 KEY_KEYPAD7, 63 KEY_KEYPAD8, 64 KEY_KEYPAD9, 65 KEY_KPADPERIOD, 66 KEY_KPADSLASH, 67 KEY_KPADMULT, 68 KEY_MINUSPAD, 69 KEY_PLUSPAD, 70 KEY_KPADENTER, 71 KEY_KPADEQUALS, 72 // arrows + home/end pad 73 KEY_UPARROW, 74 KEY_DOWNARROW, 75 KEY_RIGHTARROW, 76 KEY_LEFTARROW, 77 KEY_INS, 78 KEY_HOME, 79 KEY_END, 80 KEY_PGUP, 81 KEY_PGDN, 82 // function keys 83 KEY_F1, 84 KEY_F2, 85 KEY_F3, 86 KEY_F4, 87 KEY_F5, 88 KEY_F6, 89 KEY_F7, 90 KEY_F8, 91 KEY_F9, 92 KEY_F10, 93 KEY_F11, 94 KEY_F12, 95 96 // modifier keys 97 KEY_NUMLOCK = 300, 98 KEY_CAPSLOCK, 99 KEY_SCROLLLOCK, 100 KEY_RSHIFT, 101 KEY_LSHIFT, 102 KEY_RCTRL, 103 KEY_LCTRL, 104 KEY_RALT, 105 KEY_LALT, 106 KEY_unused1, 107 KEY_unused2, 108 KEY_LWIN, 109 KEY_RWIN, 110 KEY_MODE, // altgr 111 KEY_unused3, 112 113 // other function keys 114 KEY_HELP = 315, 115 KEY_PRINT, 116 KEY_SYSREQ, 117 KEY_BREAK, 118 KEY_MENU, 119 120 KEY_NUMKB, // all real keyboard codes are under this value 121 122 // mouse and joystick buttons are handled as 'virtual' keys 123 KEY_MOUSE1 = KEY_NUMKB, // mouse buttons, including the wheel 124 KEY_MOUSEWHEELUP = KEY_MOUSE1 + 3, // usually 125 KEY_MOUSEWHEELDOWN, 126 KEY_MOUSE1DBL = KEY_MOUSE1 + MOUSEBUTTONS, // double clicks 127 128 KEY_MOUSE2 = KEY_MOUSE1DBL + MOUSEBUTTONS, // second mouse buttons 129 KEY_MOUSE2WHEELUP = KEY_MOUSE2 + 3, 130 KEY_MOUSE2WHEELDOWN, 131 KEY_MOUSE2DBL = KEY_MOUSE2 + MOUSEBUTTONS, 132 133 KEY_JOY0BUT0 = KEY_MOUSE2DBL + MOUSEBUTTONS, // joystick buttons 134 KEY_JOY0BUT1, 135 KEY_JOY0BUT2, 136 KEY_JOY0BUT3, 137 KEY_JOY0BUT4, 138 KEY_JOY0BUT5, 139 KEY_JOY0BUT6, 140 KEY_JOY0BUT7, 141 KEY_JOY0BUT8, 142 KEY_JOY0BUT9, 143 KEY_JOY0BUT10, 144 KEY_JOY0BUT11, 145 KEY_JOY0BUT12, 146 KEY_JOY0BUT13, 147 KEY_JOY0BUT14, 148 KEY_JOY0BUT15, 149 150 KEY_JOY1BUT0, 151 KEY_JOY1BUT1, 152 KEY_JOY1BUT2, 153 KEY_JOY1BUT3, 154 KEY_JOY1BUT4, 155 KEY_JOY1BUT5, 156 KEY_JOY1BUT6, 157 KEY_JOY1BUT7, 158 KEY_JOY1BUT8, 159 KEY_JOY1BUT9, 160 KEY_JOY1BUT10, 161 KEY_JOY1BUT11, 162 KEY_JOY1BUT12, 163 KEY_JOY1BUT13, 164 KEY_JOY1BUT14, 165 KEY_JOY1BUT15, 166 167 KEY_JOY2BUT0, 168 KEY_JOY2BUT1, 169 KEY_JOY2BUT2, 170 KEY_JOY2BUT3, 171 KEY_JOY2BUT4, 172 KEY_JOY2BUT5, 173 KEY_JOY2BUT6, 174 KEY_JOY2BUT7, 175 KEY_JOY2BUT8, 176 KEY_JOY2BUT9, 177 KEY_JOY2BUT10, 178 KEY_JOY2BUT11, 179 KEY_JOY2BUT12, 180 KEY_JOY2BUT13, 181 KEY_JOY2BUT14, 182 KEY_JOY2BUT15, 183 184 KEY_JOY3BUT0, 185 KEY_JOY3BUT1, 186 KEY_JOY3BUT2, 187 KEY_JOY3BUT3, 188 KEY_JOY3BUT4, 189 KEY_JOY3BUT5, 190 KEY_JOY3BUT6, 191 KEY_JOY3BUT7, 192 KEY_JOY3BUT8, 193 KEY_JOY3BUT9, 194 KEY_JOY3BUT10, 195 KEY_JOY3BUT11, 196 KEY_JOY3BUT12, 197 KEY_JOY3BUT13, 198 KEY_JOY3BUT14, 199 KEY_JOY3BUT15, 200 KEY_JOYLAST = KEY_JOY3BUT15, 201 202 KEY_JOY0HATUP, 203 KEY_JOY0HATRIGHT, 204 KEY_JOY0HATDOWN, 205 KEY_JOY0HATLEFT, 206 207 KEY_JOY1HATUP, 208 KEY_JOY1HATRIGHT, 209 KEY_JOY1HATDOWN, 210 KEY_JOY1HATLEFT, 211 212 KEY_JOY2HATUP, 213 KEY_JOY2HATRIGHT, 214 KEY_JOY2HATDOWN, 215 KEY_JOY2HATLEFT, 216 217 KEY_JOY3HATUP, 218 KEY_JOY3HATRIGHT, 219 KEY_JOY3HATDOWN, 220 KEY_JOY3HATLEFT, 221 222 KEY_JOY0LEFTTRIGGER, 223 KEY_JOY0RIGHTTRIGGER, 224 225 KEY_JOY1LEFTTRIGGER, 226 KEY_JOY1RIGHTTRIGGER, 227 228 KEY_JOY2LEFTTRIGGER, 229 KEY_JOY2RIGHTTRIGGER, 230 231 KEY_JOY3LEFTTRIGGER, 232 KEY_JOY3RIGHTTRIGGER, 233 234 #ifdef JOY_BUTTONS_DOUBLE 235 // duplicate all joy, all buttons, KEY_JOY0BUT0 .. KEY_JOY3BUT15 236 KEY_JOY0BUT0DBL, 237 KEY_JOY1BUT0DBL = KEY_JOY0BUT0DBL + JOYBUTTONS, 238 KEY_JOY2BUT0DBL = KEY_JOY0BUT0DBL + JOYBUTTONS, 239 KEY_JOY3BUT0DBL = KEY_JOY0BUT0DBL + JOYBUTTONS, 240 KEY_JOYLASTDBL = KEY_JOY0BUT0DBL + JOYBUTTONS - 1, 241 #endif 242 243 // number of total 'button' inputs, includes keyboard keys, plus virtual 244 // keys (mousebuttons and joybuttons become keys) 245 NUMINPUTS 246 }; 247 248 #endif 249