Skip to content

Commit

Permalink
Change key codes from macro to enum
Browse files Browse the repository at this point in the history
to make them easier to inspect in VS debugger
  • Loading branch information
andrei-drexler committed Dec 29, 2023
1 parent 95063d6 commit 55d5cfb
Showing 1 changed file with 113 additions and 110 deletions.
223 changes: 113 additions & 110 deletions Quake/keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,137 +26,140 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// these are the key numbers that should be passed to Key_Event
//
#define K_TAB 9
#define K_ENTER 13
#define K_ESCAPE 27
#define K_SPACE 32
typedef enum keycode_t
{
K_TAB = 9,
K_ENTER = 13,
K_ESCAPE = 27,
K_SPACE = 32,

// normal keys should be passed as lowercased ascii

#define K_BACKSPACE 127
#define K_UPARROW 128
#define K_DOWNARROW 129
#define K_LEFTARROW 130
#define K_RIGHTARROW 131

#define K_ALT 132
#define K_CTRL 133
#define K_SHIFT 134
#define K_F1 135
#define K_F2 136
#define K_F3 137
#define K_F4 138
#define K_F5 139
#define K_F6 140
#define K_F7 141
#define K_F8 142
#define K_F9 143
#define K_F10 144
#define K_F11 145
#define K_F12 146
#define K_INS 147
#define K_DEL 148
#define K_PGDN 149
#define K_PGUP 150
#define K_HOME 151
#define K_END 152

#define K_KP_NUMLOCK 153
#define K_KP_SLASH 154
#define K_KP_STAR 155
#define K_KP_MINUS 156
#define K_KP_HOME 157
#define K_KP_UPARROW 158
#define K_KP_PGUP 159
#define K_KP_PLUS 160
#define K_KP_LEFTARROW 161
#define K_KP_5 162
#define K_KP_RIGHTARROW 163
#define K_KP_END 164
#define K_KP_DOWNARROW 165
#define K_KP_PGDN 166
#define K_KP_ENTER 167
#define K_KP_INS 168
#define K_KP_DEL 169

#define K_COMMAND 170

#define K_CAPSLOCK 171
#define K_SCROLLLOCK 172
#define K_PRINTSCREEN 173

#define K_PAUSE 255
K_BACKSPACE = 127,
K_UPARROW = 128,
K_DOWNARROW = 129,
K_LEFTARROW = 130,
K_RIGHTARROW = 131,

K_ALT = 132,
K_CTRL = 133,
K_SHIFT = 134,
K_F1 = 135,
K_F2 = 136,
K_F3 = 137,
K_F4 = 138,
K_F5 = 139,
K_F6 = 140,
K_F7 = 141,
K_F8 = 142,
K_F9 = 143,
K_F10 = 144,
K_F11 = 145,
K_F12 = 146,
K_INS = 147,
K_DEL = 148,
K_PGDN = 149,
K_PGUP = 150,
K_HOME = 151,
K_END = 152,

K_KP_NUMLOCK = 153,
K_KP_SLASH = 154,
K_KP_STAR = 155,
K_KP_MINUS = 156,
K_KP_HOME = 157,
K_KP_UPARROW = 158,
K_KP_PGUP = 159,
K_KP_PLUS = 160,
K_KP_LEFTARROW = 161,
K_KP_5 = 162,
K_KP_RIGHTARROW = 163,
K_KP_END = 164,
K_KP_DOWNARROW = 165,
K_KP_PGDN = 166,
K_KP_ENTER = 167,
K_KP_INS = 168,
K_KP_DEL = 169,

K_COMMAND = 170,

K_CAPSLOCK = 171,
K_SCROLLLOCK = 172,
K_PRINTSCREEN = 173,

K_PAUSE = 255,

//
// mouse buttons generate virtual keys
//
#define K_MOUSE1 200
#define K_MOUSE2 201
#define K_MOUSE3 202
K_MOUSE1 = 200,
K_MOUSE2 = 201,
K_MOUSE3 = 202,

//
// joystick buttons
//
#define K_JOY1 203
#define K_JOY2 204
#define K_JOY3 205
#define K_JOY4 206
K_JOY1 = 203,
K_JOY2 = 204,
K_JOY3 = 205,
K_JOY4 = 206,
// aux keys are for multi-buttoned joysticks to generate so they can use
// the normal binding process
// aux29-32: reserved for the HAT (POV) switch motion
#define K_AUX1 207
#define K_AUX2 208
#define K_AUX3 209
#define K_AUX4 210
#define K_AUX5 211
#define K_AUX6 212
#define K_AUX7 213
#define K_AUX8 214
#define K_AUX9 215
#define K_AUX10 216
#define K_AUX11 217
#define K_AUX12 218
#define K_AUX13 219
#define K_AUX14 220
#define K_AUX15 221
#define K_AUX16 222
#define K_AUX17 223
#define K_AUX18 224
#define K_AUX19 225
#define K_AUX20 226
#define K_AUX21 227
#define K_AUX22 228
#define K_AUX23 229
#define K_AUX24 230
#define K_AUX25 231
#define K_AUX26 232
#define K_AUX27 233
#define K_AUX28 234
#define K_AUX29 235
#define K_AUX30 236
#define K_AUX31 237
#define K_AUX32 238
K_AUX1 = 207,
K_AUX2 = 208,
K_AUX3 = 209,
K_AUX4 = 210,
K_AUX5 = 211,
K_AUX6 = 212,
K_AUX7 = 213,
K_AUX8 = 214,
K_AUX9 = 215,
K_AUX10 = 216,
K_AUX11 = 217,
K_AUX12 = 218,
K_AUX13 = 219,
K_AUX14 = 220,
K_AUX15 = 221,
K_AUX16 = 222,
K_AUX17 = 223,
K_AUX18 = 224,
K_AUX19 = 225,
K_AUX20 = 226,
K_AUX21 = 227,
K_AUX22 = 228,
K_AUX23 = 229,
K_AUX24 = 230,
K_AUX25 = 231,
K_AUX26 = 232,
K_AUX27 = 233,
K_AUX28 = 234,
K_AUX29 = 235,
K_AUX30 = 236,
K_AUX31 = 237,
K_AUX32 = 238,

// JACK: Intellimouse(c) Mouse Wheel Support

#define K_MWHEELUP 239
#define K_MWHEELDOWN 240
K_MWHEELUP = 239,
K_MWHEELDOWN = 240,

// thumb buttons
#define K_MOUSE4 241
#define K_MOUSE5 242
K_MOUSE4 = 241,
K_MOUSE5 = 242,

// SDL2 game controller keys
#define K_LTHUMB 243
#define K_RTHUMB 244
#define K_LSHOULDER 245
#define K_RSHOULDER 246
#define K_ABUTTON 247
#define K_BBUTTON 248
#define K_XBUTTON 249
#define K_YBUTTON 250
#define K_LTRIGGER 251
#define K_RTRIGGER 252
K_LTHUMB = 243,
K_RTHUMB = 244,
K_LSHOULDER = 245,
K_RSHOULDER = 246,
K_ABUTTON = 247,
K_BBUTTON = 248,
K_XBUTTON = 249,
K_YBUTTON = 250,
K_LTRIGGER = 251,
K_RTRIGGER = 252,
} keycode_t;

#define MAX_KEYS 256

Expand Down

0 comments on commit 55d5cfb

Please sign in to comment.