The SDL keyboard scancode representation.
Defined in <SDL3/SDL_scancode.h>
typedef enum SDL_Scancode
{0,
SDL_SCANCODE_UNKNOWN =
/**
* \name Usage page 0x07
*
* These values are from usage page 0x07 (USB keyboard page).
*/
/* @{ */
4,
SDL_SCANCODE_A = 5,
SDL_SCANCODE_B = 6,
SDL_SCANCODE_C = 7,
SDL_SCANCODE_D = 8,
SDL_SCANCODE_E = 9,
SDL_SCANCODE_F = 10,
SDL_SCANCODE_G = 11,
SDL_SCANCODE_H = 12,
SDL_SCANCODE_I = 13,
SDL_SCANCODE_J = 14,
SDL_SCANCODE_K = 15,
SDL_SCANCODE_L = 16,
SDL_SCANCODE_M = 17,
SDL_SCANCODE_N = 18,
SDL_SCANCODE_O = 19,
SDL_SCANCODE_P = 20,
SDL_SCANCODE_Q = 21,
SDL_SCANCODE_R = 22,
SDL_SCANCODE_S = 23,
SDL_SCANCODE_T = 24,
SDL_SCANCODE_U = 25,
SDL_SCANCODE_V = 26,
SDL_SCANCODE_W = 27,
SDL_SCANCODE_X = 28,
SDL_SCANCODE_Y = 29,
SDL_SCANCODE_Z =
30,
SDL_SCANCODE_1 = 31,
SDL_SCANCODE_2 = 32,
SDL_SCANCODE_3 = 33,
SDL_SCANCODE_4 = 34,
SDL_SCANCODE_5 = 35,
SDL_SCANCODE_6 = 36,
SDL_SCANCODE_7 = 37,
SDL_SCANCODE_8 = 38,
SDL_SCANCODE_9 = 39,
SDL_SCANCODE_0 =
40,
SDL_SCANCODE_RETURN = 41,
SDL_SCANCODE_ESCAPE = 42,
SDL_SCANCODE_BACKSPACE = 43,
SDL_SCANCODE_TAB = 44,
SDL_SCANCODE_SPACE =
45,
SDL_SCANCODE_MINUS = 46,
SDL_SCANCODE_EQUALS = 47,
SDL_SCANCODE_LEFTBRACKET = 48,
SDL_SCANCODE_RIGHTBRACKET = 49, /**< Located at the lower left of the return
SDL_SCANCODE_BACKSLASH = * key on ISO keyboards and at the right end
* of the QWERTY row on ANSI keyboards.
* Produces REVERSE SOLIDUS (backslash) and
* VERTICAL LINE in a US layout, REVERSE
* SOLIDUS and VERTICAL LINE in a UK Mac
* layout, NUMBER SIGN and TILDE in a UK
* Windows layout, DOLLAR SIGN and POUND SIGN
* in a Swiss German layout, NUMBER SIGN and
* APOSTROPHE in a German layout, GRAVE
* ACCENT and POUND SIGN in a French Mac
* layout, and ASTERISK and MICRO SIGN in a
* French Windows layout.
*/
50, /**< ISO USB keyboards actually use this code
SDL_SCANCODE_NONUSHASH = * instead of 49 for the same key, but all
* OSes I've seen treat the two codes
* identically. So, as an implementor, unless
* your keyboard generates both of those
* codes and your OS treats them differently,
* you should generate SDL_SCANCODE_BACKSLASH
* instead of this code. As a user, you
* should not rely on this code because SDL
* will never generate it with most (all?)
* keyboards.
*/
51,
SDL_SCANCODE_SEMICOLON = 52,
SDL_SCANCODE_APOSTROPHE = 53, /**< Located in the top left corner (on both ANSI
SDL_SCANCODE_GRAVE = * and ISO keyboards). Produces GRAVE ACCENT and
* TILDE in a US Windows layout and in US and UK
* Mac layouts on ANSI keyboards, GRAVE ACCENT
* and NOT SIGN in a UK Windows layout, SECTION
* SIGN and PLUS-MINUS SIGN in US and UK Mac
* layouts on ISO keyboards, SECTION SIGN and
* DEGREE SIGN in a Swiss German layout (Mac:
* only on ISO keyboards), CIRCUMFLEX ACCENT and
* DEGREE SIGN in a German layout (Mac: only on
* ISO keyboards), SUPERSCRIPT TWO and TILDE in a
* French Windows layout, COMMERCIAL AT and
* NUMBER SIGN in a French Mac layout on ISO
* keyboards, and LESS-THAN SIGN and GREATER-THAN
* SIGN in a Swiss German, German, or French Mac
* layout on ANSI keyboards.
*/
54,
SDL_SCANCODE_COMMA = 55,
SDL_SCANCODE_PERIOD = 56,
SDL_SCANCODE_SLASH =
57,
SDL_SCANCODE_CAPSLOCK =
58,
SDL_SCANCODE_F1 = 59,
SDL_SCANCODE_F2 = 60,
SDL_SCANCODE_F3 = 61,
SDL_SCANCODE_F4 = 62,
SDL_SCANCODE_F5 = 63,
SDL_SCANCODE_F6 = 64,
SDL_SCANCODE_F7 = 65,
SDL_SCANCODE_F8 = 66,
SDL_SCANCODE_F9 = 67,
SDL_SCANCODE_F10 = 68,
SDL_SCANCODE_F11 = 69,
SDL_SCANCODE_F12 =
70,
SDL_SCANCODE_PRINTSCREEN = 71,
SDL_SCANCODE_SCROLLLOCK = 72,
SDL_SCANCODE_PAUSE = 73, /**< insert on PC, help on some Mac keyboards (but
SDL_SCANCODE_INSERT = does send code 73, not 117) */
74,
SDL_SCANCODE_HOME = 75,
SDL_SCANCODE_PAGEUP = 76,
SDL_SCANCODE_DELETE = 77,
SDL_SCANCODE_END = 78,
SDL_SCANCODE_PAGEDOWN = 79,
SDL_SCANCODE_RIGHT = 80,
SDL_SCANCODE_LEFT = 81,
SDL_SCANCODE_DOWN = 82,
SDL_SCANCODE_UP =
83, /**< num lock on PC, clear on Mac keyboards
SDL_SCANCODE_NUMLOCKCLEAR = */
84,
SDL_SCANCODE_KP_DIVIDE = 85,
SDL_SCANCODE_KP_MULTIPLY = 86,
SDL_SCANCODE_KP_MINUS = 87,
SDL_SCANCODE_KP_PLUS = 88,
SDL_SCANCODE_KP_ENTER = 89,
SDL_SCANCODE_KP_1 = 90,
SDL_SCANCODE_KP_2 = 91,
SDL_SCANCODE_KP_3 = 92,
SDL_SCANCODE_KP_4 = 93,
SDL_SCANCODE_KP_5 = 94,
SDL_SCANCODE_KP_6 = 95,
SDL_SCANCODE_KP_7 = 96,
SDL_SCANCODE_KP_8 = 97,
SDL_SCANCODE_KP_9 = 98,
SDL_SCANCODE_KP_0 = 99,
SDL_SCANCODE_KP_PERIOD =
100, /**< This is the additional key that ISO
SDL_SCANCODE_NONUSBACKSLASH = * keyboards have over ANSI ones,
* located between left shift and Y.
* Produces GRAVE ACCENT and TILDE in a
* US or UK Mac layout, REVERSE SOLIDUS
* (backslash) and VERTICAL LINE in a
* US or UK Windows layout, and
* LESS-THAN SIGN and GREATER-THAN SIGN
* in a Swiss German, German, or French
* layout. */
101, /**< windows contextual menu, compose */
SDL_SCANCODE_APPLICATION = 102, /**< The USB document says this is a status flag,
SDL_SCANCODE_POWER = * not a physical key - but some Mac keyboards
* do have a power key. */
103,
SDL_SCANCODE_KP_EQUALS = 104,
SDL_SCANCODE_F13 = 105,
SDL_SCANCODE_F14 = 106,
SDL_SCANCODE_F15 = 107,
SDL_SCANCODE_F16 = 108,
SDL_SCANCODE_F17 = 109,
SDL_SCANCODE_F18 = 110,
SDL_SCANCODE_F19 = 111,
SDL_SCANCODE_F20 = 112,
SDL_SCANCODE_F21 = 113,
SDL_SCANCODE_F22 = 114,
SDL_SCANCODE_F23 = 115,
SDL_SCANCODE_F24 = 116,
SDL_SCANCODE_EXECUTE = 117, /**< AL Integrated Help Center */
SDL_SCANCODE_HELP = 118, /**< Menu (show menu) */
SDL_SCANCODE_MENU = 119,
SDL_SCANCODE_SELECT = 120, /**< AC Stop */
SDL_SCANCODE_STOP = 121, /**< AC Redo/Repeat */
SDL_SCANCODE_AGAIN = 122, /**< AC Undo */
SDL_SCANCODE_UNDO = 123, /**< AC Cut */
SDL_SCANCODE_CUT = 124, /**< AC Copy */
SDL_SCANCODE_COPY = 125, /**< AC Paste */
SDL_SCANCODE_PASTE = 126, /**< AC Find */
SDL_SCANCODE_FIND = 127,
SDL_SCANCODE_MUTE = 128,
SDL_SCANCODE_VOLUMEUP = 129,
SDL_SCANCODE_VOLUMEDOWN = /* not sure whether there's a reason to enable these */
/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */
/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */
/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */
133,
SDL_SCANCODE_KP_COMMA = 134,
SDL_SCANCODE_KP_EQUALSAS400 =
135, /**< used on Asian keyboards, see
SDL_SCANCODE_INTERNATIONAL1 = footnotes in USB doc */
136,
SDL_SCANCODE_INTERNATIONAL2 = 137, /**< Yen */
SDL_SCANCODE_INTERNATIONAL3 = 138,
SDL_SCANCODE_INTERNATIONAL4 = 139,
SDL_SCANCODE_INTERNATIONAL5 = 140,
SDL_SCANCODE_INTERNATIONAL6 = 141,
SDL_SCANCODE_INTERNATIONAL7 = 142,
SDL_SCANCODE_INTERNATIONAL8 = 143,
SDL_SCANCODE_INTERNATIONAL9 = 144, /**< Hangul/English toggle */
SDL_SCANCODE_LANG1 = 145, /**< Hanja conversion */
SDL_SCANCODE_LANG2 = 146, /**< Katakana */
SDL_SCANCODE_LANG3 = 147, /**< Hiragana */
SDL_SCANCODE_LANG4 = 148, /**< Zenkaku/Hankaku */
SDL_SCANCODE_LANG5 = 149, /**< reserved */
SDL_SCANCODE_LANG6 = 150, /**< reserved */
SDL_SCANCODE_LANG7 = 151, /**< reserved */
SDL_SCANCODE_LANG8 = 152, /**< reserved */
SDL_SCANCODE_LANG9 =
153, /**< Erase-Eaze */
SDL_SCANCODE_ALTERASE = 154,
SDL_SCANCODE_SYSREQ = 155, /**< AC Cancel */
SDL_SCANCODE_CANCEL = 156,
SDL_SCANCODE_CLEAR = 157,
SDL_SCANCODE_PRIOR = 158,
SDL_SCANCODE_RETURN2 = 159,
SDL_SCANCODE_SEPARATOR = 160,
SDL_SCANCODE_OUT = 161,
SDL_SCANCODE_OPER = 162,
SDL_SCANCODE_CLEARAGAIN = 163,
SDL_SCANCODE_CRSEL = 164,
SDL_SCANCODE_EXSEL =
176,
SDL_SCANCODE_KP_00 = 177,
SDL_SCANCODE_KP_000 = 178,
SDL_SCANCODE_THOUSANDSSEPARATOR = 179,
SDL_SCANCODE_DECIMALSEPARATOR = 180,
SDL_SCANCODE_CURRENCYUNIT = 181,
SDL_SCANCODE_CURRENCYSUBUNIT = 182,
SDL_SCANCODE_KP_LEFTPAREN = 183,
SDL_SCANCODE_KP_RIGHTPAREN = 184,
SDL_SCANCODE_KP_LEFTBRACE = 185,
SDL_SCANCODE_KP_RIGHTBRACE = 186,
SDL_SCANCODE_KP_TAB = 187,
SDL_SCANCODE_KP_BACKSPACE = 188,
SDL_SCANCODE_KP_A = 189,
SDL_SCANCODE_KP_B = 190,
SDL_SCANCODE_KP_C = 191,
SDL_SCANCODE_KP_D = 192,
SDL_SCANCODE_KP_E = 193,
SDL_SCANCODE_KP_F = 194,
SDL_SCANCODE_KP_XOR = 195,
SDL_SCANCODE_KP_POWER = 196,
SDL_SCANCODE_KP_PERCENT = 197,
SDL_SCANCODE_KP_LESS = 198,
SDL_SCANCODE_KP_GREATER = 199,
SDL_SCANCODE_KP_AMPERSAND = 200,
SDL_SCANCODE_KP_DBLAMPERSAND = 201,
SDL_SCANCODE_KP_VERTICALBAR = 202,
SDL_SCANCODE_KP_DBLVERTICALBAR = 203,
SDL_SCANCODE_KP_COLON = 204,
SDL_SCANCODE_KP_HASH = 205,
SDL_SCANCODE_KP_SPACE = 206,
SDL_SCANCODE_KP_AT = 207,
SDL_SCANCODE_KP_EXCLAM = 208,
SDL_SCANCODE_KP_MEMSTORE = 209,
SDL_SCANCODE_KP_MEMRECALL = 210,
SDL_SCANCODE_KP_MEMCLEAR = 211,
SDL_SCANCODE_KP_MEMADD = 212,
SDL_SCANCODE_KP_MEMSUBTRACT = 213,
SDL_SCANCODE_KP_MEMMULTIPLY = 214,
SDL_SCANCODE_KP_MEMDIVIDE = 215,
SDL_SCANCODE_KP_PLUSMINUS = 216,
SDL_SCANCODE_KP_CLEAR = 217,
SDL_SCANCODE_KP_CLEARENTRY = 218,
SDL_SCANCODE_KP_BINARY = 219,
SDL_SCANCODE_KP_OCTAL = 220,
SDL_SCANCODE_KP_DECIMAL = 221,
SDL_SCANCODE_KP_HEXADECIMAL =
224,
SDL_SCANCODE_LCTRL = 225,
SDL_SCANCODE_LSHIFT = 226, /**< alt, option */
SDL_SCANCODE_LALT = 227, /**< windows, command (apple), meta */
SDL_SCANCODE_LGUI = 228,
SDL_SCANCODE_RCTRL = 229,
SDL_SCANCODE_RSHIFT = 230, /**< alt gr, option */
SDL_SCANCODE_RALT = 231, /**< windows, command (apple), meta */
SDL_SCANCODE_RGUI =
257, /**< I'm not sure if this is really not covered
SDL_SCANCODE_MODE = * by any of the above, but since there's a
* special SDL_KMOD_MODE for it I'm adding it here
*/
/* @} *//* Usage page 0x07 */
/**
* \name Usage page 0x0C
*
* These values are mapped from usage page 0x0C (USB consumer page).
*
* There are way more keys in the spec than we can represent in the
* current scancode range, so pick the ones that commonly come up in
* real world usage.
*/
/* @{ */
258, /**< Sleep */
SDL_SCANCODE_SLEEP = 259, /**< Wake */
SDL_SCANCODE_WAKE =
260, /**< Channel Increment */
SDL_SCANCODE_CHANNEL_INCREMENT = 261, /**< Channel Decrement */
SDL_SCANCODE_CHANNEL_DECREMENT =
262, /**< Play */
SDL_SCANCODE_MEDIA_PLAY = 263, /**< Pause */
SDL_SCANCODE_MEDIA_PAUSE = 264, /**< Record */
SDL_SCANCODE_MEDIA_RECORD = 265, /**< Fast Forward */
SDL_SCANCODE_MEDIA_FAST_FORWARD = 266, /**< Rewind */
SDL_SCANCODE_MEDIA_REWIND = 267, /**< Next Track */
SDL_SCANCODE_MEDIA_NEXT_TRACK = 268, /**< Previous Track */
SDL_SCANCODE_MEDIA_PREVIOUS_TRACK = 269, /**< Stop */
SDL_SCANCODE_MEDIA_STOP = 270, /**< Eject */
SDL_SCANCODE_MEDIA_EJECT = 271, /**< Play / Pause */
SDL_SCANCODE_MEDIA_PLAY_PAUSE = 272, /* Media Select */
SDL_SCANCODE_MEDIA_SELECT =
273, /**< AC New */
SDL_SCANCODE_AC_NEW = 274, /**< AC Open */
SDL_SCANCODE_AC_OPEN = 275, /**< AC Close */
SDL_SCANCODE_AC_CLOSE = 276, /**< AC Exit */
SDL_SCANCODE_AC_EXIT = 277, /**< AC Save */
SDL_SCANCODE_AC_SAVE = 278, /**< AC Print */
SDL_SCANCODE_AC_PRINT = 279, /**< AC Properties */
SDL_SCANCODE_AC_PROPERTIES =
280, /**< AC Search */
SDL_SCANCODE_AC_SEARCH = 281, /**< AC Home */
SDL_SCANCODE_AC_HOME = 282, /**< AC Back */
SDL_SCANCODE_AC_BACK = 283, /**< AC Forward */
SDL_SCANCODE_AC_FORWARD = 284, /**< AC Stop */
SDL_SCANCODE_AC_STOP = 285, /**< AC Refresh */
SDL_SCANCODE_AC_REFRESH = 286, /**< AC Bookmarks */
SDL_SCANCODE_AC_BOOKMARKS =
/* @} *//* Usage page 0x0C */
/**
* \name Mobile keys
*
* These are values that are often used on mobile phones.
*/
/* @{ */
287, /**< Usually situated below the display on phones and
SDL_SCANCODE_SOFTLEFT = used as a multi-function feature key for selecting
a software defined function shown on the bottom left
of the display. */
288, /**< Usually situated below the display on phones and
SDL_SCANCODE_SOFTRIGHT = used as a multi-function feature key for selecting
a software defined function shown on the bottom right
of the display. */
289, /**< Used for accepting phone calls. */
SDL_SCANCODE_CALL = 290, /**< Used for rejecting phone calls. */
SDL_SCANCODE_ENDCALL =
/* @} *//* Mobile keys */
/* Add any other keys here. */
400, /**< 400-500 reserved for dynamic keycodes */
SDL_SCANCODE_RESERVED =
512 /**< not a key, just marks the number of scancodes for array bounds */
SDL_SCANCODE_COUNT =
} SDL_Scancode;
An SDL scancode is the physical representation of a key on the keyboard, independent of language and keyboard mapping.
Values of this type are used to represent keyboard keys, among other places in the scancode
field of the SDL_KeyboardEvent structure.
The values in this enumeration are based on the USB usage page standard: https://usb.org/sites/default/files/hut1_5.pdf
This enum is available since SDL 3.1.3.