summaryrefslogtreecommitdiff
path: root/sdl2
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-10-24 12:40:24 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-10-24 12:40:24 -0400
commit3f5fc49d9885ea88a4271d2d074e3e6192bce1ef (patch)
tree700fad4e09ae30446e021dfbcb7d157e81323b33 /sdl2
parent2137a5b4db931325d46197859a06a6f218aa0ad9 (diff)
keyboard: Respect user keyboard layout in key-pressed? procedure.
Diffstat (limited to 'sdl2')
-rw-r--r--sdl2/input/keyboard.scm482
1 files changed, 239 insertions, 243 deletions
diff --git a/sdl2/input/keyboard.scm b/sdl2/input/keyboard.scm
index d248c64..97b5a17 100644
--- a/sdl2/input/keyboard.scm
+++ b/sdl2/input/keyboard.scm
@@ -31,249 +31,243 @@
#:export (key-pressed?
key-released?))
-(define scancode-map
+(define keycode-map
(alist->hashq-table
- `((unknown . ,ffi:SDL_SCANCODE_UNKNOWN)
- (a . ,ffi:SDL_SCANCODE_A)
- (b . ,ffi:SDL_SCANCODE_B)
- (c . ,ffi:SDL_SCANCODE_C)
- (d . ,ffi:SDL_SCANCODE_D)
- (e . ,ffi:SDL_SCANCODE_E)
- (f . ,ffi:SDL_SCANCODE_F)
- (g . ,ffi:SDL_SCANCODE_G)
- (h . ,ffi:SDL_SCANCODE_H)
- (i . ,ffi:SDL_SCANCODE_I)
- (j . ,ffi:SDL_SCANCODE_J)
- (k . ,ffi:SDL_SCANCODE_K)
- (l . ,ffi:SDL_SCANCODE_L)
- (m . ,ffi:SDL_SCANCODE_M)
- (n . ,ffi:SDL_SCANCODE_N)
- (o . ,ffi:SDL_SCANCODE_O)
- (p . ,ffi:SDL_SCANCODE_P)
- (q . ,ffi:SDL_SCANCODE_Q)
- (r . ,ffi:SDL_SCANCODE_R)
- (s . ,ffi:SDL_SCANCODE_S)
- (t . ,ffi:SDL_SCANCODE_T)
- (u . ,ffi:SDL_SCANCODE_U)
- (v . ,ffi:SDL_SCANCODE_V)
- (w . ,ffi:SDL_SCANCODE_W)
- (x . ,ffi:SDL_SCANCODE_X)
- (y . ,ffi:SDL_SCANCODE_Y)
- (z . ,ffi:SDL_SCANCODE_Z)
- (1 . ,ffi:SDL_SCANCODE_1)
- (2 . ,ffi:SDL_SCANCODE_2)
- (3 . ,ffi:SDL_SCANCODE_3)
- (4 . ,ffi:SDL_SCANCODE_4)
- (5 . ,ffi:SDL_SCANCODE_5)
- (6 . ,ffi:SDL_SCANCODE_6)
- (7 . ,ffi:SDL_SCANCODE_7)
- (8 . ,ffi:SDL_SCANCODE_8)
- (9 . ,ffi:SDL_SCANCODE_9)
- (0 . ,ffi:SDL_SCANCODE_0)
- (return . ,ffi:SDL_SCANCODE_RETURN)
- (escape . ,ffi:SDL_SCANCODE_ESCAPE)
- (backspace . ,ffi:SDL_SCANCODE_BACKSPACE)
- (tab . ,ffi:SDL_SCANCODE_TAB)
- (space . ,ffi:SDL_SCANCODE_SPACE)
- (minus . ,ffi:SDL_SCANCODE_MINUS)
- (equals . ,ffi:SDL_SCANCODE_EQUALS)
- (left-bracket . ,ffi:SDL_SCANCODE_LEFTBRACKET)
- (right-bracket . ,ffi:SDL_SCANCODE_RIGHTBRACKET)
- (backslash . ,ffi:SDL_SCANCODE_BACKSLASH)
- (nonushash . ,ffi:SDL_SCANCODE_NONUSHASH)
- (semicolon . ,ffi:SDL_SCANCODE_SEMICOLON)
- (apostrophe . ,ffi:SDL_SCANCODE_APOSTROPHE)
- (grave . ,ffi:SDL_SCANCODE_GRAVE)
- (comma . ,ffi:SDL_SCANCODE_COMMA)
- (period . ,ffi:SDL_SCANCODE_PERIOD)
- (slash . ,ffi:SDL_SCANCODE_SLASH)
- (caps-lock . ,ffi:SDL_SCANCODE_CAPSLOCK)
- (f1 . ,ffi:SDL_SCANCODE_F1)
- (f2 . ,ffi:SDL_SCANCODE_F2)
- (f3 . ,ffi:SDL_SCANCODE_F3)
- (f4 . ,ffi:SDL_SCANCODE_F4)
- (f5 . ,ffi:SDL_SCANCODE_F5)
- (f6 . ,ffi:SDL_SCANCODE_F6)
- (f7 . ,ffi:SDL_SCANCODE_F7)
- (f8 . ,ffi:SDL_SCANCODE_F8)
- (f9 . ,ffi:SDL_SCANCODE_F9)
- (f10 . ,ffi:SDL_SCANCODE_F10)
- (f11 . ,ffi:SDL_SCANCODE_F11)
- (f12 . ,ffi:SDL_SCANCODE_F12)
- (print-screen . ,ffi:SDL_SCANCODE_PRINTSCREEN)
- (scroll-lock . ,ffi:SDL_SCANCODE_SCROLLLOCK)
- (pause . ,ffi:SDL_SCANCODE_PAUSE)
- (insert . ,ffi:SDL_SCANCODE_INSERT)
- (home . ,ffi:SDL_SCANCODE_HOME)
- (page-up . ,ffi:SDL_SCANCODE_PAGEUP)
- (delete . ,ffi:SDL_SCANCODE_DELETE)
- (end . ,ffi:SDL_SCANCODE_END)
- (page-down . ,ffi:SDL_SCANCODE_PAGEDOWN)
- (right . ,ffi:SDL_SCANCODE_RIGHT)
- (left . ,ffi:SDL_SCANCODE_LEFT)
- (down . ,ffi:SDL_SCANCODE_DOWN)
- (up . ,ffi:SDL_SCANCODE_UP)
- (num-lock-clear . ,ffi:SDL_SCANCODE_NUMLOCKCLEAR)
- (keypad-divide . ,ffi:SDL_SCANCODE_KP_DIVIDE)
- (keypad-multiply . ,ffi:SDL_SCANCODE_KP_MULTIPLY)
- (keypad-minus . ,ffi:SDL_SCANCODE_KP_MINUS)
- (keypad-plus . ,ffi:SDL_SCANCODE_KP_PLUS)
- (keypad-enter . ,ffi:SDL_SCANCODE_KP_ENTER)
- (keypad-1 . ,ffi:SDL_SCANCODE_KP_1)
- (keypad-2 . ,ffi:SDL_SCANCODE_KP_2)
- (keypad-3 . ,ffi:SDL_SCANCODE_KP_3)
- (keypad-4 . ,ffi:SDL_SCANCODE_KP_4)
- (keypad-5 . ,ffi:SDL_SCANCODE_KP_5)
- (keypad-6 . ,ffi:SDL_SCANCODE_KP_6)
- (keypad-7 . ,ffi:SDL_SCANCODE_KP_7)
- (keypad-8 . ,ffi:SDL_SCANCODE_KP_8)
- (keypad-9 . ,ffi:SDL_SCANCODE_KP_9)
- (keypad-0 . ,ffi:SDL_SCANCODE_KP_0)
- (keypad-period . ,ffi:SDL_SCANCODE_KP_PERIOD)
- (nonusbackslash . ,ffi:SDL_SCANCODE_NONUSBACKSLASH)
- (application . ,ffi:SDL_SCANCODE_APPLICATION)
- (power . ,ffi:SDL_SCANCODE_POWER)
- (keypad-equals . ,ffi:SDL_SCANCODE_KP_EQUALS)
- (f13 . ,ffi:SDL_SCANCODE_F13)
- (f14 . ,ffi:SDL_SCANCODE_F14)
- (f15 . ,ffi:SDL_SCANCODE_F15)
- (f16 . ,ffi:SDL_SCANCODE_F16)
- (f17 . ,ffi:SDL_SCANCODE_F17)
- (f18 . ,ffi:SDL_SCANCODE_F18)
- (f19 . ,ffi:SDL_SCANCODE_F19)
- (f20 . ,ffi:SDL_SCANCODE_F20)
- (f21 . ,ffi:SDL_SCANCODE_F21)
- (f22 . ,ffi:SDL_SCANCODE_F22)
- (f23 . ,ffi:SDL_SCANCODE_F23)
- (f24 . ,ffi:SDL_SCANCODE_F24)
- (execute . ,ffi:SDL_SCANCODE_EXECUTE)
- (help . ,ffi:SDL_SCANCODE_HELP)
- (menu . ,ffi:SDL_SCANCODE_MENU)
- (select . ,ffi:SDL_SCANCODE_SELECT)
- (stop . ,ffi:SDL_SCANCODE_STOP)
- (again . ,ffi:SDL_SCANCODE_AGAIN)
- (undo . ,ffi:SDL_SCANCODE_UNDO)
- (cut . ,ffi:SDL_SCANCODE_CUT)
- (copy . ,ffi:SDL_SCANCODE_COPY)
- (paste . ,ffi:SDL_SCANCODE_PASTE)
- (find . ,ffi:SDL_SCANCODE_FIND)
- (mute . ,ffi:SDL_SCANCODE_MUTE)
- (volume-up . ,ffi:SDL_SCANCODE_VOLUMEUP)
- (volume-down . ,ffi:SDL_SCANCODE_VOLUMEDOWN)
- (keypad-comma . ,ffi:SDL_SCANCODE_KP_COMMA)
- (keypad-equalsas400 . ,ffi:SDL_SCANCODE_KP_EQUALSAS400)
- (international-1 . ,ffi:SDL_SCANCODE_INTERNATIONAL1)
- (international-2 . ,ffi:SDL_SCANCODE_INTERNATIONAL2)
- (international-3 . ,ffi:SDL_SCANCODE_INTERNATIONAL3)
- (international-4 . ,ffi:SDL_SCANCODE_INTERNATIONAL4)
- (international-5 . ,ffi:SDL_SCANCODE_INTERNATIONAL5)
- (international-6 . ,ffi:SDL_SCANCODE_INTERNATIONAL6)
- (international-7 . ,ffi:SDL_SCANCODE_INTERNATIONAL7)
- (international-8 . ,ffi:SDL_SCANCODE_INTERNATIONAL8)
- (international-9 . ,ffi:SDL_SCANCODE_INTERNATIONAL9)
- (lang-1 . ,ffi:SDL_SCANCODE_LANG1)
- (lang-2 . ,ffi:SDL_SCANCODE_LANG2)
- (lang-3 . ,ffi:SDL_SCANCODE_LANG3)
- (lang-4 . ,ffi:SDL_SCANCODE_LANG4)
- (lang-5 . ,ffi:SDL_SCANCODE_LANG5)
- (lang-6 . ,ffi:SDL_SCANCODE_LANG6)
- (lang-7 . ,ffi:SDL_SCANCODE_LANG7)
- (lang-8 . ,ffi:SDL_SCANCODE_LANG8)
- (lang-9 . ,ffi:SDL_SCANCODE_LANG9)
- (alt-erase . ,ffi:SDL_SCANCODE_ALTERASE)
- (sysreq . ,ffi:SDL_SCANCODE_SYSREQ)
- (cancel . ,ffi:SDL_SCANCODE_CANCEL)
- (clear . ,ffi:SDL_SCANCODE_CLEAR)
- (prior . ,ffi:SDL_SCANCODE_PRIOR)
- (return-2 . ,ffi:SDL_SCANCODE_RETURN2)
- (separator . ,ffi:SDL_SCANCODE_SEPARATOR)
- (out . ,ffi:SDL_SCANCODE_OUT)
- (oper . ,ffi:SDL_SCANCODE_OPER)
- (clear-again . ,ffi:SDL_SCANCODE_CLEARAGAIN)
- (crsel . ,ffi:SDL_SCANCODE_CRSEL)
- (exsel . ,ffi:SDL_SCANCODE_EXSEL)
- (keypad-00 . ,ffi:SDL_SCANCODE_KP_00)
- (keypad-000 . ,ffi:SDL_SCANCODE_KP_000)
- (thousands-separator . ,ffi:SDL_SCANCODE_THOUSANDSSEPARATOR)
- (decimal-separator . ,ffi:SDL_SCANCODE_DECIMALSEPARATOR)
- (currency-unit . ,ffi:SDL_SCANCODE_CURRENCYUNIT)
- (current-subunit . ,ffi:SDL_SCANCODE_CURRENCYSUBUNIT)
- (keypad-left-paren . ,ffi:SDL_SCANCODE_KP_LEFTPAREN)
- (keypad-right-paren . ,ffi:SDL_SCANCODE_KP_RIGHTPAREN)
- (keypad-left-brace . ,ffi:SDL_SCANCODE_KP_LEFTBRACE)
- (keypad-right-brace . ,ffi:SDL_SCANCODE_KP_RIGHTBRACE)
- (keypad-tab . ,ffi:SDL_SCANCODE_KP_TAB)
- (keypad-backspace . ,ffi:SDL_SCANCODE_KP_BACKSPACE)
- (keypad-a . ,ffi:SDL_SCANCODE_KP_A)
- (keypad-b . ,ffi:SDL_SCANCODE_KP_B)
- (keypad-c . ,ffi:SDL_SCANCODE_KP_C)
- (keypad-d . ,ffi:SDL_SCANCODE_KP_D)
- (keypad-e . ,ffi:SDL_SCANCODE_KP_E)
- (keypad-f . ,ffi:SDL_SCANCODE_KP_F)
- (keypad-xor . ,ffi:SDL_SCANCODE_KP_XOR)
- (keypad-power . ,ffi:SDL_SCANCODE_KP_POWER)
- (keypad-percent . ,ffi:SDL_SCANCODE_KP_PERCENT)
- (keypad-less . ,ffi:SDL_SCANCODE_KP_LESS)
- (keypad-greater . ,ffi:SDL_SCANCODE_KP_GREATER)
- (keypad-ampersand . ,ffi:SDL_SCANCODE_KP_AMPERSAND)
- (keypad-double-ampersand . ,ffi:SDL_SCANCODE_KP_DBLAMPERSAND)
- (keypad-vertical-bar . ,ffi:SDL_SCANCODE_KP_VERTICALBAR)
- (keypad-double-vertical-bar . ,ffi:SDL_SCANCODE_KP_DBLVERTICALBAR)
- (keypad-colon . ,ffi:SDL_SCANCODE_KP_COLON)
- (keypad-hash . ,ffi:SDL_SCANCODE_KP_HASH)
- (keypad-space . ,ffi:SDL_SCANCODE_KP_SPACE)
- (keypad-at . ,ffi:SDL_SCANCODE_KP_AT)
- (keypad-exclam . ,ffi:SDL_SCANCODE_KP_EXCLAM)
- (keypad-mem-store . ,ffi:SDL_SCANCODE_KP_MEMSTORE)
- (keypad-mem-recall . ,ffi:SDL_SCANCODE_KP_MEMRECALL)
- (keypad-mem-clear . ,ffi:SDL_SCANCODE_KP_MEMCLEAR)
- (keypad-mem-add . ,ffi:SDL_SCANCODE_KP_MEMADD)
- (keypadd-mem-subtract . ,ffi:SDL_SCANCODE_KP_MEMSUBTRACT)
- (keypad-mem-multiply . ,ffi:SDL_SCANCODE_KP_MEMMULTIPLY)
- (keypad-mem-divide . ,ffi:SDL_SCANCODE_KP_MEMDIVIDE)
- (keypad-plus-minus . ,ffi:SDL_SCANCODE_KP_PLUSMINUS)
- (keypad-clear . ,ffi:SDL_SCANCODE_KP_CLEAR)
- (keypad-clear-entry . ,ffi:SDL_SCANCODE_KP_CLEARENTRY)
- (keypad-binary . ,ffi:SDL_SCANCODE_KP_BINARY)
- (keypad-octal . ,ffi:SDL_SCANCODE_KP_OCTAL)
- (keypad-decimal . ,ffi:SDL_SCANCODE_KP_DECIMAL)
- (keypad-hexadecimal . ,ffi:SDL_SCANCODE_KP_HEXADECIMAL)
- (left-control . ,ffi:SDL_SCANCODE_LCTRL)
- (left-shift . ,ffi:SDL_SCANCODE_LSHIFT)
- (left-alt . ,ffi:SDL_SCANCODE_LALT)
- (left-gui . ,ffi:SDL_SCANCODE_LGUI)
- (right-control . ,ffi:SDL_SCANCODE_RCTRL)
- (right-shift . ,ffi:SDL_SCANCODE_RSHIFT)
- (right-alt . ,ffi:SDL_SCANCODE_RALT)
- (right-cui . ,ffi:SDL_SCANCODE_RGUI)
- (mode . ,ffi:SDL_SCANCODE_MODE)
- (audio-next . ,ffi:SDL_SCANCODE_AUDIONEXT)
- (audio-prev . ,ffi:SDL_SCANCODE_AUDIOPREV)
- (audio-stop . ,ffi:SDL_SCANCODE_AUDIOSTOP)
- (audio-play . ,ffi:SDL_SCANCODE_AUDIOPLAY)
- (audio-mute . ,ffi:SDL_SCANCODE_AUDIOMUTE)
- (media-select . ,ffi:SDL_SCANCODE_MEDIASELECT)
- (www . ,ffi:SDL_SCANCODE_WWW)
- (mail . ,ffi:SDL_SCANCODE_MAIL)
- (calculator . ,ffi:SDL_SCANCODE_CALCULATOR)
- (computer . ,ffi:SDL_SCANCODE_COMPUTER)
- (ac-search . ,ffi:SDL_SCANCODE_AC_SEARCH)
- (ac-home . ,ffi:SDL_SCANCODE_AC_HOME)
- (ac-back . ,ffi:SDL_SCANCODE_AC_BACK)
- (ac-forward . ,ffi:SDL_SCANCODE_AC_FORWARD)
- (ac-stop . ,ffi:SDL_SCANCODE_AC_STOP)
- (ac-refresh . ,ffi:SDL_SCANCODE_AC_REFRESH)
- (ac-bookmarks . ,ffi:SDL_SCANCODE_AC_BOOKMARKS)
- (brightness-down . ,ffi:SDL_SCANCODE_BRIGHTNESSDOWN)
- (brightness-up . ,ffi:SDL_SCANCODE_BRIGHTNESSUP)
- (display-switch . ,ffi:SDL_SCANCODE_DISPLAYSWITCH)
- (keyboard-illum-toggle . ,ffi:SDL_SCANCODE_KBDILLUMTOGGLE)
- (keyboard-illum-down . ,ffi:SDL_SCANCODE_KBDILLUMDOWN)
- (keyboard-illum-up . ,ffi:SDL_SCANCODE_KBDILLUMUP)
- (eject . ,ffi:SDL_SCANCODE_EJECT)
- (sleep . ,ffi:SDL_SCANCODE_SLEEP)
- (app-1 . ,ffi:SDL_SCANCODE_APP1)
- (app-2 . ,ffi:SDL_SCANCODE_APP2))))
+ `((return . ,ffi:SDLK_RETURN)
+ (escape . ,ffi:SDLK_ESCAPE)
+ (backspace . ,ffi:SDLK_BACKSPACE)
+ (tab . ,ffi:SDLK_TAB)
+ (space . ,ffi:SDLK_SPACE)
+ (exclaim . ,ffi:SDLK_EXCLAIM)
+ (quotedbl . ,ffi:SDLK_QUOTEDBL)
+ (hash . ,ffi:SDLK_HASH)
+ (percent . ,ffi:SDLK_PERCENT)
+ (dollar . ,ffi:SDLK_DOLLAR)
+ (ampersand . ,ffi:SDLK_AMPERSAND)
+ (quote . ,ffi:SDLK_QUOTE)
+ (left-paren . ,ffi:SDLK_LEFTPAREN)
+ (right-paren . ,ffi:SDLK_RIGHTPAREN)
+ (asterisk . ,ffi:SDLK_ASTERISK)
+ (plus . ,ffi:SDLK_PLUS)
+ (comma . ,ffi:SDLK_COMMA)
+ (minus . ,ffi:SDLK_MINUS)
+ (period . ,ffi:SDLK_PERIOD)
+ (slash . ,ffi:SDLK_SLASH)
+ (0 . ,ffi:SDLK_0)
+ (1 . ,ffi:SDLK_1)
+ (2 . ,ffi:SDLK_2)
+ (3 . ,ffi:SDLK_3)
+ (4 . ,ffi:SDLK_4)
+ (5 . ,ffi:SDLK_5)
+ (6 . ,ffi:SDLK_6)
+ (7 . ,ffi:SDLK_7)
+ (8 . ,ffi:SDLK_8)
+ (9 . ,ffi:SDLK_9)
+ (colon . ,ffi:SDLK_COLON)
+ (semicolon . ,ffi:SDLK_SEMICOLON)
+ (less . ,ffi:SDLK_LESS)
+ (equals . ,ffi:SDLK_EQUALS)
+ (greater . ,ffi:SDLK_GREATER)
+ (question . ,ffi:SDLK_QUESTION)
+ (at . ,ffi:SDLK_AT)
+ (left-bracket . ,ffi:SDLK_LEFTBRACKET)
+ (backslash . ,ffi:SDLK_BACKSLASH)
+ (right-bracket . ,ffi:SDLK_RIGHTBRACKET)
+ (caret . ,ffi:SDLK_CARET)
+ (underscore . ,ffi:SDLK_UNDERSCORE)
+ (backquote . ,ffi:SDLK_BACKQUOTE)
+ (a . ,ffi:SDLK_a)
+ (b . ,ffi:SDLK_b)
+ (c . ,ffi:SDLK_c)
+ (d . ,ffi:SDLK_d)
+ (e . ,ffi:SDLK_e)
+ (f . ,ffi:SDLK_f)
+ (g . ,ffi:SDLK_g)
+ (h . ,ffi:SDLK_h)
+ (i . ,ffi:SDLK_i)
+ (j . ,ffi:SDLK_j)
+ (k . ,ffi:SDLK_k)
+ (l . ,ffi:SDLK_l)
+ (m . ,ffi:SDLK_m)
+ (n . ,ffi:SDLK_n)
+ (o . ,ffi:SDLK_o)
+ (p . ,ffi:SDLK_p)
+ (q . ,ffi:SDLK_q)
+ (r . ,ffi:SDLK_r)
+ (s . ,ffi:SDLK_s)
+ (t . ,ffi:SDLK_t)
+ (u . ,ffi:SDLK_u)
+ (v . ,ffi:SDLK_v)
+ (w . ,ffi:SDLK_w)
+ (x . ,ffi:SDLK_x)
+ (y . ,ffi:SDLK_y)
+ (z . ,ffi:SDLK_z)
+ (caps-lock . ,ffi:SDLK_CAPSLOCK)
+ (f1 . ,ffi:SDLK_F1)
+ (f2 . ,ffi:SDLK_F2)
+ (f3 . ,ffi:SDLK_F3)
+ (f4 . ,ffi:SDLK_F4)
+ (f5 . ,ffi:SDLK_F5)
+ (f6 . ,ffi:SDLK_F6)
+ (f7 . ,ffi:SDLK_F7)
+ (f8 . ,ffi:SDLK_F8)
+ (f9 . ,ffi:SDLK_F9)
+ (f10 . ,ffi:SDLK_F10)
+ (f11 . ,ffi:SDLK_F11)
+ (f12 . ,ffi:SDLK_F12)
+ (print-screen . ,ffi:SDLK_PRINTSCREEN)
+ (scroll-lock . ,ffi:SDLK_SCROLLLOCK)
+ (pause . ,ffi:SDLK_PAUSE)
+ (insert . ,ffi:SDLK_INSERT)
+ (home . ,ffi:SDLK_HOME)
+ (page-up . ,ffi:SDLK_PAGEUP)
+ (delete . ,ffi:SDLK_DELETE)
+ (end . ,ffi:SDLK_END)
+ (page-down . ,ffi:SDLK_PAGEDOWN)
+ (right . ,ffi:SDLK_RIGHT)
+ (left . ,ffi:SDLK_LEFT)
+ (down . ,ffi:SDLK_DOWN)
+ (up . ,ffi:SDLK_UP)
+ (num-lock-clear . ,ffi:SDLK_NUMLOCKCLEAR)
+ (keypad-divide . ,ffi:SDLK_KP_DIVIDE)
+ (keypad-multiply . ,ffi:SDLK_KP_MULTIPLY)
+ (keypad-minus . ,ffi:SDLK_KP_MINUS)
+ (keypad-plus . ,ffi:SDLK_KP_PLUS)
+ (keypad-enter . ,ffi:SDLK_KP_ENTER)
+ (keypad-1 . ,ffi:SDLK_KP_1)
+ (keypad-2 . ,ffi:SDLK_KP_2)
+ (keypad-3 . ,ffi:SDLK_KP_3)
+ (keypad-4 . ,ffi:SDLK_KP_4)
+ (keypad-5 . ,ffi:SDLK_KP_5)
+ (keypad-6 . ,ffi:SDLK_KP_6)
+ (keypad-7 . ,ffi:SDLK_KP_7)
+ (keypad-8 . ,ffi:SDLK_KP_8)
+ (keypad-9 . ,ffi:SDLK_KP_9)
+ (keypad-0 . ,ffi:SDLK_KP_0)
+ (keypad-period . ,ffi:SDLK_KP_PERIOD)
+ (application . ,ffi:SDLK_APPLICATION)
+ (power . ,ffi:SDLK_POWER)
+ (keypad-equals . ,ffi:SDLK_KP_EQUALS)
+ (f13 . ,ffi:SDLK_F13)
+ (f14 . ,ffi:SDLK_F14)
+ (f15 . ,ffi:SDLK_F15)
+ (f16 . ,ffi:SDLK_F16)
+ (f17 . ,ffi:SDLK_F17)
+ (f18 . ,ffi:SDLK_F18)
+ (f19 . ,ffi:SDLK_F19)
+ (f20 . ,ffi:SDLK_F20)
+ (f21 . ,ffi:SDLK_F21)
+ (f22 . ,ffi:SDLK_F22)
+ (f23 . ,ffi:SDLK_F23)
+ (f24 . ,ffi:SDLK_F24)
+ (execute . ,ffi:SDLK_EXECUTE)
+ (help . ,ffi:SDLK_HELP)
+ (menu . ,ffi:SDLK_MENU)
+ (select . ,ffi:SDLK_SELECT)
+ (stop . ,ffi:SDLK_STOP)
+ (again . ,ffi:SDLK_AGAIN)
+ (undo . ,ffi:SDLK_UNDO)
+ (cut . ,ffi:SDLK_CUT)
+ (copy . ,ffi:SDLK_COPY)
+ (paste . ,ffi:SDLK_PASTE)
+ (find . ,ffi:SDLK_FIND)
+ (mute . ,ffi:SDLK_MUTE)
+ (volume-up . ,ffi:SDLK_VOLUMEUP)
+ (volume-down . ,ffi:SDLK_VOLUMEDOWN)
+ (keypad-comma . ,ffi:SDLK_KP_COMMA)
+ (keypad-equals-as400 . ,ffi:SDLK_KP_EQUALSAS400)
+ (alt-erase . ,ffi:SDLK_ALTERASE)
+ (sysreq . ,ffi:SDLK_SYSREQ)
+ (cancel . ,ffi:SDLK_CANCEL)
+ (clear . ,ffi:SDLK_CLEAR)
+ (prior . ,ffi:SDLK_PRIOR)
+ (return2 . ,ffi:SDLK_RETURN2)
+ (separator . ,ffi:SDLK_SEPARATOR)
+ (out . ,ffi:SDLK_OUT)
+ (oper . ,ffi:SDLK_OPER)
+ (clear-again . ,ffi:SDLK_CLEARAGAIN)
+ (crsel . ,ffi:SDLK_CRSEL)
+ (exsel . ,ffi:SDLK_EXSEL)
+ (keypad-00 . ,ffi:SDLK_KP_00)
+ (keypad-000 . ,ffi:SDLK_KP_000)
+ (thousands-separator . ,ffi:SDLK_THOUSANDSSEPARATOR)
+ (decimal-separator . ,ffi:SDLK_DECIMALSEPARATOR)
+ (currency-unit . ,ffi:SDLK_CURRENCYUNIT)
+ (currency-subunit . ,ffi:SDLK_CURRENCYSUBUNIT)
+ (keypad-left-paren . ,ffi:SDLK_KP_LEFTPAREN)
+ (keypad-right-paren . ,ffi:SDLK_KP_RIGHTPAREN)
+ (keypad-left-brace . ,ffi:SDLK_KP_LEFTBRACE)
+ (keypad-right-brace . ,ffi:SDLK_KP_RIGHTBRACE)
+ (keypad-tab . ,ffi:SDLK_KP_TAB)
+ (keypad-backspace . ,ffi:SDLK_KP_BACKSPACE)
+ (keypad-a . ,ffi:SDLK_KP_A)
+ (keypad-b . ,ffi:SDLK_KP_B)
+ (keypad-c . ,ffi:SDLK_KP_C)
+ (keypad-d . ,ffi:SDLK_KP_D)
+ (keypad-e . ,ffi:SDLK_KP_E)
+ (keypad-f . ,ffi:SDLK_KP_F)
+ (keypad-xor . ,ffi:SDLK_KP_XOR)
+ (keypad-power . ,ffi:SDLK_KP_POWER)
+ (keypad-percent . ,ffi:SDLK_KP_PERCENT)
+ (keypad-less . ,ffi:SDLK_KP_LESS)
+ (keypad-greater . ,ffi:SDLK_KP_GREATER)
+ (keypad-ampersand . ,ffi:SDLK_KP_AMPERSAND)
+ (keypad-dbl-ampersand . ,ffi:SDLK_KP_DBLAMPERSAND)
+ (keypad-vertical-bar . ,ffi:SDLK_KP_VERTICALBAR)
+ (keypad-dbl-vertical-bar . ,ffi:SDLK_KP_DBLVERTICALBAR)
+ (keypad-colon . ,ffi:SDLK_KP_COLON)
+ (keypad-hash . ,ffi:SDLK_KP_HASH)
+ (keypad-space . ,ffi:SDLK_KP_SPACE)
+ (keypad-at . ,ffi:SDLK_KP_AT)
+ (keypad-exclam . ,ffi:SDLK_KP_EXCLAM)
+ (keypad-mem-store . ,ffi:SDLK_KP_MEMSTORE)
+ (keypad-mem-recall . ,ffi:SDLK_KP_MEMRECALL)
+ (keypad-mem-clear . ,ffi:SDLK_KP_MEMCLEAR)
+ (keypad-mem-add . ,ffi:SDLK_KP_MEMADD)
+ (keypad-mem-subtract . ,ffi:SDLK_KP_MEMSUBTRACT)
+ (keypad-mem-multiply . ,ffi:SDLK_KP_MEMMULTIPLY)
+ (keypad-mem-divide . ,ffi:SDLK_KP_MEMDIVIDE)
+ (keypad-plus-minus . ,ffi:SDLK_KP_PLUSMINUS)
+ (keypad-clear . ,ffi:SDLK_KP_CLEAR)
+ (keypad-clear-entry . ,ffi:SDLK_KP_CLEARENTRY)
+ (keypad-binary . ,ffi:SDLK_KP_BINARY)
+ (keypad-octal . ,ffi:SDLK_KP_OCTAL)
+ (keypad-decimal . ,ffi:SDLK_KP_DECIMAL)
+ (keypad-hexadecimal . ,ffi:SDLK_KP_HEXADECIMAL)
+ (left-ctrl . ,ffi:SDLK_LCTRL)
+ (left-shift . ,ffi:SDLK_LSHIFT)
+ (left-alt . ,ffi:SDLK_LALT)
+ (left-gui . ,ffi:SDLK_LGUI)
+ (right-ctrl . ,ffi:SDLK_RCTRL)
+ (right-shift . ,ffi:SDLK_RSHIFT)
+ (right-alt . ,ffi:SDLK_RALT)
+ (right-gui . ,ffi:SDLK_RGUI)
+ (mode . ,ffi:SDLK_MODE)
+ (audio-next . ,ffi:SDLK_AUDIONEXT)
+ (audio-prev . ,ffi:SDLK_AUDIOPREV)
+ (audio-stop . ,ffi:SDLK_AUDIOSTOP)
+ (audio-play . ,ffi:SDLK_AUDIOPLAY)
+ (audio-mute . ,ffi:SDLK_AUDIOMUTE)
+ (media-select . ,ffi:SDLK_MEDIASELECT)
+ (www . ,ffi:SDLK_WWW)
+ (mail . ,ffi:SDLK_MAIL)
+ (calculator . ,ffi:SDLK_CALCULATOR)
+ (computer . ,ffi:SDLK_COMPUTER)
+ (ac-search . ,ffi:SDLK_AC_SEARCH)
+ (ac-home . ,ffi:SDLK_AC_HOME)
+ (ac-back . ,ffi:SDLK_AC_BACK)
+ (ac-forward . ,ffi:SDLK_AC_FORWARD)
+ (ac-stop . ,ffi:SDLK_AC_STOP)
+ (ac-refresh . ,ffi:SDLK_AC_REFRESH)
+ (ac-bookmarks . ,ffi:SDLK_AC_BOOKMARKS)
+ (brightness-down . ,ffi:SDLK_BRIGHTNESSDOWN)
+ (brightness-up . ,ffi:SDLK_BRIGHTNESSUP)
+ (display-switch . ,ffi:SDLK_DISPLAYSWITCH)
+ (kbd-illum-toggle . ,ffi:SDLK_KBDILLUMTOGGLE)
+ (kbd-illum-down . ,ffi:SDLK_KBDILLUMDOWN)
+ (kbd-illum-up . ,ffi:SDLK_KBDILLUMUP)
+ (eject . ,ffi:SDLK_EJECT)
+ (sleep . ,ffi:SDLK_SLEEP))))
(define key-pressed?
(let ((keystate (pointer->bytevector
@@ -281,7 +275,9 @@
ffi:SDL_NUM_SCANCODES)))
(lambda (key)
"Return #t if KEY is currently being pressed."
- (= 1 (u8vector-ref keystate (hashq-ref scancode-map key))))))
+ (let ((scancode (ffi:sdl-get-scancode-from-key
+ (hashq-ref keycode-map key))))
+ (= 1 (u8vector-ref keystate scancode))))))
(define (key-released? key)
"Return #t if KEY is not currently being pressed."