Module: SDL2::Key

Defined in:
key.c,
key.c

Overview

This module has “virtual” keycode constants and some keyboard input handling functions.

Defined Under Namespace

Modules: Mod, Scan

Constant Summary

UNKNOWN =

Returns unused keycode

Returns:

  • (Integer)

    unused keycode

INT2NUM(SDLK_UNKNOWN)
RETURN =

Returns keycode for “RETURN” key

Returns:

  • (Integer)

    keycode for “RETURN” key

INT2NUM(SDLK_RETURN)
ESCAPE =

Returns keycode for “ESCAPE” key

Returns:

  • (Integer)

    keycode for “ESCAPE” key

INT2NUM(SDLK_ESCAPE)
BACKSPACE =

Returns keycode for “BACKSPACE” key

Returns:

  • (Integer)

    keycode for “BACKSPACE” key

INT2NUM(SDLK_BACKSPACE)
TAB =

Returns keycode for “TAB” key

Returns:

  • (Integer)

    keycode for “TAB” key

INT2NUM(SDLK_TAB)
SPACE =

Returns keycode for “SPACE” key

Returns:

  • (Integer)

    keycode for “SPACE” key

INT2NUM(SDLK_SPACE)
EXCLAIM =

Returns keycode for “EXCLAIM” key

Returns:

  • (Integer)

    keycode for “EXCLAIM” key

INT2NUM(SDLK_EXCLAIM)
QUOTEDBL =

Returns keycode for “QUOTEDBL” key

Returns:

  • (Integer)

    keycode for “QUOTEDBL” key

INT2NUM(SDLK_QUOTEDBL)
HASH =

Returns keycode for “HASH” key

Returns:

  • (Integer)

    keycode for “HASH” key

INT2NUM(SDLK_HASH)
PERCENT =

Returns keycode for “PERCENT” key

Returns:

  • (Integer)

    keycode for “PERCENT” key

INT2NUM(SDLK_PERCENT)
DOLLAR =

Returns keycode for “DOLLAR” key

Returns:

  • (Integer)

    keycode for “DOLLAR” key

INT2NUM(SDLK_DOLLAR)
AMPERSAND =

Returns keycode for “AMPERSAND” key

Returns:

  • (Integer)

    keycode for “AMPERSAND” key

INT2NUM(SDLK_AMPERSAND)
QUOTE =

Returns keycode for “QUOTE” key

Returns:

  • (Integer)

    keycode for “QUOTE” key

INT2NUM(SDLK_QUOTE)
LEFTPAREN =

Returns keycode for “LEFTPAREN” key

Returns:

  • (Integer)

    keycode for “LEFTPAREN” key

INT2NUM(SDLK_LEFTPAREN)
RIGHTPAREN =

Returns keycode for “RIGHTPAREN” key

Returns:

  • (Integer)

    keycode for “RIGHTPAREN” key

INT2NUM(SDLK_RIGHTPAREN)
ASTERISK =

Returns keycode for “ASTERISK” key

Returns:

  • (Integer)

    keycode for “ASTERISK” key

INT2NUM(SDLK_ASTERISK)
PLUS =

Returns keycode for “PLUS” key

Returns:

  • (Integer)

    keycode for “PLUS” key

INT2NUM(SDLK_PLUS)
COMMA =

Returns keycode for “COMMA” key

Returns:

  • (Integer)

    keycode for “COMMA” key

INT2NUM(SDLK_COMMA)
MINUS =

Returns keycode for “MINUS” key

Returns:

  • (Integer)

    keycode for “MINUS” key

INT2NUM(SDLK_MINUS)
PERIOD =

Returns keycode for “PERIOD” key

Returns:

  • (Integer)

    keycode for “PERIOD” key

INT2NUM(SDLK_PERIOD)
SLASH =

Returns keycode for “SLASH” key

Returns:

  • (Integer)

    keycode for “SLASH” key

INT2NUM(SDLK_SLASH)
K0 =

Returns keycode for number key “0” (not on keypad)

Returns:

  • (Integer)

    keycode for number key “0” (not on keypad)

INT2NUM(SDLK_0)
K1 =

Returns keycode for number key “1” (not on keypad)

Returns:

  • (Integer)

    keycode for number key “1” (not on keypad)

INT2NUM(SDLK_1)
K2 =

Returns keycode for number key “2” (not on keypad)

Returns:

  • (Integer)

    keycode for number key “2” (not on keypad)

INT2NUM(SDLK_2)
K3 =

Returns keycode for number key “3” (not on keypad)

Returns:

  • (Integer)

    keycode for number key “3” (not on keypad)

INT2NUM(SDLK_3)
K4 =

Returns keycode for number key “4” (not on keypad)

Returns:

  • (Integer)

    keycode for number key “4” (not on keypad)

INT2NUM(SDLK_4)
K5 =

Returns keycode for number key “5” (not on keypad)

Returns:

  • (Integer)

    keycode for number key “5” (not on keypad)

INT2NUM(SDLK_5)
K6 =

Returns keycode for number key “6” (not on keypad)

Returns:

  • (Integer)

    keycode for number key “6” (not on keypad)

INT2NUM(SDLK_6)
K7 =

Returns keycode for number key “7” (not on keypad)

Returns:

  • (Integer)

    keycode for number key “7” (not on keypad)

INT2NUM(SDLK_7)
K8 =

Returns keycode for number key “8” (not on keypad)

Returns:

  • (Integer)

    keycode for number key “8” (not on keypad)

INT2NUM(SDLK_8)
K9 =

Returns keycode for number key “9” (not on keypad)

Returns:

  • (Integer)

    keycode for number key “9” (not on keypad)

INT2NUM(SDLK_9)
COLON =

Returns keycode for “COLON” key

Returns:

  • (Integer)

    keycode for “COLON” key

INT2NUM(SDLK_COLON)
SEMICOLON =

Returns keycode for “SEMICOLON” key

Returns:

  • (Integer)

    keycode for “SEMICOLON” key

INT2NUM(SDLK_SEMICOLON)
LESS =

Returns keycode for “LESS” key

Returns:

  • (Integer)

    keycode for “LESS” key

INT2NUM(SDLK_LESS)
EQUALS =

Returns keycode for “EQUALS” key

Returns:

  • (Integer)

    keycode for “EQUALS” key

INT2NUM(SDLK_EQUALS)
GREATER =

Returns keycode for “GREATER” key

Returns:

  • (Integer)

    keycode for “GREATER” key

INT2NUM(SDLK_GREATER)
QUESTION =

Returns keycode for “QUESTION” key

Returns:

  • (Integer)

    keycode for “QUESTION” key

INT2NUM(SDLK_QUESTION)
AT =

Returns keycode for “AT” key

Returns:

  • (Integer)

    keycode for “AT” key

INT2NUM(SDLK_AT)
LEFTBRACKET =

Returns keycode for “LEFTBRACKET” key

Returns:

  • (Integer)

    keycode for “LEFTBRACKET” key

INT2NUM(SDLK_LEFTBRACKET)
BACKSLASH =

Returns keycode for “BACKSLASH” key

Returns:

  • (Integer)

    keycode for “BACKSLASH” key

INT2NUM(SDLK_BACKSLASH)
RIGHTBRACKET =

Returns keycode for “RIGHTBRACKET” key

Returns:

  • (Integer)

    keycode for “RIGHTBRACKET” key

INT2NUM(SDLK_RIGHTBRACKET)
CARET =

Returns keycode for “CARET” key

Returns:

  • (Integer)

    keycode for “CARET” key

INT2NUM(SDLK_CARET)
UNDERSCORE =

Returns keycode for “UNDERSCORE” key

Returns:

  • (Integer)

    keycode for “UNDERSCORE” key

INT2NUM(SDLK_UNDERSCORE)
BACKQUOTE =

Returns keycode for “BACKQUOTE” key

Returns:

  • (Integer)

    keycode for “BACKQUOTE” key

INT2NUM(SDLK_BACKQUOTE)
A =

Returns keycode for alphabet key “a”

Returns:

  • (Integer)

    keycode for alphabet key “a”

INT2NUM(SDLK_a)
B =

Returns keycode for alphabet key “b”

Returns:

  • (Integer)

    keycode for alphabet key “b”

INT2NUM(SDLK_b)
C =

Returns keycode for alphabet key “c”

Returns:

  • (Integer)

    keycode for alphabet key “c”

INT2NUM(SDLK_c)
D =

Returns keycode for alphabet key “d”

Returns:

  • (Integer)

    keycode for alphabet key “d”

INT2NUM(SDLK_d)
E =

Returns keycode for alphabet key “e”

Returns:

  • (Integer)

    keycode for alphabet key “e”

INT2NUM(SDLK_e)
F =

Returns keycode for alphabet key “f”

Returns:

  • (Integer)

    keycode for alphabet key “f”

INT2NUM(SDLK_f)
G =

Returns keycode for alphabet key “g”

Returns:

  • (Integer)

    keycode for alphabet key “g”

INT2NUM(SDLK_g)
H =

Returns keycode for alphabet key “h”

Returns:

  • (Integer)

    keycode for alphabet key “h”

INT2NUM(SDLK_h)
I =

Returns keycode for alphabet key “i”

Returns:

  • (Integer)

    keycode for alphabet key “i”

INT2NUM(SDLK_i)
J =

Returns keycode for alphabet key “j”

Returns:

  • (Integer)

    keycode for alphabet key “j”

INT2NUM(SDLK_j)
K =

Returns keycode for alphabet key “k”

Returns:

  • (Integer)

    keycode for alphabet key “k”

INT2NUM(SDLK_k)
L =

Returns keycode for alphabet key “l”

Returns:

  • (Integer)

    keycode for alphabet key “l”

INT2NUM(SDLK_l)
M =

Returns keycode for alphabet key “m”

Returns:

  • (Integer)

    keycode for alphabet key “m”

INT2NUM(SDLK_m)
N =

Returns keycode for alphabet key “n”

Returns:

  • (Integer)

    keycode for alphabet key “n”

INT2NUM(SDLK_n)
O =

Returns keycode for alphabet key “o”

Returns:

  • (Integer)

    keycode for alphabet key “o”

INT2NUM(SDLK_o)
P =

Returns keycode for alphabet key “p”

Returns:

  • (Integer)

    keycode for alphabet key “p”

INT2NUM(SDLK_p)
Q =

Returns keycode for alphabet key “q”

Returns:

  • (Integer)

    keycode for alphabet key “q”

INT2NUM(SDLK_q)
R =

Returns keycode for alphabet key “r”

Returns:

  • (Integer)

    keycode for alphabet key “r”

INT2NUM(SDLK_r)
S =

Returns keycode for alphabet key “s”

Returns:

  • (Integer)

    keycode for alphabet key “s”

INT2NUM(SDLK_s)
T =

Returns keycode for alphabet key “t”

Returns:

  • (Integer)

    keycode for alphabet key “t”

INT2NUM(SDLK_t)
U =

Returns keycode for alphabet key “u”

Returns:

  • (Integer)

    keycode for alphabet key “u”

INT2NUM(SDLK_u)
V =

Returns keycode for alphabet key “v”

Returns:

  • (Integer)

    keycode for alphabet key “v”

INT2NUM(SDLK_v)
W =

Returns keycode for alphabet key “w”

Returns:

  • (Integer)

    keycode for alphabet key “w”

INT2NUM(SDLK_w)
X =

Returns keycode for alphabet key “x”

Returns:

  • (Integer)

    keycode for alphabet key “x”

INT2NUM(SDLK_x)
Y =

Returns keycode for alphabet key “y”

Returns:

  • (Integer)

    keycode for alphabet key “y”

INT2NUM(SDLK_y)
Z =

Returns keycode for alphabet key “z”

Returns:

  • (Integer)

    keycode for alphabet key “z”

INT2NUM(SDLK_z)
CAPSLOCK =

Returns keycode for “CAPSLOCK” key

Returns:

  • (Integer)

    keycode for “CAPSLOCK” key

INT2NUM(SDLK_CAPSLOCK)
F1 =

Returns keycode for “F1” key

Returns:

  • (Integer)

    keycode for “F1” key

INT2NUM(SDLK_F1)
F2 =

Returns keycode for “F2” key

Returns:

  • (Integer)

    keycode for “F2” key

INT2NUM(SDLK_F2)
F3 =

Returns keycode for “F3” key

Returns:

  • (Integer)

    keycode for “F3” key

INT2NUM(SDLK_F3)
F4 =

Returns keycode for “F4” key

Returns:

  • (Integer)

    keycode for “F4” key

INT2NUM(SDLK_F4)
F5 =

Returns keycode for “F5” key

Returns:

  • (Integer)

    keycode for “F5” key

INT2NUM(SDLK_F5)
F6 =

Returns keycode for “F6” key

Returns:

  • (Integer)

    keycode for “F6” key

INT2NUM(SDLK_F6)
F7 =

Returns keycode for “F7” key

Returns:

  • (Integer)

    keycode for “F7” key

INT2NUM(SDLK_F7)
F8 =

Returns keycode for “F8” key

Returns:

  • (Integer)

    keycode for “F8” key

INT2NUM(SDLK_F8)
F9 =

Returns keycode for “F9” key

Returns:

  • (Integer)

    keycode for “F9” key

INT2NUM(SDLK_F9)
F10 =

Returns keycode for “F10” key

Returns:

  • (Integer)

    keycode for “F10” key

INT2NUM(SDLK_F10)
F11 =

Returns keycode for “F11” key

Returns:

  • (Integer)

    keycode for “F11” key

INT2NUM(SDLK_F11)
F12 =

Returns keycode for “F12” key

Returns:

  • (Integer)

    keycode for “F12” key

INT2NUM(SDLK_F12)
PRINTSCREEN =

Returns keycode for “PRINTSCREEN” key

Returns:

  • (Integer)

    keycode for “PRINTSCREEN” key

INT2NUM(SDLK_PRINTSCREEN)
SCROLLLOCK =

Returns keycode for “SCROLLLOCK” key

Returns:

  • (Integer)

    keycode for “SCROLLLOCK” key

INT2NUM(SDLK_SCROLLLOCK)
PAUSE =

Returns keycode for “PAUSE” key

Returns:

  • (Integer)

    keycode for “PAUSE” key

INT2NUM(SDLK_PAUSE)
INSERT =

Returns keycode for “INSERT” key

Returns:

  • (Integer)

    keycode for “INSERT” key

INT2NUM(SDLK_INSERT)
HOME =

Returns keycode for “HOME” key

Returns:

  • (Integer)

    keycode for “HOME” key

INT2NUM(SDLK_HOME)
PAGEUP =

Returns keycode for “PAGEUP” key

Returns:

  • (Integer)

    keycode for “PAGEUP” key

INT2NUM(SDLK_PAGEUP)
DELETE =

Returns keycode for “DELETE” key

Returns:

  • (Integer)

    keycode for “DELETE” key

INT2NUM(SDLK_DELETE)
END =

Returns keycode for “END” key

Returns:

  • (Integer)

    keycode for “END” key

INT2NUM(SDLK_END)
PAGEDOWN =

Returns keycode for “PAGEDOWN” key

Returns:

  • (Integer)

    keycode for “PAGEDOWN” key

INT2NUM(SDLK_PAGEDOWN)
RIGHT =

Returns keycode for “RIGHT” key

Returns:

  • (Integer)

    keycode for “RIGHT” key

INT2NUM(SDLK_RIGHT)
LEFT =

Returns keycode for “LEFT” key

Returns:

  • (Integer)

    keycode for “LEFT” key

INT2NUM(SDLK_LEFT)
DOWN =

Returns keycode for “DOWN” key

Returns:

  • (Integer)

    keycode for “DOWN” key

INT2NUM(SDLK_DOWN)
UP =

Returns keycode for “UP” key

Returns:

  • (Integer)

    keycode for “UP” key

INT2NUM(SDLK_UP)
NUMLOCKCLEAR =

Returns keycode for “NUMLOCKCLEAR” key

Returns:

  • (Integer)

    keycode for “NUMLOCKCLEAR” key

INT2NUM(SDLK_NUMLOCKCLEAR)
KP_DIVIDE =

Returns keycode for “KP_DIVIDE” key

Returns:

  • (Integer)

    keycode for “KP_DIVIDE” key

INT2NUM(SDLK_KP_DIVIDE)
KP_MULTIPLY =

Returns keycode for “KP_MULTIPLY” key

Returns:

  • (Integer)

    keycode for “KP_MULTIPLY” key

INT2NUM(SDLK_KP_MULTIPLY)
KP_MINUS =

Returns keycode for “KP_MINUS” key

Returns:

  • (Integer)

    keycode for “KP_MINUS” key

INT2NUM(SDLK_KP_MINUS)
KP_PLUS =

Returns keycode for “KP_PLUS” key

Returns:

  • (Integer)

    keycode for “KP_PLUS” key

INT2NUM(SDLK_KP_PLUS)
KP_ENTER =

Returns keycode for “KP_ENTER” key

Returns:

  • (Integer)

    keycode for “KP_ENTER” key

INT2NUM(SDLK_KP_ENTER)
KP_1 =

Returns keycode for “KP_1” key

Returns:

  • (Integer)

    keycode for “KP_1” key

INT2NUM(SDLK_KP_1)
KP_2 =

Returns keycode for “KP_2” key

Returns:

  • (Integer)

    keycode for “KP_2” key

INT2NUM(SDLK_KP_2)
KP_3 =

Returns keycode for “KP_3” key

Returns:

  • (Integer)

    keycode for “KP_3” key

INT2NUM(SDLK_KP_3)
KP_4 =

Returns keycode for “KP_4” key

Returns:

  • (Integer)

    keycode for “KP_4” key

INT2NUM(SDLK_KP_4)
KP_5 =

Returns keycode for “KP_5” key

Returns:

  • (Integer)

    keycode for “KP_5” key

INT2NUM(SDLK_KP_5)
KP_6 =

Returns keycode for “KP_6” key

Returns:

  • (Integer)

    keycode for “KP_6” key

INT2NUM(SDLK_KP_6)
KP_7 =

Returns keycode for “KP_7” key

Returns:

  • (Integer)

    keycode for “KP_7” key

INT2NUM(SDLK_KP_7)
KP_8 =

Returns keycode for “KP_8” key

Returns:

  • (Integer)

    keycode for “KP_8” key

INT2NUM(SDLK_KP_8)
KP_9 =

Returns keycode for “KP_9” key

Returns:

  • (Integer)

    keycode for “KP_9” key

INT2NUM(SDLK_KP_9)
KP_0 =

Returns keycode for “KP_0” key

Returns:

  • (Integer)

    keycode for “KP_0” key

INT2NUM(SDLK_KP_0)
KP_PERIOD =

Returns keycode for “KP_PERIOD” key

Returns:

  • (Integer)

    keycode for “KP_PERIOD” key

INT2NUM(SDLK_KP_PERIOD)
APPLICATION =

Returns keycode for “APPLICATION” key

Returns:

  • (Integer)

    keycode for “APPLICATION” key

INT2NUM(SDLK_APPLICATION)
POWER =

Returns keycode for “POWER” key

Returns:

  • (Integer)

    keycode for “POWER” key

INT2NUM(SDLK_POWER)
KP_EQUALS =

Returns keycode for “KP_EQUALS” key

Returns:

  • (Integer)

    keycode for “KP_EQUALS” key

INT2NUM(SDLK_KP_EQUALS)
F13 =

Returns keycode for “F13” key

Returns:

  • (Integer)

    keycode for “F13” key

INT2NUM(SDLK_F13)
F14 =

Returns keycode for “F14” key

Returns:

  • (Integer)

    keycode for “F14” key

INT2NUM(SDLK_F14)
F15 =

Returns keycode for “F15” key

Returns:

  • (Integer)

    keycode for “F15” key

INT2NUM(SDLK_F15)
F16 =

Returns keycode for “F16” key

Returns:

  • (Integer)

    keycode for “F16” key

INT2NUM(SDLK_F16)
F17 =

Returns keycode for “F17” key

Returns:

  • (Integer)

    keycode for “F17” key

INT2NUM(SDLK_F17)
F18 =

Returns keycode for “F18” key

Returns:

  • (Integer)

    keycode for “F18” key

INT2NUM(SDLK_F18)
F19 =

Returns keycode for “F19” key

Returns:

  • (Integer)

    keycode for “F19” key

INT2NUM(SDLK_F19)
F20 =

Returns keycode for “F20” key

Returns:

  • (Integer)

    keycode for “F20” key

INT2NUM(SDLK_F20)
F21 =

Returns keycode for “F21” key

Returns:

  • (Integer)

    keycode for “F21” key

INT2NUM(SDLK_F21)
F22 =

Returns keycode for “F22” key

Returns:

  • (Integer)

    keycode for “F22” key

INT2NUM(SDLK_F22)
F23 =

Returns keycode for “F23” key

Returns:

  • (Integer)

    keycode for “F23” key

INT2NUM(SDLK_F23)
F24 =

Returns keycode for “F24” key

Returns:

  • (Integer)

    keycode for “F24” key

INT2NUM(SDLK_F24)
EXECUTE =

Returns keycode for “EXECUTE” key

Returns:

  • (Integer)

    keycode for “EXECUTE” key

INT2NUM(SDLK_EXECUTE)
HELP =

Returns keycode for “HELP” key

Returns:

  • (Integer)

    keycode for “HELP” key

INT2NUM(SDLK_HELP)
INT2NUM(SDLK_MENU)
SELECT =

Returns keycode for “SELECT” key

Returns:

  • (Integer)

    keycode for “SELECT” key

INT2NUM(SDLK_SELECT)
STOP =

Returns keycode for “STOP” key

Returns:

  • (Integer)

    keycode for “STOP” key

INT2NUM(SDLK_STOP)
AGAIN =

Returns keycode for “AGAIN” key

Returns:

  • (Integer)

    keycode for “AGAIN” key

INT2NUM(SDLK_AGAIN)
UNDO =

Returns keycode for “UNDO” key

Returns:

  • (Integer)

    keycode for “UNDO” key

INT2NUM(SDLK_UNDO)
CUT =

Returns keycode for “CUT” key

Returns:

  • (Integer)

    keycode for “CUT” key

INT2NUM(SDLK_CUT)
COPY =

Returns keycode for “COPY” key

Returns:

  • (Integer)

    keycode for “COPY” key

INT2NUM(SDLK_COPY)
PASTE =

Returns keycode for “PASTE” key

Returns:

  • (Integer)

    keycode for “PASTE” key

INT2NUM(SDLK_PASTE)
FIND =

Returns keycode for “FIND” key

Returns:

  • (Integer)

    keycode for “FIND” key

INT2NUM(SDLK_FIND)
MUTE =

Returns keycode for “MUTE” key

Returns:

  • (Integer)

    keycode for “MUTE” key

INT2NUM(SDLK_MUTE)
VOLUMEUP =

Returns keycode for “VOLUMEUP” key

Returns:

  • (Integer)

    keycode for “VOLUMEUP” key

INT2NUM(SDLK_VOLUMEUP)
VOLUMEDOWN =

Returns keycode for “VOLUMEDOWN” key

Returns:

  • (Integer)

    keycode for “VOLUMEDOWN” key

INT2NUM(SDLK_VOLUMEDOWN)
KP_COMMA =

Returns keycode for “KP_COMMA” key

Returns:

  • (Integer)

    keycode for “KP_COMMA” key

INT2NUM(SDLK_KP_COMMA)
KP_EQUALSAS400 =

Returns keycode for “KP_EQUALSAS400” key

Returns:

  • (Integer)

    keycode for “KP_EQUALSAS400” key

INT2NUM(SDLK_KP_EQUALSAS400)
ALTERASE =

Returns keycode for “ALTERASE” key

Returns:

  • (Integer)

    keycode for “ALTERASE” key

INT2NUM(SDLK_ALTERASE)
SYSREQ =

Returns keycode for “SYSREQ” key

Returns:

  • (Integer)

    keycode for “SYSREQ” key

INT2NUM(SDLK_SYSREQ)
CANCEL =

Returns keycode for “CANCEL” key

Returns:

  • (Integer)

    keycode for “CANCEL” key

INT2NUM(SDLK_CANCEL)
CLEAR =

Returns keycode for “CLEAR” key

Returns:

  • (Integer)

    keycode for “CLEAR” key

INT2NUM(SDLK_CLEAR)
PRIOR =

Returns keycode for “PRIOR” key

Returns:

  • (Integer)

    keycode for “PRIOR” key

INT2NUM(SDLK_PRIOR)
RETURN2 =

Returns keycode for “RETURN2” key

Returns:

  • (Integer)

    keycode for “RETURN2” key

INT2NUM(SDLK_RETURN2)
SEPARATOR =

Returns keycode for “SEPARATOR” key

Returns:

  • (Integer)

    keycode for “SEPARATOR” key

INT2NUM(SDLK_SEPARATOR)
OUT =

Returns keycode for “OUT” key

Returns:

  • (Integer)

    keycode for “OUT” key

INT2NUM(SDLK_OUT)
OPER =

Returns keycode for “OPER” key

Returns:

  • (Integer)

    keycode for “OPER” key

INT2NUM(SDLK_OPER)
CLEARAGAIN =

Returns keycode for “CLEARAGAIN” key

Returns:

  • (Integer)

    keycode for “CLEARAGAIN” key

INT2NUM(SDLK_CLEARAGAIN)
CRSEL =

Returns keycode for “CRSEL” key

Returns:

  • (Integer)

    keycode for “CRSEL” key

INT2NUM(SDLK_CRSEL)
EXSEL =

Returns keycode for “EXSEL” key

Returns:

  • (Integer)

    keycode for “EXSEL” key

INT2NUM(SDLK_EXSEL)
KP_00 =

Returns keycode for “KP_00” key

Returns:

  • (Integer)

    keycode for “KP_00” key

INT2NUM(SDLK_KP_00)
KP_000 =

Returns keycode for “KP_000” key

Returns:

  • (Integer)

    keycode for “KP_000” key

INT2NUM(SDLK_KP_000)
THOUSANDSSEPARATOR =

Returns keycode for “THOUSANDSSEPARATOR” key

Returns:

  • (Integer)

    keycode for “THOUSANDSSEPARATOR” key

INT2NUM(SDLK_THOUSANDSSEPARATOR)
DECIMALSEPARATOR =

Returns keycode for “DECIMALSEPARATOR” key

Returns:

  • (Integer)

    keycode for “DECIMALSEPARATOR” key

INT2NUM(SDLK_DECIMALSEPARATOR)
CURRENCYUNIT =

Returns keycode for “CURRENCYUNIT” key

Returns:

  • (Integer)

    keycode for “CURRENCYUNIT” key

INT2NUM(SDLK_CURRENCYUNIT)
CURRENCYSUBUNIT =

Returns keycode for “CURRENCYSUBUNIT” key

Returns:

  • (Integer)

    keycode for “CURRENCYSUBUNIT” key

INT2NUM(SDLK_CURRENCYSUBUNIT)
KP_LEFTPAREN =

Returns keycode for “KP_LEFTPAREN” key

Returns:

  • (Integer)

    keycode for “KP_LEFTPAREN” key

INT2NUM(SDLK_KP_LEFTPAREN)
KP_RIGHTPAREN =

Returns keycode for “KP_RIGHTPAREN” key

Returns:

  • (Integer)

    keycode for “KP_RIGHTPAREN” key

INT2NUM(SDLK_KP_RIGHTPAREN)
KP_LEFTBRACE =

Returns keycode for “KP_LEFTBRACE” key

Returns:

  • (Integer)

    keycode for “KP_LEFTBRACE” key

INT2NUM(SDLK_KP_LEFTBRACE)
KP_RIGHTBRACE =

Returns keycode for “KP_RIGHTBRACE” key

Returns:

  • (Integer)

    keycode for “KP_RIGHTBRACE” key

INT2NUM(SDLK_KP_RIGHTBRACE)
KP_TAB =

Returns keycode for “KP_TAB” key

Returns:

  • (Integer)

    keycode for “KP_TAB” key

INT2NUM(SDLK_KP_TAB)
KP_BACKSPACE =

Returns keycode for “KP_BACKSPACE” key

Returns:

  • (Integer)

    keycode for “KP_BACKSPACE” key

INT2NUM(SDLK_KP_BACKSPACE)
KP_A =

Returns keycode for “KP_A” key

Returns:

  • (Integer)

    keycode for “KP_A” key

INT2NUM(SDLK_KP_A)
KP_B =

Returns keycode for “KP_B” key

Returns:

  • (Integer)

    keycode for “KP_B” key

INT2NUM(SDLK_KP_B)
KP_C =

Returns keycode for “KP_C” key

Returns:

  • (Integer)

    keycode for “KP_C” key

INT2NUM(SDLK_KP_C)
KP_D =

Returns keycode for “KP_D” key

Returns:

  • (Integer)

    keycode for “KP_D” key

INT2NUM(SDLK_KP_D)
KP_E =

Returns keycode for “KP_E” key

Returns:

  • (Integer)

    keycode for “KP_E” key

INT2NUM(SDLK_KP_E)
KP_F =

Returns keycode for “KP_F” key

Returns:

  • (Integer)

    keycode for “KP_F” key

INT2NUM(SDLK_KP_F)
KP_XOR =

Returns keycode for “KP_XOR” key

Returns:

  • (Integer)

    keycode for “KP_XOR” key

INT2NUM(SDLK_KP_XOR)
KP_POWER =

Returns keycode for “KP_POWER” key

Returns:

  • (Integer)

    keycode for “KP_POWER” key

INT2NUM(SDLK_KP_POWER)
KP_PERCENT =

Returns keycode for “KP_PERCENT” key

Returns:

  • (Integer)

    keycode for “KP_PERCENT” key

INT2NUM(SDLK_KP_PERCENT)
KP_LESS =

Returns keycode for “KP_LESS” key

Returns:

  • (Integer)

    keycode for “KP_LESS” key

INT2NUM(SDLK_KP_LESS)
KP_GREATER =

Returns keycode for “KP_GREATER” key

Returns:

  • (Integer)

    keycode for “KP_GREATER” key

INT2NUM(SDLK_KP_GREATER)
KP_AMPERSAND =

Returns keycode for “KP_AMPERSAND” key

Returns:

  • (Integer)

    keycode for “KP_AMPERSAND” key

INT2NUM(SDLK_KP_AMPERSAND)
KP_DBLAMPERSAND =

Returns keycode for “KP_DBLAMPERSAND” key

Returns:

  • (Integer)

    keycode for “KP_DBLAMPERSAND” key

INT2NUM(SDLK_KP_DBLAMPERSAND)
KP_VERTICALBAR =

Returns keycode for “KP_VERTICALBAR” key

Returns:

  • (Integer)

    keycode for “KP_VERTICALBAR” key

INT2NUM(SDLK_KP_VERTICALBAR)
KP_DBLVERTICALBAR =

Returns keycode for “KP_DBLVERTICALBAR” key

Returns:

  • (Integer)

    keycode for “KP_DBLVERTICALBAR” key

INT2NUM(SDLK_KP_DBLVERTICALBAR)
KP_COLON =

Returns keycode for “KP_COLON” key

Returns:

  • (Integer)

    keycode for “KP_COLON” key

INT2NUM(SDLK_KP_COLON)
KP_HASH =

Returns keycode for “KP_HASH” key

Returns:

  • (Integer)

    keycode for “KP_HASH” key

INT2NUM(SDLK_KP_HASH)
KP_SPACE =

Returns keycode for “KP_SPACE” key

Returns:

  • (Integer)

    keycode for “KP_SPACE” key

INT2NUM(SDLK_KP_SPACE)
KP_AT =

Returns keycode for “KP_AT” key

Returns:

  • (Integer)

    keycode for “KP_AT” key

INT2NUM(SDLK_KP_AT)
KP_EXCLAM =

Returns keycode for “KP_EXCLAM” key

Returns:

  • (Integer)

    keycode for “KP_EXCLAM” key

INT2NUM(SDLK_KP_EXCLAM)
KP_MEMSTORE =

Returns keycode for “KP_MEMSTORE” key

Returns:

  • (Integer)

    keycode for “KP_MEMSTORE” key

INT2NUM(SDLK_KP_MEMSTORE)
KP_MEMRECALL =

Returns keycode for “KP_MEMRECALL” key

Returns:

  • (Integer)

    keycode for “KP_MEMRECALL” key

INT2NUM(SDLK_KP_MEMRECALL)
KP_MEMCLEAR =

Returns keycode for “KP_MEMCLEAR” key

Returns:

  • (Integer)

    keycode for “KP_MEMCLEAR” key

INT2NUM(SDLK_KP_MEMCLEAR)
KP_MEMADD =

Returns keycode for “KP_MEMADD” key

Returns:

  • (Integer)

    keycode for “KP_MEMADD” key

INT2NUM(SDLK_KP_MEMADD)
KP_MEMSUBTRACT =

Returns keycode for “KP_MEMSUBTRACT” key

Returns:

  • (Integer)

    keycode for “KP_MEMSUBTRACT” key

INT2NUM(SDLK_KP_MEMSUBTRACT)
KP_MEMMULTIPLY =

Returns keycode for “KP_MEMMULTIPLY” key

Returns:

  • (Integer)

    keycode for “KP_MEMMULTIPLY” key

INT2NUM(SDLK_KP_MEMMULTIPLY)
KP_MEMDIVIDE =

Returns keycode for “KP_MEMDIVIDE” key

Returns:

  • (Integer)

    keycode for “KP_MEMDIVIDE” key

INT2NUM(SDLK_KP_MEMDIVIDE)
KP_PLUSMINUS =

Returns keycode for “KP_PLUSMINUS” key

Returns:

  • (Integer)

    keycode for “KP_PLUSMINUS” key

INT2NUM(SDLK_KP_PLUSMINUS)
KP_CLEAR =

Returns keycode for “KP_CLEAR” key

Returns:

  • (Integer)

    keycode for “KP_CLEAR” key

INT2NUM(SDLK_KP_CLEAR)
KP_CLEARENTRY =

Returns keycode for “KP_CLEARENTRY” key

Returns:

  • (Integer)

    keycode for “KP_CLEARENTRY” key

INT2NUM(SDLK_KP_CLEARENTRY)
KP_BINARY =

Returns keycode for “KP_BINARY” key

Returns:

  • (Integer)

    keycode for “KP_BINARY” key

INT2NUM(SDLK_KP_BINARY)
KP_OCTAL =

Returns keycode for “KP_OCTAL” key

Returns:

  • (Integer)

    keycode for “KP_OCTAL” key

INT2NUM(SDLK_KP_OCTAL)
KP_DECIMAL =

Returns keycode for “KP_DECIMAL” key

Returns:

  • (Integer)

    keycode for “KP_DECIMAL” key

INT2NUM(SDLK_KP_DECIMAL)
KP_HEXADECIMAL =

Returns keycode for “KP_HEXADECIMAL” key

Returns:

  • (Integer)

    keycode for “KP_HEXADECIMAL” key

INT2NUM(SDLK_KP_HEXADECIMAL)
LCTRL =

Returns keycode for “LCTRL” key

Returns:

  • (Integer)

    keycode for “LCTRL” key

INT2NUM(SDLK_LCTRL)
LSHIFT =

Returns keycode for “LSHIFT” key

Returns:

  • (Integer)

    keycode for “LSHIFT” key

INT2NUM(SDLK_LSHIFT)
LALT =

Returns keycode for “LALT” key

Returns:

  • (Integer)

    keycode for “LALT” key

INT2NUM(SDLK_LALT)
LGUI =

Returns keycode for “LGUI” key

Returns:

  • (Integer)

    keycode for “LGUI” key

INT2NUM(SDLK_LGUI)
RCTRL =

Returns keycode for “RCTRL” key

Returns:

  • (Integer)

    keycode for “RCTRL” key

INT2NUM(SDLK_RCTRL)
RSHIFT =

Returns keycode for “RSHIFT” key

Returns:

  • (Integer)

    keycode for “RSHIFT” key

INT2NUM(SDLK_RSHIFT)
RALT =

Returns keycode for “RALT” key

Returns:

  • (Integer)

    keycode for “RALT” key

INT2NUM(SDLK_RALT)
RGUI =

Returns keycode for “RGUI” key

Returns:

  • (Integer)

    keycode for “RGUI” key

INT2NUM(SDLK_RGUI)
MODE =

Returns keycode for “MODE” key

Returns:

  • (Integer)

    keycode for “MODE” key

INT2NUM(SDLK_MODE)
AUDIONEXT =

Returns keycode for “AUDIONEXT” key

Returns:

  • (Integer)

    keycode for “AUDIONEXT” key

INT2NUM(SDLK_AUDIONEXT)
AUDIOPREV =

Returns keycode for “AUDIOPREV” key

Returns:

  • (Integer)

    keycode for “AUDIOPREV” key

INT2NUM(SDLK_AUDIOPREV)
AUDIOSTOP =

Returns keycode for “AUDIOSTOP” key

Returns:

  • (Integer)

    keycode for “AUDIOSTOP” key

INT2NUM(SDLK_AUDIOSTOP)
AUDIOPLAY =

Returns keycode for “AUDIOPLAY” key

Returns:

  • (Integer)

    keycode for “AUDIOPLAY” key

INT2NUM(SDLK_AUDIOPLAY)
AUDIOMUTE =

Returns keycode for “AUDIOMUTE” key

Returns:

  • (Integer)

    keycode for “AUDIOMUTE” key

INT2NUM(SDLK_AUDIOMUTE)
MEDIASELECT =

Returns keycode for “MEDIASELECT” key

Returns:

  • (Integer)

    keycode for “MEDIASELECT” key

INT2NUM(SDLK_MEDIASELECT)
WWW =

Returns keycode for “WWW” key

Returns:

  • (Integer)

    keycode for “WWW” key

INT2NUM(SDLK_WWW)
MAIL =

Returns keycode for “MAIL” key

Returns:

  • (Integer)

    keycode for “MAIL” key

INT2NUM(SDLK_MAIL)
CALCULATOR =

Returns keycode for “CALCULATOR” key

Returns:

  • (Integer)

    keycode for “CALCULATOR” key

INT2NUM(SDLK_CALCULATOR)
COMPUTER =

Returns keycode for “COMPUTER” key

Returns:

  • (Integer)

    keycode for “COMPUTER” key

INT2NUM(SDLK_COMPUTER)
AC_SEARCH =

Returns keycode for “AC_SEARCH” key

Returns:

  • (Integer)

    keycode for “AC_SEARCH” key

INT2NUM(SDLK_AC_SEARCH)
AC_HOME =

Returns keycode for “AC_HOME” key

Returns:

  • (Integer)

    keycode for “AC_HOME” key

INT2NUM(SDLK_AC_HOME)
AC_BACK =

Returns keycode for “AC_BACK” key

Returns:

  • (Integer)

    keycode for “AC_BACK” key

INT2NUM(SDLK_AC_BACK)
AC_FORWARD =

Returns keycode for “AC_FORWARD” key

Returns:

  • (Integer)

    keycode for “AC_FORWARD” key

INT2NUM(SDLK_AC_FORWARD)
AC_STOP =

Returns keycode for “AC_STOP” key

Returns:

  • (Integer)

    keycode for “AC_STOP” key

INT2NUM(SDLK_AC_STOP)
AC_REFRESH =

Returns keycode for “AC_REFRESH” key

Returns:

  • (Integer)

    keycode for “AC_REFRESH” key

INT2NUM(SDLK_AC_REFRESH)
AC_BOOKMARKS =

Returns keycode for “AC_BOOKMARKS” key

Returns:

  • (Integer)

    keycode for “AC_BOOKMARKS” key

INT2NUM(SDLK_AC_BOOKMARKS)
BRIGHTNESSDOWN =

Returns keycode for “BRIGHTNESSDOWN” key

Returns:

  • (Integer)

    keycode for “BRIGHTNESSDOWN” key

INT2NUM(SDLK_BRIGHTNESSDOWN)
BRIGHTNESSUP =

Returns keycode for “BRIGHTNESSUP” key

Returns:

  • (Integer)

    keycode for “BRIGHTNESSUP” key

INT2NUM(SDLK_BRIGHTNESSUP)
DISPLAYSWITCH =

Returns keycode for “DISPLAYSWITCH” key

Returns:

  • (Integer)

    keycode for “DISPLAYSWITCH” key

INT2NUM(SDLK_DISPLAYSWITCH)
KBDILLUMTOGGLE =

Returns keycode for “KBDILLUMTOGGLE” key

Returns:

  • (Integer)

    keycode for “KBDILLUMTOGGLE” key

INT2NUM(SDLK_KBDILLUMTOGGLE)
KBDILLUMDOWN =

Returns keycode for “KBDILLUMDOWN” key

Returns:

  • (Integer)

    keycode for “KBDILLUMDOWN” key

INT2NUM(SDLK_KBDILLUMDOWN)
KBDILLUMUP =

Returns keycode for “KBDILLUMUP” key

Returns:

  • (Integer)

    keycode for “KBDILLUMUP” key

INT2NUM(SDLK_KBDILLUMUP)
EJECT =

Returns keycode for “EJECT” key

Returns:

  • (Integer)

    keycode for “EJECT” key

INT2NUM(SDLK_EJECT)
SLEEP =

Returns keycode for “SLEEP” key

Returns:

  • (Integer)

    keycode for “SLEEP” key

INT2NUM(SDLK_SLEEP)

Class Method Summary collapse

Class Method Details

.keycode_from_name(name) ⇒ Integer

Get a key code from given name

Parameters:

  • name (String)

    name of a key

Returns:

  • (Integer)

    keycode

See Also:



45
46
47
48
# File 'key.c', line 45

static VALUE Key_s_keycode_from_name(VALUE self, VALUE name)
{
    return INT2NUM(SDL_GetKeyFromName(StringValueCStr(name)));
}

.keycode_from_scancode(scancode) ⇒ Integer

Convert a scancode to the corresponding keycode

Parameters:

  • scancode (Integer)

    scancode

Returns:

  • (Integer)

See Also:



59
60
61
62
# File 'key.c', line 59

static VALUE Key_s_keycode_from_scancode(VALUE self, VALUE scancode)
{
    return INT2NUM(SDL_GetKeyFromScancode(NUM2INT(scancode)));
}

.name_of(code) ⇒ String

Get a human-readable name for a key

Parameters:

  • code (Integer)

    keycode

Returns:

  • (String)

    the name of given keycode

See Also:



31
32
33
34
# File 'key.c', line 31

static VALUE Key_s_name_of(VALUE self, VALUE code)
{
    return utf8str_new_cstr(SDL_GetKeyName(NUM2INT(code)));
}

.pressed?(code) ⇒ Boolean

Get whether the key of the given scancode is pressed or not.

Parameters:

  • code (Integer)

    scancode

Returns:

  • (Boolean)


70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'key.c', line 70

static VALUE Key_s_pressed_p(VALUE self, VALUE code)
{
    const Uint8* state = SDL_GetKeyboardState(NULL);
    SDL_Scancode scancode;
    if (!state) {
        SDL_PumpEvents();
        state = SDL_GetKeyboardState(NULL);
        if (!state)
            rb_raise(eSDL2Error, "Event subsystem is not initialized");
    }
    scancode = NUM2UINT(code);
    if (scancode >= SDL_NUM_SCANCODES) 
        rb_raise(rb_eArgError, "too large scancode %d", scancode);
    
    return INT2BOOL(state[scancode]);
}