GLFW

- Documentation
- Download
- Community

Loading...
Searching...
No Matches
Macros
Keyboard key tokens
Input reference

## Description

See key input for how these are used.

These key codes are inspired by the USB HID Usage Tables v1.12 (p. 53-60), but re-arranged to map to 7-bit ASCII for printable keys (function keys are put in the 256+ range).

The naming of the key codes follow these rules:

- The US keyboard layout is used
- Names of printable alphanumeric characters are used (e.g. "A", "R", "3", etc.)
- For non-alphanumeric characters, Unicode:ish names are used (e.g. "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not correspond to the Unicode standard (usually for brevity)
- Keys that lack a clear US mapping are named "WORLD_x"
- For non-printable keys, custom names are used (e.g. "F4", "BACKSPACE", etc.)

## Macros
#define | GLFW_KEY_SPACE 32
#define | GLFW_KEY_APOSTROPHE 39 /* ' */
#define | GLFW_KEY_COMMA 44 /* , */
#define | GLFW_KEY_MINUS 45 /* - */
#define | GLFW_KEY_PERIOD 46 /* . */
#define | GLFW_KEY_SLASH 47 /* / */
#define | GLFW_KEY_0 48
#define | GLFW_KEY_1 49
#define | GLFW_KEY_2 50
#define | GLFW_KEY_3 51
#define | GLFW_KEY_4 52
#define | GLFW_KEY_5 53
#define | GLFW_KEY_6 54
#define | GLFW_KEY_7 55
#define | GLFW_KEY_8 56
#define | GLFW_KEY_9 57
#define | GLFW_KEY_SEMICOLON 59 /* ; */
#define | GLFW_KEY_EQUAL 61 /* = */
#define | GLFW_KEY_A 65
#define | GLFW_KEY_B 66
#define | GLFW_KEY_C 67
#define | GLFW_KEY_D 68
#define | GLFW_KEY_E 69
#define | GLFW_KEY_F 70
#define | GLFW_KEY_G 71
#define | GLFW_KEY_H 72
#define | GLFW_KEY_I 73
#define | GLFW_KEY_J 74
#define | GLFW_KEY_K 75
#define | GLFW_KEY_L 76
#define | GLFW_KEY_M 77
#define | GLFW_KEY_N 78
#define | GLFW_KEY_O 79
#define | GLFW_KEY_P 80
#define | GLFW_KEY_Q 81
#define | GLFW_KEY_R 82
#define | GLFW_KEY_S 83
#define | GLFW_KEY_T 84
#define | GLFW_KEY_U 85
#define | GLFW_KEY_V 86
#define | GLFW_KEY_W 87
#define | GLFW_KEY_X 88
#define | GLFW_KEY_Y 89
#define | GLFW_KEY_Z 90
#define | GLFW_KEY_LEFT_BRACKET 91 /* [ */
#define | GLFW_KEY_BACKSLASH 92 /* \ */
#define | GLFW_KEY_RIGHT_BRACKET 93 /* ] */
#define | GLFW_KEY_GRAVE_ACCENT 96 /* ` */
#define | GLFW_KEY_WORLD_1 161 /* non-US #1 */
#define | GLFW_KEY_WORLD_2 162 /* non-US #2 */
#define | GLFW_KEY_ESCAPE 256
#define | GLFW_KEY_ENTER 257
#define | GLFW_KEY_TAB 258
#define | GLFW_KEY_BACKSPACE 259
#define | GLFW_KEY_INSERT 260
#define | GLFW_KEY_DELETE 261
#define | GLFW_KEY_RIGHT 262
#define | GLFW_KEY_LEFT 263
#define | GLFW_KEY_DOWN 264
#define | GLFW_KEY_UP 265
#define | GLFW_KEY_PAGE_UP 266
#define | GLFW_KEY_PAGE_DOWN 267
#define | GLFW_KEY_HOME 268
#define | GLFW_KEY_END 269
#define | GLFW_KEY_CAPS_LOCK 280
#define | GLFW_KEY_SCROLL_LOCK 281
#define | GLFW_KEY_NUM_LOCK 282
#define | GLFW_KEY_PRINT_SCREEN 283
#define | GLFW_KEY_PAUSE 284
#define | GLFW_KEY_F1 290
#define | GLFW_KEY_F2 291
#define | GLFW_KEY_F3 292
#define | GLFW_KEY_F4 293
#define | GLFW_KEY_F5 294
#define | GLFW_KEY_F6 295
#define | GLFW_KEY_F7 296
#define | GLFW_KEY_F8 297
#define | GLFW_KEY_F9 298
#define | GLFW_KEY_F10 299
#define | GLFW_KEY_F11 300
#define | GLFW_KEY_F12 301
#define | GLFW_KEY_F13 302
#define | GLFW_KEY_F14 303
#define | GLFW_KEY_F15 304
#define | GLFW_KEY_F16 305
#define | GLFW_KEY_F17 306
#define | GLFW_KEY_F18 307
#define | GLFW_KEY_F19 308
#define | GLFW_KEY_F20 309
#define | GLFW_KEY_F21 310
#define | GLFW_KEY_F22 311
#define | GLFW_KEY_F23 312
#define | GLFW_KEY_F24 313
#define | GLFW_KEY_F25 314
#define | GLFW_KEY_KP_0 320
#define | GLFW_KEY_KP_1 321
#define | GLFW_KEY_KP_2 322
#define | GLFW_KEY_KP_3 323
#define | GLFW_KEY_KP_4 324
#define | GLFW_KEY_KP_5 325
#define | GLFW_KEY_KP_6 326
#define | GLFW_KEY_KP_7 327
#define | GLFW_KEY_KP_8 328
#define | GLFW_KEY_KP_9 329
#define | GLFW_KEY_KP_DECIMAL 330
#define | GLFW_KEY_KP_DIVIDE 331
#define | GLFW_KEY_KP_MULTIPLY 332
#define | GLFW_KEY_KP_SUBTRACT 333
#define | GLFW_KEY_KP_ADD 334
#define | GLFW_KEY_KP_ENTER 335
#define | GLFW_KEY_KP_EQUAL 336
#define | GLFW_KEY_LEFT_SHIFT 340
#define | GLFW_KEY_LEFT_CONTROL 341
#define | GLFW_KEY_LEFT_ALT 342
#define | GLFW_KEY_LEFT_SUPER 343
#define | GLFW_KEY_RIGHT_SHIFT 344
#define | GLFW_KEY_RIGHT_CONTROL 345
#define | GLFW_KEY_RIGHT_ALT 346
#define | GLFW_KEY_RIGHT_SUPER 347
#define | GLFW_KEY_MENU 348
#define | GLFW_KEY_LAST GLFW_KEY_MENU

## Macro Definition Documentation

## ◆ GLFW_KEY_SPACE

#define GLFW_KEY_SPACE 32

## ◆ GLFW_KEY_APOSTROPHE

#define GLFW_KEY_APOSTROPHE 39 /* ' */

## ◆ GLFW_KEY_COMMA

#define GLFW_KEY_COMMA 44 /* , */

## ◆ GLFW_KEY_MINUS

#define GLFW_KEY_MINUS 45 /* - */

## ◆ GLFW_KEY_PERIOD

#define GLFW_KEY_PERIOD 46 /* . */

## ◆ GLFW_KEY_SLASH

#define GLFW_KEY_SLASH 47 /* / */

## ◆ GLFW_KEY_0

#define GLFW_KEY_0 48

## ◆ GLFW_KEY_1

#define GLFW_KEY_1 49

## ◆ GLFW_KEY_2

#define GLFW_KEY_2 50

## ◆ GLFW_KEY_3

#define GLFW_KEY_3 51

## ◆ GLFW_KEY_4

#define GLFW_KEY_4 52

## ◆ GLFW_KEY_5

#define GLFW_KEY_5 53

## ◆ GLFW_KEY_6

#define GLFW_KEY_6 54

## ◆ GLFW_KEY_7

#define GLFW_KEY_7 55

## ◆ GLFW_KEY_8

#define GLFW_KEY_8 56

## ◆ GLFW_KEY_9

#define GLFW_KEY_9 57

## ◆ GLFW_KEY_SEMICOLON

#define GLFW_KEY_SEMICOLON 59 /* ; */

## ◆ GLFW_KEY_EQUAL

#define GLFW_KEY_EQUAL 61 /* = */

## ◆ GLFW_KEY_A

#define GLFW_KEY_A 65

## ◆ GLFW_KEY_B

#define GLFW_KEY_B 66

## ◆ GLFW_KEY_C

#define GLFW_KEY_C 67

## ◆ GLFW_KEY_D

#define GLFW_KEY_D 68

## ◆ GLFW_KEY_E

#define GLFW_KEY_E 69

## ◆ GLFW_KEY_F

#define GLFW_KEY_F 70

## ◆ GLFW_KEY_G

#define GLFW_KEY_G 71

## ◆ GLFW_KEY_H

#define GLFW_KEY_H 72

## ◆ GLFW_KEY_I

#define GLFW_KEY_I 73

## ◆ GLFW_KEY_J

#define GLFW_KEY_J 74

## ◆ GLFW_KEY_K

#define GLFW_KEY_K 75

## ◆ GLFW_KEY_L

#define GLFW_KEY_L 76

## ◆ GLFW_KEY_M

#define GLFW_KEY_M 77

## ◆ GLFW_KEY_N

#define GLFW_KEY_N 78

## ◆ GLFW_KEY_O

#define GLFW_KEY_O 79

## ◆ GLFW_KEY_P

#define GLFW_KEY_P 80

## ◆ GLFW_KEY_Q

#define GLFW_KEY_Q 81

## ◆ GLFW_KEY_R

#define GLFW_KEY_R 82

## ◆ GLFW_KEY_S

#define GLFW_KEY_S 83

## ◆ GLFW_KEY_T

#define GLFW_KEY_T 84

## ◆ GLFW_KEY_U

#define GLFW_KEY_U 85

## ◆ GLFW_KEY_V

#define GLFW_KEY_V 86

## ◆ GLFW_KEY_W

#define GLFW_KEY_W 87

## ◆ GLFW_KEY_X

#define GLFW_KEY_X 88

## ◆ GLFW_KEY_Y

#define GLFW_KEY_Y 89

## ◆ GLFW_KEY_Z

#define GLFW_KEY_Z 90

## ◆ GLFW_KEY_LEFT_BRACKET

#define GLFW_KEY_LEFT_BRACKET 91 /* [ */

## ◆ GLFW_KEY_BACKSLASH

#define GLFW_KEY_BACKSLASH 92 /* \ */

## ◆ GLFW_KEY_RIGHT_BRACKET

#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */

## ◆ GLFW_KEY_GRAVE_ACCENT

#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */

## ◆ GLFW_KEY_WORLD_1

#define GLFW_KEY_WORLD_1 161 /* non-US #1 */

## ◆ GLFW_KEY_WORLD_2

#define GLFW_KEY_WORLD_2 162 /* non-US #2 */

## ◆ GLFW_KEY_ESCAPE

#define GLFW_KEY_ESCAPE 256

## ◆ GLFW_KEY_ENTER

#define GLFW_KEY_ENTER 257

## ◆ GLFW_KEY_TAB

#define GLFW_KEY_TAB 258

## ◆ GLFW_KEY_BACKSPACE

#define GLFW_KEY_BACKSPACE 259

## ◆ GLFW_KEY_INSERT

#define GLFW_KEY_INSERT 260

## ◆ GLFW_KEY_DELETE

#define GLFW_KEY_DELETE 261

## ◆ GLFW_KEY_RIGHT

#define GLFW_KEY_RIGHT 262

## ◆ GLFW_KEY_LEFT

#define GLFW_KEY_LEFT 263

## ◆ GLFW_KEY_DOWN

#define GLFW_KEY_DOWN 264

## ◆ GLFW_KEY_UP

#define GLFW_KEY_UP 265

## ◆ GLFW_KEY_PAGE_UP

#define GLFW_KEY_PAGE_UP 266

## ◆ GLFW_KEY_PAGE_DOWN

#define GLFW_KEY_PAGE_DOWN 267

## ◆ GLFW_KEY_HOME

#define GLFW_KEY_HOME 268

## ◆ GLFW_KEY_END

#define GLFW_KEY_END 269

## ◆ GLFW_KEY_CAPS_LOCK

#define GLFW_KEY_CAPS_LOCK 280

## ◆ GLFW_KEY_SCROLL_LOCK

#define GLFW_KEY_SCROLL_LOCK 281

## ◆ GLFW_KEY_NUM_LOCK

#define GLFW_KEY_NUM_LOCK 282

## ◆ GLFW_KEY_PRINT_SCREEN

#define GLFW_KEY_PRINT_SCREEN 283

## ◆ GLFW_KEY_PAUSE

#define GLFW_KEY_PAUSE 284

## ◆ GLFW_KEY_F1

#define GLFW_KEY_F1 290

## ◆ GLFW_KEY_F2

#define GLFW_KEY_F2 291

## ◆ GLFW_KEY_F3

#define GLFW_KEY_F3 292

## ◆ GLFW_KEY_F4

#define GLFW_KEY_F4 293

## ◆ GLFW_KEY_F5

#define GLFW_KEY_F5 294

## ◆ GLFW_KEY_F6

#define GLFW_KEY_F6 295

## ◆ GLFW_KEY_F7

#define GLFW_KEY_F7 296

## ◆ GLFW_KEY_F8

#define GLFW_KEY_F8 297

## ◆ GLFW_KEY_F9

#define GLFW_KEY_F9 298

## ◆ GLFW_KEY_F10

#define GLFW_KEY_F10 299

## ◆ GLFW_KEY_F11

#define GLFW_KEY_F11 300

## ◆ GLFW_KEY_F12

#define GLFW_KEY_F12 301

## ◆ GLFW_KEY_F13

#define GLFW_KEY_F13 302

## ◆ GLFW_KEY_F14

#define GLFW_KEY_F14 303

## ◆ GLFW_KEY_F15

#define GLFW_KEY_F15 304

## ◆ GLFW_KEY_F16

#define GLFW_KEY_F16 305

## ◆ GLFW_KEY_F17

#define GLFW_KEY_F17 306

## ◆ GLFW_KEY_F18

#define GLFW_KEY_F18 307

## ◆ GLFW_KEY_F19

#define GLFW_KEY_F19 308

## ◆ GLFW_KEY_F20

#define GLFW_KEY_F20 309

## ◆ GLFW_KEY_F21

#define GLFW_KEY_F21 310

## ◆ GLFW_KEY_F22

#define GLFW_KEY_F22 311

## ◆ GLFW_KEY_F23

#define GLFW_KEY_F23 312

## ◆ GLFW_KEY_F24

#define GLFW_KEY_F24 313

## ◆ GLFW_KEY_F25

#define GLFW_KEY_F25 314

## ◆ GLFW_KEY_KP_0

#define GLFW_KEY_KP_0 320

## ◆ GLFW_KEY_KP_1

#define GLFW_KEY_KP_1 321

## ◆ GLFW_KEY_KP_2

#define GLFW_KEY_KP_2 322

## ◆ GLFW_KEY_KP_3

#define GLFW_KEY_KP_3 323

## ◆ GLFW_KEY_KP_4

#define GLFW_KEY_KP_4 324

## ◆ GLFW_KEY_KP_5

#define GLFW_KEY_KP_5 325

## ◆ GLFW_KEY_KP_6

#define GLFW_KEY_KP_6 326

## ◆ GLFW_KEY_KP_7

#define GLFW_KEY_KP_7 327

## ◆ GLFW_KEY_KP_8

#define GLFW_KEY_KP_8 328

## ◆ GLFW_KEY_KP_9

#define GLFW_KEY_KP_9 329

## ◆ GLFW_KEY_KP_DECIMAL

#define GLFW_KEY_KP_DECIMAL 330

## ◆ GLFW_KEY_KP_DIVIDE

#define GLFW_KEY_KP_DIVIDE 331

## ◆ GLFW_KEY_KP_MULTIPLY

#define GLFW_KEY_KP_MULTIPLY 332

## ◆ GLFW_KEY_KP_SUBTRACT

#define GLFW_KEY_KP_SUBTRACT 333

## ◆ GLFW_KEY_KP_ADD

#define GLFW_KEY_KP_ADD 334

## ◆ GLFW_KEY_KP_ENTER

#define GLFW_KEY_KP_ENTER 335

## ◆ GLFW_KEY_KP_EQUAL

#define GLFW_KEY_KP_EQUAL 336

## ◆ GLFW_KEY_LEFT_SHIFT

#define GLFW_KEY_LEFT_SHIFT 340

## ◆ GLFW_KEY_LEFT_CONTROL

#define GLFW_KEY_LEFT_CONTROL 341

## ◆ GLFW_KEY_LEFT_ALT

#define GLFW_KEY_LEFT_ALT 342

## ◆ GLFW_KEY_LEFT_SUPER

#define GLFW_KEY_LEFT_SUPER 343

## ◆ GLFW_KEY_RIGHT_SHIFT

#define GLFW_KEY_RIGHT_SHIFT 344

## ◆ GLFW_KEY_RIGHT_CONTROL

#define GLFW_KEY_RIGHT_CONTROL 345

## ◆ GLFW_KEY_RIGHT_ALT

#define GLFW_KEY_RIGHT_ALT 346

## ◆ GLFW_KEY_RIGHT_SUPER

#define GLFW_KEY_RIGHT_SUPER 347

## ◆ GLFW_KEY_MENU

#define GLFW_KEY_MENU 348

## ◆ GLFW_KEY_LAST

#define GLFW_KEY_LAST GLFW_KEY_MENU