dd0a6191454e1f3705103832fb04276fe72e74ce
[guile-sdl2.git] / sdl2 / bindings.scm
1 ;;; guile-sdl2 --- FFI bindings for SDL2
2 ;;; Copyright © 2015, 2016 David Thompson <davet@gnu.org>
3 ;;;
4 ;;; This file is part of guile-sdl2.
5 ;;;
6 ;;; Guile-sdl2 is free software; you can redistribute it and/or modify
7 ;;; it under the terms of the GNU Lesser General Public License as
8 ;;; published by the Free Software Foundation; either version 3 of the
9 ;;; License, or (at your option) any later version.
10 ;;;
11 ;;; Guile-sdl2 is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ;;; General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU Lesser General Public
17 ;;; License along with guile-sdl2. If not, see
18 ;;; <http://www.gnu.org/licenses/>.
19
20 ;;; Commentary:
21 ;;
22 ;; Low-level FFI bindings.
23 ;;
24 ;;; Code:
25
26 (define-module (sdl2 bindings)
27 #:use-module (system foreign)
28 #:use-module (sdl2 config))
29
30 (define sdl-func
31 (let ((lib (dynamic-link %libsdl2)))
32 (lambda (return-type function-name arg-types)
33 "Return a procedure for the foreign function FUNCTION-NAME in
34 the SDL2 shared library. That function must return a value of
35 RETURN-TYPE and accept arguments of ARG-TYPES."
36 (pointer->procedure return-type
37 (dynamic-func function-name lib)
38 arg-types))))
39
40 (define-syntax-rule (define-foreign name return-type func-name arg-types)
41 (define-public name
42 (sdl-func return-type func-name arg-types)))
43
44 \f
45 ;;;
46 ;;; Foreign Types
47 ;;;
48
49 (define-public sdl-color
50 (list uint8 uint8 uint8 uint8))
51
52 (define-public sdl-rect
53 (list int int int int))
54
55 (define sdl-bool int)
56
57 (define-public (boolean->sdl-bool b)
58 "Convert the boolean B to an SDL_bool."
59 (if b 1 0))
60
61 \f
62 ;;;
63 ;;; Errors
64 ;;;
65
66 (define-foreign sdl-get-error
67 '* "SDL_GetError" '())
68
69 \f
70 ;;;
71 ;;; Initialization
72 ;;;
73
74 (define-public SDL_INIT_TIMER #x00000001)
75 (define-public SDL_INIT_AUDIO #x00000010)
76 (define-public SDL_INIT_VIDEO #x00000020)
77 (define-public SDL_INIT_JOYSTICK #x00000200)
78 (define-public SDL_INIT_HAPTIC #x00001000)
79 (define-public SDL_INIT_GAMECONTROLLER #x00002000)
80 (define-public SDL_INIT_EVENTS #x00004000)
81
82 (define-foreign sdl-init
83 int "SDL_Init" (list uint32))
84
85 (define-foreign sdl-quit
86 void "SDL_Quit" '())
87
88 \f
89 ;;;
90 ;;; Version
91 ;;;
92
93 (define-foreign sdl-get-version
94 void "SDL_GetVersion" '(*))
95
96 \f
97 ;;;
98 ;;; Video
99 ;;;
100
101 (define-public SDL_WINDOW_FULLSCREEN #x00000001)
102 (define-public SDL_WINDOW_OPENGL #x00000002)
103 (define-public SDL_WINDOW_SHOWN #x00000004)
104 (define-public SDL_WINDOW_HIDDEN #x00000008)
105 (define-public SDL_WINDOW_BORDERLESS #x00000010)
106 (define-public SDL_WINDOW_RESIZABLE #x00000020)
107 (define-public SDL_WINDOW_MINIMIZED #x00000040)
108 (define-public SDL_WINDOW_MAXIMIZED #x00000080)
109 (define-public SDL_WINDOW_INPUT_GRABBED #x00000100)
110 (define-public SDL_WINDOW_INPUT_FOCUS #x00000200)
111 (define-public SDL_WINDOW_MOUSE_FOCUS #x00000400)
112 (define-public SDL_WINDOW_FULLSCREEN_DESKTOP (logior SDL_WINDOW_FULLSCREEN
113 #x00001000))
114 (define-public SDL_WINDOW_FOREIGN #x00000800)
115 (define-public SDL_WINDOW_ALLOW_HIGHDPI #x00002000)
116 (define-public SDL_WINDOW_MOUSE_CAPTURE #x00004000)
117
118 (define-public SDL_WINDOWPOS_CENTERED 805240832)
119 (define-public SDL_WINDOWPOS_UNDEFINED 536805376)
120
121 (define-foreign sdl-create-window
122 '* "SDL_CreateWindow" (list '* int int int int uint32))
123
124 (define-foreign sdl-destroy-window
125 void "SDL_DestroyWindow" '(*))
126
127 (define-foreign sdl-get-window-title
128 '* "SDL_GetWindowTitle" '(*))
129
130 (define-foreign sdl-get-window-size
131 void "SDL_GetWindowSize" '(* * *))
132
133 (define-foreign sdl-get-window-position
134 void "SDL_GetWindowPosition" '(* * *))
135
136 (define-foreign sdl-get-window-id
137 uint32 "SDL_GetWindowID" '(*))
138
139 (define-foreign sdl-get-window-from-id
140 '* "SDL_GetWindowFromID" (list uint32))
141
142 (define-foreign sdl-hide-window
143 void "SDL_HideWindow" '(*))
144
145 (define-foreign sdl-show-window
146 void "SDL_ShowWindow" '(*))
147
148 (define-foreign sdl-maximize-window
149 void "SDL_MaximizeWindow" '(*))
150
151 (define-foreign sdl-minimize-window
152 void "SDL_MinimizeWindow" '(*))
153
154 (define-foreign sdl-raise-window
155 void "SDL_RaiseWindow" '(*))
156
157 (define-foreign sdl-restore-window
158 void "SDL_RestoreWindow" '(*))
159
160 (define-foreign sdl-set-window-bordered
161 void "SDL_SetWindowBordered" (list '* sdl-bool))
162
163 (define-foreign sdl-set-window-title
164 void "SDL_SetWindowTitle" '(* *))
165
166 (define-foreign sdl-set-window-position
167 void "SDL_SetWindowPosition" (list '* int int))
168
169 (define-foreign sdl-set-window-size
170 void "SDL_SetWindowSize" (list '* int int))
171
172 (define-foreign sdl-set-window-fullscreen
173 int "SDL_SetWindowFullscreen" (list '* uint32))
174
175 (define-foreign sdl-gl-create-context
176 '* "SDL_GL_CreateContext" '(*))
177
178 (define-foreign sdl-gl-delete-context
179 void "SDL_GL_DeleteContext" '(*))
180
181 (define-foreign sdl-gl-swap-window
182 void "SDL_GL_SwapWindow" '(*))
183
184 (define-public SDL_GL_RED_SIZE 0)
185 (define-public SDL_GL_GREEN_SIZE 1)
186 (define-public SDL_GL_BLUE_SIZE 2)
187 (define-public SDL_GL_ALPHA_SIZE 3)
188 (define-public SDL_GL_BUFFER_SIZE 4)
189 (define-public SDL_GL_DOUBLEBUFFER 5)
190 (define-public SDL_GL_DEPTH_SIZE 6)
191 (define-public SDL_GL_STENCIL_SIZE 7)
192 (define-public SDL_GL_ACCUM_RED_SIZE 8)
193 (define-public SDL_GL_ACCUM_GREEN_SIZE 9)
194 (define-public SDL_GL_ACCUM_BLUE_SIZE 10)
195 (define-public SDL_GL_ACCUM_ALPHA_SIZE 11)
196 (define-public SDL_GL_STEREO 12)
197 (define-public SDL_GL_MULTISAMPLEBUFFERS 13)
198 (define-public SDL_GL_MULTISAMPLESAMPLES 14)
199 (define-public SDL_GL_ACCELERATED_VISUAL 15)
200 (define-public SDL_GL_RETAINED_BACKING 16)
201 (define-public SDL_GL_CONTEXT_MAJOR_VERSION 17)
202 (define-public SDL_GL_CONTEXT_MINOR_VERSION 18)
203 (define-public SDL_GL_CONTEXT_EGL 19)
204 (define-public SDL_GL_CONTEXT_FLAGS 20)
205 (define-public SDL_GL_CONTEXT_PROFILE_MASK 21)
206 (define-public SDL_GL_SHARE_WITH_CURRENT_CONTEXT 22)
207 (define-public SDL_GL_FRAMEBUFFER_SRGB_CAPABLE 23)
208
209 (define-foreign sdl-gl-set-attribute
210 int "SDL_GL_SetAttribute" (list int int))
211
212 (define-foreign sdl-gl-set-swap-interval
213 int "SDL_GL_SetSwapInterval" (list int))
214
215 (define-public SDL_RENDERER_SOFTWARE #x00000001)
216 (define-public SDL_RENDERER_ACCELERATED #x00000002)
217 (define-public SDL_RENDERER_PRESENTVSYNC #x00000004)
218 (define-public SDL_RENDERER_TARGETTEXTURE #x00000008)
219
220 (define-foreign sdl-create-renderer
221 '* "SDL_CreateRenderer" (list '* int uint32))
222
223 (define-foreign sdl-destroy-renderer
224 void "SDL_DestroyRenderer" '(*))
225
226 (define-foreign sdl-render-clear
227 int "SDL_RenderClear" '(*))
228
229 (define-foreign sdl-render-present
230 void "SDL_RenderPresent" '(*))
231
232 (define-foreign sdl-render-copy
233 int "SDL_RenderCopy" '(* * * *))
234
235 (define-foreign sdl-create-texture-from-surface
236 '* "SDL_CreateTextureFromSurface" '(* *))
237
238 \f
239 ;;;
240 ;;; Events
241 ;;;
242
243 (define-public SDL_QUIT #x100)
244 (define-public SDL_APP_TERMINATING #x101)
245 (define-public SDL_APP_LOWMEMORY #x102)
246 (define-public SDL_APP_WILLENTERBACKGROUND #x103)
247 (define-public SDL_APP_DIDENTERBACKGROUND #x104)
248 (define-public SDL_APP_WILLENTERFOREGROUND #x105)
249 (define-public SDL_APP_DIDENTERFOREGROUND #x106)
250 (define-public SDL_WINDOWEVENT #x200)
251 (define-public SDL_SYSWMEVENT #x201)
252 (define-public SDL_KEYDOWN #x300)
253 (define-public SDL_KEYUP #x301)
254 (define-public SDL_TEXTEDITING #x302)
255 (define-public SDL_TEXTINPUT #x303)
256 (define-public SDL_MOUSEMOTION #x400)
257 (define-public SDL_MOUSEBUTTONDOWN #x401)
258 (define-public SDL_MOUSEBUTTONUP #x402)
259 (define-public SDL_MOUSEWHEEL #x403)
260 (define-public SDL_JOYAXISMOTION #x600)
261 (define-public SDL_JOYBALLMOTION #x601)
262 (define-public SDL_JOYHATMOTION #x602)
263 (define-public SDL_JOYBUTTONDOWN #x603)
264 (define-public SDL_JOYBUTTONUP #x604)
265 (define-public SDL_JOYDEVICEADDED #x605)
266 (define-public SDL_JOYDEVICEREMOVED #x606)
267 (define-public SDL_CONTROLLERAXISMOTION #x650)
268 (define-public SDL_CONTROLLERBUTTONDOWN #x651)
269 (define-public SDL_CONTROLLERBUTTONUP #x652)
270 (define-public SDL_CONTROLLERDEVICEADDED #x653)
271 (define-public SDL_CONTROLLERDEVICEREMOVED #x654)
272 (define-public SDL_CONTROLLERDEVICEREMAPPED #x655)
273 (define-public SDL_FINGERDOWN #x700)
274 (define-public SDL_FINGERUP #x701)
275 (define-public SDL_FINGERMOTION #x702)
276 (define-public SDL_DOLLARGESTURE #x800)
277 (define-public SDL_DOLLARRECORD #x801)
278 (define-public SDL_MULTIGESTURE #x802)
279 (define-public SDL_CLIPBOARDUPDATE #x900)
280 (define-public SDL_DROPFILE #x1000)
281 (define-public SDL_RENDER_TARGETS_RESET #x2000)
282 (define-public SDL_USEREVENT #x8000)
283
284 (define-public SDL_RELEASED 0)
285 (define-public SDL_PRESSED 1)
286
287 (define-public SDL_WINDOWEVENT_NONE 0)
288 (define-public SDL_WINDOWEVENT_SHOWN 1)
289 (define-public SDL_WINDOWEVENT_HIDDEN 2)
290 (define-public SDL_WINDOWEVENT_EXPOSED 3)
291 (define-public SDL_WINDOWEVENT_MOVED 4)
292 (define-public SDL_WINDOWEVENT_RESIZED 5)
293 (define-public SDL_WINDOWEVENT_SIZE_CHANGED 6)
294 (define-public SDL_WINDOWEVENT_MINIMIZED 7)
295 (define-public SDL_WINDOWEVENT_MAXIMIZED 8)
296 (define-public SDL_WINDOWEVENT_RESTORED 9)
297 (define-public SDL_WINDOWEVENT_ENTER 10)
298 (define-public SDL_WINDOWEVENT_LEAVE 11)
299 (define-public SDL_WINDOWEVENT_FOCUS_GAINED 12)
300 (define-public SDL_WINDOWEVENT_FOCUS_LOST 13)
301 (define-public SDL_WINDOWEVENT_CLOSE 14)
302
303 (define-foreign sdl-poll-event
304 int "SDL_PollEvent" '(*))
305
306 \f
307 ;;;
308 ;;; Keycodes and scancodes
309 ;;;
310
311 (define-public KMOD_NONE #x0000)
312 (define-public KMOD_LSHIFT #x0001)
313 (define-public KMOD_RSHIFT #x0002)
314 (define-public KMOD_LCTRL #x0040)
315 (define-public KMOD_RCTRL #x0080)
316 (define-public KMOD_LALT #x0100)
317 (define-public KMOD_RALT #x0200)
318 (define-public KMOD_LGUI #x0400)
319 (define-public KMOD_RGUI #x0800)
320 (define-public KMOD_NUM #x1000)
321 (define-public KMOD_CAPS #x2000)
322 (define-public KMOD_MODE #x4000)
323
324 (define-public SDLK_SCANCODE_MASK (ash 1 30))
325
326 (define-public (scancode->keycode scancode)
327 (logior scancode SDLK_SCANCODE_MASK))
328
329 (define-public SDL_SCANCODE_UNKNOWN 0)
330 (define-public SDL_SCANCODE_A 4)
331 (define-public SDL_SCANCODE_B 5)
332 (define-public SDL_SCANCODE_C 6)
333 (define-public SDL_SCANCODE_D 7)
334 (define-public SDL_SCANCODE_E 8)
335 (define-public SDL_SCANCODE_F 9)
336 (define-public SDL_SCANCODE_G 10)
337 (define-public SDL_SCANCODE_H 11)
338 (define-public SDL_SCANCODE_I 12)
339 (define-public SDL_SCANCODE_J 13)
340 (define-public SDL_SCANCODE_K 14)
341 (define-public SDL_SCANCODE_L 15)
342 (define-public SDL_SCANCODE_M 16)
343 (define-public SDL_SCANCODE_N 17)
344 (define-public SDL_SCANCODE_O 18)
345 (define-public SDL_SCANCODE_P 19)
346 (define-public SDL_SCANCODE_Q 20)
347 (define-public SDL_SCANCODE_R 21)
348 (define-public SDL_SCANCODE_S 22)
349 (define-public SDL_SCANCODE_T 23)
350 (define-public SDL_SCANCODE_U 24)
351 (define-public SDL_SCANCODE_V 25)
352 (define-public SDL_SCANCODE_W 26)
353 (define-public SDL_SCANCODE_X 27)
354 (define-public SDL_SCANCODE_Y 28)
355 (define-public SDL_SCANCODE_Z 29)
356 (define-public SDL_SCANCODE_1 30)
357 (define-public SDL_SCANCODE_2 31)
358 (define-public SDL_SCANCODE_3 32)
359 (define-public SDL_SCANCODE_4 33)
360 (define-public SDL_SCANCODE_5 34)
361 (define-public SDL_SCANCODE_6 35)
362 (define-public SDL_SCANCODE_7 36)
363 (define-public SDL_SCANCODE_8 37)
364 (define-public SDL_SCANCODE_9 38)
365 (define-public SDL_SCANCODE_0 39)
366 (define-public SDL_SCANCODE_RETURN 40)
367 (define-public SDL_SCANCODE_ESCAPE 41)
368 (define-public SDL_SCANCODE_BACKSPACE 42)
369 (define-public SDL_SCANCODE_TAB 43)
370 (define-public SDL_SCANCODE_SPACE 44)
371 (define-public SDL_SCANCODE_MINUS 45)
372 (define-public SDL_SCANCODE_EQUALS 46)
373 (define-public SDL_SCANCODE_LEFTBRACKET 47)
374 (define-public SDL_SCANCODE_RIGHTBRACKET 48)
375 (define-public SDL_SCANCODE_BACKSLASH 49)
376 (define-public SDL_SCANCODE_NONUSHASH 50)
377 (define-public SDL_SCANCODE_SEMICOLON 51)
378 (define-public SDL_SCANCODE_APOSTROPHE 52)
379 (define-public SDL_SCANCODE_GRAVE 53)
380 (define-public SDL_SCANCODE_COMMA 54)
381 (define-public SDL_SCANCODE_PERIOD 55)
382 (define-public SDL_SCANCODE_SLASH 56)
383 (define-public SDL_SCANCODE_CAPSLOCK 57)
384 (define-public SDL_SCANCODE_F1 58)
385 (define-public SDL_SCANCODE_F2 59)
386 (define-public SDL_SCANCODE_F3 60)
387 (define-public SDL_SCANCODE_F4 61)
388 (define-public SDL_SCANCODE_F5 62)
389 (define-public SDL_SCANCODE_F6 63)
390 (define-public SDL_SCANCODE_F7 64)
391 (define-public SDL_SCANCODE_F8 65)
392 (define-public SDL_SCANCODE_F9 66)
393 (define-public SDL_SCANCODE_F10 67)
394 (define-public SDL_SCANCODE_F11 68)
395 (define-public SDL_SCANCODE_F12 69)
396 (define-public SDL_SCANCODE_PRINTSCREEN 70)
397 (define-public SDL_SCANCODE_SCROLLLOCK 71)
398 (define-public SDL_SCANCODE_PAUSE 72)
399 (define-public SDL_SCANCODE_INSERT 73)
400 (define-public SDL_SCANCODE_HOME 74)
401 (define-public SDL_SCANCODE_PAGEUP 75)
402 (define-public SDL_SCANCODE_DELETE 76)
403 (define-public SDL_SCANCODE_END 77)
404 (define-public SDL_SCANCODE_PAGEDOWN 78)
405 (define-public SDL_SCANCODE_RIGHT 79)
406 (define-public SDL_SCANCODE_LEFT 80)
407 (define-public SDL_SCANCODE_DOWN 81)
408 (define-public SDL_SCANCODE_UP 82)
409 (define-public SDL_SCANCODE_NUMLOCKCLEAR 83)
410 (define-public SDL_SCANCODE_KP_DIVIDE 84)
411 (define-public SDL_SCANCODE_KP_MULTIPLY 85)
412 (define-public SDL_SCANCODE_KP_MINUS 86)
413 (define-public SDL_SCANCODE_KP_PLUS 87)
414 (define-public SDL_SCANCODE_KP_ENTER 88)
415 (define-public SDL_SCANCODE_KP_1 89)
416 (define-public SDL_SCANCODE_KP_2 90)
417 (define-public SDL_SCANCODE_KP_3 91)
418 (define-public SDL_SCANCODE_KP_4 92)
419 (define-public SDL_SCANCODE_KP_5 93)
420 (define-public SDL_SCANCODE_KP_6 94)
421 (define-public SDL_SCANCODE_KP_7 95)
422 (define-public SDL_SCANCODE_KP_8 96)
423 (define-public SDL_SCANCODE_KP_9 97)
424 (define-public SDL_SCANCODE_KP_0 98)
425 (define-public SDL_SCANCODE_KP_PERIOD 99)
426 (define-public SDL_SCANCODE_NONUSBACKSLASH 100)
427 (define-public SDL_SCANCODE_APPLICATION 101)
428 (define-public SDL_SCANCODE_POWER 102)
429 (define-public SDL_SCANCODE_KP_EQUALS 103)
430 (define-public SDL_SCANCODE_F13 104)
431 (define-public SDL_SCANCODE_F14 105)
432 (define-public SDL_SCANCODE_F15 106)
433 (define-public SDL_SCANCODE_F16 107)
434 (define-public SDL_SCANCODE_F17 108)
435 (define-public SDL_SCANCODE_F18 109)
436 (define-public SDL_SCANCODE_F19 110)
437 (define-public SDL_SCANCODE_F20 111)
438 (define-public SDL_SCANCODE_F21 112)
439 (define-public SDL_SCANCODE_F22 113)
440 (define-public SDL_SCANCODE_F23 114)
441 (define-public SDL_SCANCODE_F24 115)
442 (define-public SDL_SCANCODE_EXECUTE 116)
443 (define-public SDL_SCANCODE_HELP 117)
444 (define-public SDL_SCANCODE_MENU 118)
445 (define-public SDL_SCANCODE_SELECT 119)
446 (define-public SDL_SCANCODE_STOP 120)
447 (define-public SDL_SCANCODE_AGAIN 121)
448 (define-public SDL_SCANCODE_UNDO 122)
449 (define-public SDL_SCANCODE_CUT 123)
450 (define-public SDL_SCANCODE_COPY 124)
451 (define-public SDL_SCANCODE_PASTE 125)
452 (define-public SDL_SCANCODE_FIND 126)
453 (define-public SDL_SCANCODE_MUTE 127)
454 (define-public SDL_SCANCODE_VOLUMEUP 128)
455 (define-public SDL_SCANCODE_VOLUMEDOWN 129)
456 (define-public SDL_SCANCODE_KP_COMMA 133)
457 (define-public SDL_SCANCODE_KP_EQUALSAS400 134)
458 (define-public SDL_SCANCODE_INTERNATIONAL1 135)
459 (define-public SDL_SCANCODE_INTERNATIONAL2 136)
460 (define-public SDL_SCANCODE_INTERNATIONAL3 137)
461 (define-public SDL_SCANCODE_INTERNATIONAL4 138)
462 (define-public SDL_SCANCODE_INTERNATIONAL5 139)
463 (define-public SDL_SCANCODE_INTERNATIONAL6 140)
464 (define-public SDL_SCANCODE_INTERNATIONAL7 141)
465 (define-public SDL_SCANCODE_INTERNATIONAL8 142)
466 (define-public SDL_SCANCODE_INTERNATIONAL9 143)
467 (define-public SDL_SCANCODE_LANG1 144)
468 (define-public SDL_SCANCODE_LANG2 145)
469 (define-public SDL_SCANCODE_LANG3 146)
470 (define-public SDL_SCANCODE_LANG4 147)
471 (define-public SDL_SCANCODE_LANG5 148)
472 (define-public SDL_SCANCODE_LANG6 149)
473 (define-public SDL_SCANCODE_LANG7 150)
474 (define-public SDL_SCANCODE_LANG8 151)
475 (define-public SDL_SCANCODE_LANG9 152)
476 (define-public SDL_SCANCODE_ALTERASE 153)
477 (define-public SDL_SCANCODE_SYSREQ 154)
478 (define-public SDL_SCANCODE_CANCEL 155)
479 (define-public SDL_SCANCODE_CLEAR 156)
480 (define-public SDL_SCANCODE_PRIOR 157)
481 (define-public SDL_SCANCODE_RETURN2 158)
482 (define-public SDL_SCANCODE_SEPARATOR 159)
483 (define-public SDL_SCANCODE_OUT 160)
484 (define-public SDL_SCANCODE_OPER 161)
485 (define-public SDL_SCANCODE_CLEARAGAIN 162)
486 (define-public SDL_SCANCODE_CRSEL 163)
487 (define-public SDL_SCANCODE_EXSEL 164)
488 (define-public SDL_SCANCODE_KP_00 176)
489 (define-public SDL_SCANCODE_KP_000 177)
490 (define-public SDL_SCANCODE_THOUSANDSSEPARATOR 178)
491 (define-public SDL_SCANCODE_DECIMALSEPARATOR 179)
492 (define-public SDL_SCANCODE_CURRENCYUNIT 180)
493 (define-public SDL_SCANCODE_CURRENCYSUBUNIT 181)
494 (define-public SDL_SCANCODE_KP_LEFTPAREN 182)
495 (define-public SDL_SCANCODE_KP_RIGHTPAREN 183)
496 (define-public SDL_SCANCODE_KP_LEFTBRACE 184)
497 (define-public SDL_SCANCODE_KP_RIGHTBRACE 185)
498 (define-public SDL_SCANCODE_KP_TAB 186)
499 (define-public SDL_SCANCODE_KP_BACKSPACE 187)
500 (define-public SDL_SCANCODE_KP_A 188)
501 (define-public SDL_SCANCODE_KP_B 189)
502 (define-public SDL_SCANCODE_KP_C 190)
503 (define-public SDL_SCANCODE_KP_D 191)
504 (define-public SDL_SCANCODE_KP_E 192)
505 (define-public SDL_SCANCODE_KP_F 193)
506 (define-public SDL_SCANCODE_KP_XOR 194)
507 (define-public SDL_SCANCODE_KP_POWER 195)
508 (define-public SDL_SCANCODE_KP_PERCENT 196)
509 (define-public SDL_SCANCODE_KP_LESS 197)
510 (define-public SDL_SCANCODE_KP_GREATER 198)
511 (define-public SDL_SCANCODE_KP_AMPERSAND 199)
512 (define-public SDL_SCANCODE_KP_DBLAMPERSAND 200)
513 (define-public SDL_SCANCODE_KP_VERTICALBAR 201)
514 (define-public SDL_SCANCODE_KP_DBLVERTICALBAR 202)
515 (define-public SDL_SCANCODE_KP_COLON 203)
516 (define-public SDL_SCANCODE_KP_HASH 204)
517 (define-public SDL_SCANCODE_KP_SPACE 205)
518 (define-public SDL_SCANCODE_KP_AT 206)
519 (define-public SDL_SCANCODE_KP_EXCLAM 207)
520 (define-public SDL_SCANCODE_KP_MEMSTORE 208)
521 (define-public SDL_SCANCODE_KP_MEMRECALL 209)
522 (define-public SDL_SCANCODE_KP_MEMCLEAR 210)
523 (define-public SDL_SCANCODE_KP_MEMADD 211)
524 (define-public SDL_SCANCODE_KP_MEMSUBTRACT 212)
525 (define-public SDL_SCANCODE_KP_MEMMULTIPLY 213)
526 (define-public SDL_SCANCODE_KP_MEMDIVIDE 214)
527 (define-public SDL_SCANCODE_KP_PLUSMINUS 215)
528 (define-public SDL_SCANCODE_KP_CLEAR 216)
529 (define-public SDL_SCANCODE_KP_CLEARENTRY 217)
530 (define-public SDL_SCANCODE_KP_BINARY 218)
531 (define-public SDL_SCANCODE_KP_OCTAL 219)
532 (define-public SDL_SCANCODE_KP_DECIMAL 220)
533 (define-public SDL_SCANCODE_KP_HEXADECIMAL 221)
534 (define-public SDL_SCANCODE_LCTRL 224)
535 (define-public SDL_SCANCODE_LSHIFT 225)
536 (define-public SDL_SCANCODE_LALT 226)
537 (define-public SDL_SCANCODE_LGUI 227)
538 (define-public SDL_SCANCODE_RCTRL 228)
539 (define-public SDL_SCANCODE_RSHIFT 229)
540 (define-public SDL_SCANCODE_RALT 230)
541 (define-public SDL_SCANCODE_RGUI 231)
542 (define-public SDL_SCANCODE_MODE 257)
543 (define-public SDL_SCANCODE_AUDIONEXT 258)
544 (define-public SDL_SCANCODE_AUDIOPREV 259)
545 (define-public SDL_SCANCODE_AUDIOSTOP 260)
546 (define-public SDL_SCANCODE_AUDIOPLAY 261)
547 (define-public SDL_SCANCODE_AUDIOMUTE 262)
548 (define-public SDL_SCANCODE_MEDIASELECT 263)
549 (define-public SDL_SCANCODE_WWW 264)
550 (define-public SDL_SCANCODE_MAIL 265)
551 (define-public SDL_SCANCODE_CALCULATOR 266)
552 (define-public SDL_SCANCODE_COMPUTER 267)
553 (define-public SDL_SCANCODE_AC_SEARCH 268)
554 (define-public SDL_SCANCODE_AC_HOME 269)
555 (define-public SDL_SCANCODE_AC_BACK 270)
556 (define-public SDL_SCANCODE_AC_FORWARD 271)
557 (define-public SDL_SCANCODE_AC_STOP 272)
558 (define-public SDL_SCANCODE_AC_REFRESH 273)
559 (define-public SDL_SCANCODE_AC_BOOKMARKS 274)
560 (define-public SDL_SCANCODE_BRIGHTNESSDOWN 275)
561 (define-public SDL_SCANCODE_BRIGHTNESSUP 276)
562 (define-public SDL_SCANCODE_DISPLAYSWITCH 277)
563 (define-public SDL_SCANCODE_KBDILLUMTOGGLE 278)
564 (define-public SDL_SCANCODE_KBDILLUMDOWN 279)
565 (define-public SDL_SCANCODE_KBDILLUMUP 280)
566 (define-public SDL_SCANCODE_EJECT 281)
567 (define-public SDL_SCANCODE_SLEEP 282)
568 (define-public SDL_SCANCODE_APP1 283)
569 (define-public SDL_SCANCODE_APP2 284)
570 (define-public SDL_NUM_SCANCODES 512)
571
572 (define-public SDLK_UNKNOWN 0)
573 (define-public SDLK_RETURN 13)
574 (define-public SDLK_ESCAPE 27)
575 (define-public SDLK_BACKSPACE 8)
576 (define-public SDLK_TAB 9)
577 (define-public SDLK_SPACE 32)
578 (define-public SDLK_EXCLAIM 33)
579 (define-public SDLK_QUOTEDBL 34)
580 (define-public SDLK_HASH 35)
581 (define-public SDLK_PERCENT 37)
582 (define-public SDLK_DOLLAR 36)
583 (define-public SDLK_AMPERSAND 38)
584 (define-public SDLK_QUOTE 39)
585 (define-public SDLK_LEFTPAREN 40)
586 (define-public SDLK_RIGHTPAREN 41)
587 (define-public SDLK_ASTERISK 42)
588 (define-public SDLK_PLUS 43)
589 (define-public SDLK_COMMA 44)
590 (define-public SDLK_MINUS 45)
591 (define-public SDLK_PERIOD 46)
592 (define-public SDLK_SLASH 47)
593 (define-public SDLK_0 48)
594 (define-public SDLK_1 49)
595 (define-public SDLK_2 50)
596 (define-public SDLK_3 51)
597 (define-public SDLK_4 52)
598 (define-public SDLK_5 53)
599 (define-public SDLK_6 54)
600 (define-public SDLK_7 55)
601 (define-public SDLK_8 56)
602 (define-public SDLK_9 57)
603 (define-public SDLK_COLON 58)
604 (define-public SDLK_SEMICOLON 59)
605 (define-public SDLK_LESS 60)
606 (define-public SDLK_EQUALS 61)
607 (define-public SDLK_GREATER 62)
608 (define-public SDLK_QUESTION 63)
609 (define-public SDLK_AT 64)
610 (define-public SDLK_LEFTBRACKET 91)
611 (define-public SDLK_BACKSLASH 92)
612 (define-public SDLK_RIGHTBRACKET 93)
613 (define-public SDLK_CARET 94)
614 (define-public SDLK_UNDERSCORE 95)
615 (define-public SDLK_BACKQUOTE 96)
616 (define-public SDLK_a 97)
617 (define-public SDLK_b 98)
618 (define-public SDLK_c 99)
619 (define-public SDLK_d 100)
620 (define-public SDLK_e 101)
621 (define-public SDLK_f 102)
622 (define-public SDLK_g 103)
623 (define-public SDLK_h 104)
624 (define-public SDLK_i 105)
625 (define-public SDLK_j 106)
626 (define-public SDLK_k 107)
627 (define-public SDLK_l 108)
628 (define-public SDLK_m 109)
629 (define-public SDLK_n 110)
630 (define-public SDLK_o 111)
631 (define-public SDLK_p 112)
632 (define-public SDLK_q 113)
633 (define-public SDLK_r 114)
634 (define-public SDLK_s 115)
635 (define-public SDLK_t 116)
636 (define-public SDLK_u 117)
637 (define-public SDLK_v 118)
638 (define-public SDLK_w 119)
639 (define-public SDLK_x 120)
640 (define-public SDLK_y 121)
641 (define-public SDLK_z 122)
642 (define-public SDLK_CAPSLOCK (scancode->keycode SDL_SCANCODE_CAPSLOCK))
643 (define-public SDLK_F1 (scancode->keycode SDL_SCANCODE_F1))
644 (define-public SDLK_F2 (scancode->keycode SDL_SCANCODE_F2))
645 (define-public SDLK_F3 (scancode->keycode SDL_SCANCODE_F3))
646 (define-public SDLK_F4 (scancode->keycode SDL_SCANCODE_F4))
647 (define-public SDLK_F5 (scancode->keycode SDL_SCANCODE_F5))
648 (define-public SDLK_F6 (scancode->keycode SDL_SCANCODE_F6))
649 (define-public SDLK_F7 (scancode->keycode SDL_SCANCODE_F7))
650 (define-public SDLK_F8 (scancode->keycode SDL_SCANCODE_F8))
651 (define-public SDLK_F9 (scancode->keycode SDL_SCANCODE_F9))
652 (define-public SDLK_F10 (scancode->keycode SDL_SCANCODE_F10))
653 (define-public SDLK_F11 (scancode->keycode SDL_SCANCODE_F11))
654 (define-public SDLK_F12 (scancode->keycode SDL_SCANCODE_F12))
655 (define-public SDLK_PRINTSCREEN (scancode->keycode SDL_SCANCODE_PRINTSCREEN))
656 (define-public SDLK_SCROLLLOCK (scancode->keycode SDL_SCANCODE_SCROLLLOCK))
657 (define-public SDLK_PAUSE (scancode->keycode SDL_SCANCODE_PAUSE))
658 (define-public SDLK_INSERT (scancode->keycode SDL_SCANCODE_INSERT))
659 (define-public SDLK_HOME (scancode->keycode SDL_SCANCODE_HOME))
660 (define-public SDLK_PAGEUP (scancode->keycode SDL_SCANCODE_PAGEUP))
661 (define-public SDLK_DELETE 127)
662 (define-public SDLK_END (scancode->keycode SDL_SCANCODE_END))
663 (define-public SDLK_PAGEDOWN (scancode->keycode SDL_SCANCODE_PAGEDOWN))
664 (define-public SDLK_RIGHT (scancode->keycode SDL_SCANCODE_RIGHT))
665 (define-public SDLK_LEFT (scancode->keycode SDL_SCANCODE_LEFT))
666 (define-public SDLK_DOWN (scancode->keycode SDL_SCANCODE_DOWN))
667 (define-public SDLK_UP (scancode->keycode SDL_SCANCODE_UP))
668 (define-public SDLK_NUMLOCKCLEAR (scancode->keycode SDL_SCANCODE_NUMLOCKCLEAR))
669 (define-public SDLK_KP_DIVIDE (scancode->keycode SDL_SCANCODE_KP_DIVIDE))
670 (define-public SDLK_KP_MULTIPLY (scancode->keycode SDL_SCANCODE_KP_MULTIPLY))
671 (define-public SDLK_KP_MINUS (scancode->keycode SDL_SCANCODE_KP_MINUS))
672 (define-public SDLK_KP_PLUS (scancode->keycode SDL_SCANCODE_KP_PLUS))
673 (define-public SDLK_KP_ENTER (scancode->keycode SDL_SCANCODE_KP_ENTER))
674 (define-public SDLK_KP_1 (scancode->keycode SDL_SCANCODE_KP_1))
675 (define-public SDLK_KP_2 (scancode->keycode SDL_SCANCODE_KP_2))
676 (define-public SDLK_KP_3 (scancode->keycode SDL_SCANCODE_KP_3))
677 (define-public SDLK_KP_4 (scancode->keycode SDL_SCANCODE_KP_4))
678 (define-public SDLK_KP_5 (scancode->keycode SDL_SCANCODE_KP_5))
679 (define-public SDLK_KP_6 (scancode->keycode SDL_SCANCODE_KP_6))
680 (define-public SDLK_KP_7 (scancode->keycode SDL_SCANCODE_KP_7))
681 (define-public SDLK_KP_8 (scancode->keycode SDL_SCANCODE_KP_8))
682 (define-public SDLK_KP_9 (scancode->keycode SDL_SCANCODE_KP_9))
683 (define-public SDLK_KP_0 (scancode->keycode SDL_SCANCODE_KP_0))
684 (define-public SDLK_KP_PERIOD (scancode->keycode SDL_SCANCODE_KP_PERIOD))
685 (define-public SDLK_APPLICATION (scancode->keycode SDL_SCANCODE_APPLICATION))
686 (define-public SDLK_POWER (scancode->keycode SDL_SCANCODE_POWER))
687 (define-public SDLK_KP_EQUALS (scancode->keycode SDL_SCANCODE_KP_EQUALS))
688 (define-public SDLK_F13 (scancode->keycode SDL_SCANCODE_F13))
689 (define-public SDLK_F14 (scancode->keycode SDL_SCANCODE_F14))
690 (define-public SDLK_F15 (scancode->keycode SDL_SCANCODE_F15))
691 (define-public SDLK_F16 (scancode->keycode SDL_SCANCODE_F16))
692 (define-public SDLK_F17 (scancode->keycode SDL_SCANCODE_F17))
693 (define-public SDLK_F18 (scancode->keycode SDL_SCANCODE_F18))
694 (define-public SDLK_F19 (scancode->keycode SDL_SCANCODE_F19))
695 (define-public SDLK_F20 (scancode->keycode SDL_SCANCODE_F20))
696 (define-public SDLK_F21 (scancode->keycode SDL_SCANCODE_F21))
697 (define-public SDLK_F22 (scancode->keycode SDL_SCANCODE_F22))
698 (define-public SDLK_F23 (scancode->keycode SDL_SCANCODE_F23))
699 (define-public SDLK_F24 (scancode->keycode SDL_SCANCODE_F24))
700 (define-public SDLK_EXECUTE (scancode->keycode SDL_SCANCODE_EXECUTE))
701 (define-public SDLK_HELP (scancode->keycode SDL_SCANCODE_HELP))
702 (define-public SDLK_MENU (scancode->keycode SDL_SCANCODE_MENU))
703 (define-public SDLK_SELECT (scancode->keycode SDL_SCANCODE_SELECT))
704 (define-public SDLK_STOP (scancode->keycode SDL_SCANCODE_STOP))
705 (define-public SDLK_AGAIN (scancode->keycode SDL_SCANCODE_AGAIN))
706 (define-public SDLK_UNDO (scancode->keycode SDL_SCANCODE_UNDO))
707 (define-public SDLK_CUT (scancode->keycode SDL_SCANCODE_CUT))
708 (define-public SDLK_COPY (scancode->keycode SDL_SCANCODE_COPY))
709 (define-public SDLK_PASTE (scancode->keycode SDL_SCANCODE_PASTE))
710 (define-public SDLK_FIND (scancode->keycode SDL_SCANCODE_FIND))
711 (define-public SDLK_MUTE (scancode->keycode SDL_SCANCODE_MUTE))
712 (define-public SDLK_VOLUMEUP (scancode->keycode SDL_SCANCODE_VOLUMEUP))
713 (define-public SDLK_VOLUMEDOWN (scancode->keycode SDL_SCANCODE_VOLUMEDOWN))
714 (define-public SDLK_KP_COMMA (scancode->keycode SDL_SCANCODE_KP_COMMA))
715 (define-public SDLK_KP_EQUALSAS400
716 (scancode->keycode SDL_SCANCODE_KP_EQUALSAS400))
717 (define-public SDLK_ALTERASE (scancode->keycode SDL_SCANCODE_ALTERASE))
718 (define-public SDLK_SYSREQ (scancode->keycode SDL_SCANCODE_SYSREQ))
719 (define-public SDLK_CANCEL (scancode->keycode SDL_SCANCODE_CANCEL))
720 (define-public SDLK_CLEAR (scancode->keycode SDL_SCANCODE_CLEAR))
721 (define-public SDLK_PRIOR (scancode->keycode SDL_SCANCODE_PRIOR))
722 (define-public SDLK_RETURN2 (scancode->keycode SDL_SCANCODE_RETURN2))
723 (define-public SDLK_SEPARATOR (scancode->keycode SDL_SCANCODE_SEPARATOR))
724 (define-public SDLK_OUT (scancode->keycode SDL_SCANCODE_OUT))
725 (define-public SDLK_OPER (scancode->keycode SDL_SCANCODE_OPER))
726 (define-public SDLK_CLEARAGAIN (scancode->keycode SDL_SCANCODE_CLEARAGAIN))
727 (define-public SDLK_CRSEL (scancode->keycode SDL_SCANCODE_CRSEL))
728 (define-public SDLK_EXSEL (scancode->keycode SDL_SCANCODE_EXSEL))
729 (define-public SDLK_KP_00 (scancode->keycode SDL_SCANCODE_KP_00))
730 (define-public SDLK_KP_000 (scancode->keycode SDL_SCANCODE_KP_000))
731 (define-public SDLK_THOUSANDSSEPARATOR
732 (scancode->keycode SDL_SCANCODE_THOUSANDSSEPARATOR))
733 (define-public SDLK_DECIMALSEPARATOR
734 (scancode->keycode SDL_SCANCODE_DECIMALSEPARATOR))
735 (define-public SDLK_CURRENCYUNIT (scancode->keycode SDL_SCANCODE_CURRENCYUNIT))
736 (define-public SDLK_CURRENCYSUBUNIT
737 (scancode->keycode SDL_SCANCODE_CURRENCYSUBUNIT))
738 (define-public SDLK_KP_LEFTPAREN (scancode->keycode SDL_SCANCODE_KP_LEFTPAREN))
739 (define-public SDLK_KP_RIGHTPAREN
740 (scancode->keycode SDL_SCANCODE_KP_RIGHTPAREN))
741 (define-public SDLK_KP_LEFTBRACE (scancode->keycode SDL_SCANCODE_KP_LEFTBRACE))
742 (define-public SDLK_KP_RIGHTBRACE (scancode->keycode SDL_SCANCODE_KP_RIGHTBRACE))
743 (define-public SDLK_KP_TAB (scancode->keycode SDL_SCANCODE_KP_TAB))
744 (define-public SDLK_KP_BACKSPACE (scancode->keycode SDL_SCANCODE_KP_BACKSPACE))
745 (define-public SDLK_KP_A (scancode->keycode SDL_SCANCODE_KP_A))
746 (define-public SDLK_KP_B (scancode->keycode SDL_SCANCODE_KP_B))
747 (define-public SDLK_KP_C (scancode->keycode SDL_SCANCODE_KP_C))
748 (define-public SDLK_KP_D (scancode->keycode SDL_SCANCODE_KP_D))
749 (define-public SDLK_KP_E (scancode->keycode SDL_SCANCODE_KP_E))
750 (define-public SDLK_KP_F (scancode->keycode SDL_SCANCODE_KP_F))
751 (define-public SDLK_KP_XOR (scancode->keycode SDL_SCANCODE_KP_XOR))
752 (define-public SDLK_KP_POWER (scancode->keycode SDL_SCANCODE_KP_POWER))
753 (define-public SDLK_KP_PERCENT (scancode->keycode SDL_SCANCODE_KP_PERCENT))
754 (define-public SDLK_KP_LESS (scancode->keycode SDL_SCANCODE_KP_LESS))
755 (define-public SDLK_KP_GREATER (scancode->keycode SDL_SCANCODE_KP_GREATER))
756 (define-public SDLK_KP_AMPERSAND (scancode->keycode SDL_SCANCODE_KP_AMPERSAND))
757 (define-public SDLK_KP_DBLAMPERSAND
758 (scancode->keycode SDL_SCANCODE_KP_DBLAMPERSAND))
759 (define-public SDLK_KP_VERTICALBAR
760 (scancode->keycode SDL_SCANCODE_KP_VERTICALBAR))
761 (define-public SDLK_KP_DBLVERTICALBAR
762 (scancode->keycode SDL_SCANCODE_KP_DBLVERTICALBAR))
763 (define-public SDLK_KP_COLON (scancode->keycode SDL_SCANCODE_KP_COLON))
764 (define-public SDLK_KP_HASH (scancode->keycode SDL_SCANCODE_KP_HASH))
765 (define-public SDLK_KP_SPACE (scancode->keycode SDL_SCANCODE_KP_SPACE))
766 (define-public SDLK_KP_AT (scancode->keycode SDL_SCANCODE_KP_AT))
767 (define-public SDLK_KP_EXCLAM (scancode->keycode SDL_SCANCODE_KP_EXCLAM))
768 (define-public SDLK_KP_MEMSTORE (scancode->keycode SDL_SCANCODE_KP_MEMSTORE))
769 (define-public SDLK_KP_MEMRECALL (scancode->keycode SDL_SCANCODE_KP_MEMRECALL))
770 (define-public SDLK_KP_MEMCLEAR (scancode->keycode SDL_SCANCODE_KP_MEMCLEAR))
771 (define-public SDLK_KP_MEMADD (scancode->keycode SDL_SCANCODE_KP_MEMADD))
772 (define-public SDLK_KP_MEMSUBTRACT
773 (scancode->keycode SDL_SCANCODE_KP_MEMSUBTRACT))
774 (define-public SDLK_KP_MEMMULTIPLY
775 (scancode->keycode SDL_SCANCODE_KP_MEMMULTIPLY))
776 (define-public SDLK_KP_MEMDIVIDE (scancode->keycode SDL_SCANCODE_KP_MEMDIVIDE))
777 (define-public SDLK_KP_PLUSMINUS (scancode->keycode SDL_SCANCODE_KP_PLUSMINUS))
778 (define-public SDLK_KP_CLEAR (scancode->keycode SDL_SCANCODE_KP_CLEAR))
779 (define-public SDLK_KP_CLEARENTRY (scancode->keycode SDL_SCANCODE_KP_CLEARENTRY))
780 (define-public SDLK_KP_BINARY (scancode->keycode SDL_SCANCODE_KP_BINARY))
781 (define-public SDLK_KP_OCTAL (scancode->keycode SDL_SCANCODE_KP_OCTAL))
782 (define-public SDLK_KP_DECIMAL (scancode->keycode SDL_SCANCODE_KP_DECIMAL))
783 (define-public SDLK_KP_HEXADECIMAL
784 (scancode->keycode SDL_SCANCODE_KP_HEXADECIMAL))
785 (define-public SDLK_LCTRL (scancode->keycode SDL_SCANCODE_LCTRL))
786 (define-public SDLK_LSHIFT (scancode->keycode SDL_SCANCODE_LSHIFT))
787 (define-public SDLK_LALT (scancode->keycode SDL_SCANCODE_LALT))
788 (define-public SDLK_LGUI (scancode->keycode SDL_SCANCODE_LGUI))
789 (define-public SDLK_RCTRL (scancode->keycode SDL_SCANCODE_RCTRL))
790 (define-public SDLK_RSHIFT (scancode->keycode SDL_SCANCODE_RSHIFT))
791 (define-public SDLK_RALT (scancode->keycode SDL_SCANCODE_RALT))
792 (define-public SDLK_RGUI (scancode->keycode SDL_SCANCODE_RGUI))
793 (define-public SDLK_MODE (scancode->keycode SDL_SCANCODE_MODE))
794 (define-public SDLK_AUDIONEXT (scancode->keycode SDL_SCANCODE_AUDIONEXT))
795 (define-public SDLK_AUDIOPREV (scancode->keycode SDL_SCANCODE_AUDIOPREV))
796 (define-public SDLK_AUDIOSTOP (scancode->keycode SDL_SCANCODE_AUDIOSTOP))
797 (define-public SDLK_AUDIOPLAY (scancode->keycode SDL_SCANCODE_AUDIOPLAY))
798 (define-public SDLK_AUDIOMUTE (scancode->keycode SDL_SCANCODE_AUDIOMUTE))
799 (define-public SDLK_MEDIASELECT (scancode->keycode SDL_SCANCODE_MEDIASELECT))
800 (define-public SDLK_WWW (scancode->keycode SDL_SCANCODE_WWW))
801 (define-public SDLK_MAIL (scancode->keycode SDL_SCANCODE_MAIL))
802 (define-public SDLK_CALCULATOR (scancode->keycode SDL_SCANCODE_CALCULATOR))
803 (define-public SDLK_COMPUTER (scancode->keycode SDL_SCANCODE_COMPUTER))
804 (define-public SDLK_AC_SEARCH (scancode->keycode SDL_SCANCODE_AC_SEARCH))
805 (define-public SDLK_AC_HOME (scancode->keycode SDL_SCANCODE_AC_HOME))
806 (define-public SDLK_AC_BACK (scancode->keycode SDL_SCANCODE_AC_BACK))
807 (define-public SDLK_AC_FORWARD (scancode->keycode SDL_SCANCODE_AC_FORWARD))
808 (define-public SDLK_AC_STOP (scancode->keycode SDL_SCANCODE_AC_STOP))
809 (define-public SDLK_AC_REFRESH (scancode->keycode SDL_SCANCODE_AC_REFRESH))
810 (define-public SDLK_AC_BOOKMARKS (scancode->keycode SDL_SCANCODE_AC_BOOKMARKS))
811 (define-public SDLK_BRIGHTNESSDOWN
812 (scancode->keycode SDL_SCANCODE_BRIGHTNESSDOWN))
813 (define-public SDLK_BRIGHTNESSUP (scancode->keycode SDL_SCANCODE_BRIGHTNESSUP))
814 (define-public SDLK_DISPLAYSWITCH (scancode->keycode SDL_SCANCODE_DISPLAYSWITCH))
815 (define-public SDLK_KBDILLUMTOGGLE
816 (scancode->keycode SDL_SCANCODE_KBDILLUMTOGGLE))
817 (define-public SDLK_KBDILLUMDOWN (scancode->keycode SDL_SCANCODE_KBDILLUMDOWN))
818 (define-public SDLK_KBDILLUMUP (scancode->keycode SDL_SCANCODE_KBDILLUMUP))
819 (define-public SDLK_EJECT (scancode->keycode SDL_SCANCODE_EJECT))
820 (define-public SDLK_SLEEP (scancode->keycode SDL_SCANCODE_SLEEP))
821
822 (define-foreign sdl-get-keyboard-state
823 '* "SDL_GetKeyboardState" '(*))
824
825 \f
826 ;;;
827 ;;; Text Input
828 ;;;
829
830 (define-foreign sdl-start-text-input
831 void "SDL_StartTextInput" '())
832
833 (define-foreign sdl-stop-text-input
834 void "SDL_StopTextInput" '())
835
836 (define-foreign sdl-is-text-input-active
837 sdl-bool "SDL_IsTextInputActive" '())
838
839 \f
840 ;;;
841 ;;; Mouse
842 ;;;
843
844 (define-public SDL_BUTTON_LEFT 1)
845 (define-public SDL_BUTTON_MIDDLE 2)
846 (define-public SDL_BUTTON_RIGHT 3)
847 (define-public SDL_BUTTON_X1 4)
848 (define-public SDL_BUTTON_X2 5)
849
850 (define (button-mask n)
851 (ash 1 (1- n)))
852
853 (define-public SDL_BUTTON_LMASK (button-mask SDL_BUTTON_LEFT))
854 (define-public SDL_BUTTON_MMASK (button-mask SDL_BUTTON_MIDDLE))
855 (define-public SDL_BUTTON_RMASK (button-mask SDL_BUTTON_RIGHT))
856 (define-public SDL_BUTTON_X1MASK (button-mask SDL_BUTTON_X1))
857 (define-public SDL_BUTTON_X2MASK (button-mask SDL_BUTTON_X2))
858
859
860 \f
861 ;;;
862 ;;; Timer
863 ;;;
864
865 (define-foreign sdl-get-ticks
866 uint32 "SDL_GetTicks" '())
867
868 \f
869 ;;;
870 ;;; File I/O
871 ;;;
872
873 (define-foreign sdl-rw-from-file
874 '* "SDL_RWFromFile" (list '* '*))
875
876 \f
877 ;;;
878 ;;; Pixels
879 ;;;
880
881 (define-public SDL_PIXELFORMAT_UNKNOWN 0)
882 (define-public SDL_PIXELFORMAT_INDEX1LSB 286261504)
883 (define-public SDL_PIXELFORMAT_INDEX1MSB 287310080)
884 (define-public SDL_PIXELFORMAT_INDEX4LSB 303039488)
885 (define-public SDL_PIXELFORMAT_INDEX4MSB 304088064)
886 (define-public SDL_PIXELFORMAT_INDEX8 318769153)
887 (define-public SDL_PIXELFORMAT_RGB332 336660481)
888 (define-public SDL_PIXELFORMAT_RGB444 353504258)
889 (define-public SDL_PIXELFORMAT_RGB555 353570562)
890 (define-public SDL_PIXELFORMAT_BGR555 357764866)
891 (define-public SDL_PIXELFORMAT_ARGB4444 355602434)
892 (define-public SDL_PIXELFORMAT_RGBA4444 356651010)
893 (define-public SDL_PIXELFORMAT_ABGR4444 359796738)
894 (define-public SDL_PIXELFORMAT_BGRA4444 360845314)
895 (define-public SDL_PIXELFORMAT_ARGB1555 355667970)
896 (define-public SDL_PIXELFORMAT_RGBA5551 356782082)
897 (define-public SDL_PIXELFORMAT_ABGR1555 359862274)
898 (define-public SDL_PIXELFORMAT_BGRA5551 360976386)
899 (define-public SDL_PIXELFORMAT_RGB565 353701890)
900 (define-public SDL_PIXELFORMAT_BGR565 357896194)
901 (define-public SDL_PIXELFORMAT_RGB24 386930691)
902 (define-public SDL_PIXELFORMAT_BGR24 390076419)
903 (define-public SDL_PIXELFORMAT_RGB888 370546692)
904 (define-public SDL_PIXELFORMAT_RGBX8888 371595268)
905 (define-public SDL_PIXELFORMAT_BGR888 374740996)
906 (define-public SDL_PIXELFORMAT_BGRX8888 375789572)
907 (define-public SDL_PIXELFORMAT_ARGB8888 372645892)
908 (define-public SDL_PIXELFORMAT_RGBA8888 373694468)
909 (define-public SDL_PIXELFORMAT_ABGR8888 376840196)
910 (define-public SDL_PIXELFORMAT_BGRA8888 377888772)
911 (define-public SDL_PIXELFORMAT_ARGB2101010 372711428)
912 (define-public SDL_PIXELFORMAT_YV12 842094169)
913 (define-public SDL_PIXELFORMAT_IYUV 1448433993)
914 (define-public SDL_PIXELFORMAT_YUY2 844715353)
915 (define-public SDL_PIXELFORMAT_UYVY 1498831189)
916 (define-public SDL_PIXELFORMAT_YVYU 1431918169)
917
918 \f
919 ;;;
920 ;;; Surface
921 ;;;
922
923 (define-foreign sdl-create-rgb-surface
924 '* "SDL_CreateRGBSurface"
925 (list uint32 int int int uint32 uint32 uint32 uint32))
926
927 (define-foreign sdl-create-rgb-surface-from
928 '* "SDL_CreateRGBSurfaceFrom"
929 (list '* int int int int uint32 uint32 uint32 uint32))
930
931 (define-foreign sdl-free-surface
932 void "SDL_FreeSurface" '(*))
933
934 (define-foreign sdl-load-bmp-rw
935 '* "SDL_LoadBMP_RW" (list '* int))
936
937 (define-foreign sdl-convert-surface-format
938 '* "SDL_ConvertSurfaceFormat" (list '* uint32 uint32))
939
940 \f
941 ;;;
942 ;;; Audio
943 ;;;
944
945 (define-public AUDIO_U8 #x0008)
946 (define-public AUDIO_S8 #x8008)
947 (define-public AUDIO_U16LSB #x0010)
948 (define-public AUDIO_S16LSB #x8010)
949 (define-public AUDIO_U16MSB #x1010)
950 (define-public AUDIO_S16MSB #x9010)
951 (define-public AUDIO_U16 AUDIO_U16LSB)
952 (define-public AUDIO_S16 AUDIO_S16LSB)
953 (define-public AUDIO_S32LSB #x8020)
954 (define-public AUDIO_S32MSB #x9020)
955 (define-public AUDIO_S32 AUDIO_S32LSB)
956 (define-public AUDIO_F32LSB #x8120)
957 (define-public AUDIO_F32MSB #x9120)
958 (define-public AUDIO_F32 AUDIO_F32LSB)
959
960 \f
961 ;;;
962 ;;; Joystick
963 ;;;
964
965 (define-public SDL_JOYSTICK_POWER_UNKNOWN -1)
966 (define-public SDL_JOYSTICK_POWER_EMPTY 0)
967 (define-public SDL_JOYSTICK_POWER_LOW 1)
968 (define-public SDL_JOYSTICK_POWER_MEDIUM 2)
969 (define-public SDL_JOYSTICK_POWER_FULL 3)
970 (define-public SDL_JOYSTICK_POWER_WIRED 4)
971 (define-public SDL_JOYSTICK_POWER_MAX 5)
972
973 (define-foreign sdl-joystick-open
974 '* "SDL_JoystickOpen" (list int))
975
976 (define-foreign sdl-joystick-close
977 void "SDL_JoystickClose" '(*))
978
979 (define-foreign sdl-joystick-current-power-level
980 int "SDL_JoystickCurrentPowerLevel" '(*))
981
982 (define-foreign sdl-joystick-event-state
983 int "SDL_JoystickEventState" (list int))
984
985 (define-foreign sdl-joystick-from-instance-id
986 '* "SDL_JoystickFromInstanceID" (list int32))
987
988 (define-foreign sdl-joystick-get-attached
989 sdl-bool "SDL_JoystickGetAttached" '(*))
990
991 (define-foreign sdl-joystick-get-axis
992 int16 "SDL_JoystickGetAxis" (list '* int))
993
994 (define-foreign sdl-joystick-get-ball
995 int "SDL_JoystickGetBall" (list '* int '* '*))
996
997 (define-foreign sdl-joystick-get-button
998 uint8 "SDL_JoystickGetButton" (list '* int))
999
1000 (define-foreign sdl-joystick-get-device-guid
1001 '* "SDL_JoystickGetDeviceGUID" (list int))
1002
1003 (define-foreign sdl-joystick-get-guid
1004 '* "SDL_JoystickGetGUID" (list int))
1005
1006 (define-foreign sdl-joystick-get-guid-from-string
1007 '* "SDL_JoystickGetGUIDFromString" '(*))
1008
1009 (define-foreign sdl-joystick-get-guid-string
1010 void "SDL_JoystickGetGUIDString" (list '* '* int))
1011
1012 (define-foreign sdl-joystick-get-hat
1013 uint8 "SDL_JoystickGetHat" (list '* int))
1014
1015 (define-foreign sdl-joystick-instance-id
1016 int32 "SDL_JoystickInstanceID" '(*))
1017
1018 (define-foreign sdl-joystick-name
1019 '* "SDL_JoystickName" '(*))
1020
1021 (define-foreign sdl-joystick-name-for-index
1022 '* "SDL_JoystickNameForIndex" (list int))
1023
1024 (define-foreign sdl-joystick-num-axes
1025 int "SDL_JoystickNumAxes" '(*))
1026
1027 (define-foreign sdl-joystick-num-balls
1028 int "SDL_JoystickNumBalls" '(*))
1029
1030 (define-foreign sdl-joystick-num-buttons
1031 int "SDL_JoystickNumButtons" '(*))
1032
1033 (define-foreign sdl-joystick-num-hats
1034 int "SDL_JoystickNumHats" '(*))
1035
1036 (define-foreign sdl-num-joysticks
1037 int "SDL_NumJoysticks" '())
1038
1039 (define-foreign sdl-joystick-update
1040 void "SDL_JoystickUpdate" '())
1041
1042 \f
1043 ;;;
1044 ;;; Game Controllers
1045 ;;;
1046
1047 (define-public SDL_CONTROLLER_AXIS_INVALID -1)
1048 (define-public SDL_CONTROLLER_AXIS_LEFTX 0)
1049 (define-public SDL_CONTROLLER_AXIS_LEFTY 1)
1050 (define-public SDL_CONTROLLER_AXIS_RIGHTX 2)
1051 (define-public SDL_CONTROLLER_AXIS_RIGHTY 3)
1052 (define-public SDL_CONTROLLER_AXIS_TRIGGERLEFT 4)
1053 (define-public SDL_CONTROLLER_AXIS_TRIGGERRIGHT 5)
1054 (define-public SDL_CONTROLLER_AXIS_MAX 6)
1055
1056 (define-public SDL_CONTROLLER_BUTTON_INVALID -1)
1057 (define-public SDL_CONTROLLER_BUTTON_A 0)
1058 (define-public SDL_CONTROLLER_BUTTON_B 1)
1059 (define-public SDL_CONTROLLER_BUTTON_X 2)
1060 (define-public SDL_CONTROLLER_BUTTON_Y 3)
1061 (define-public SDL_CONTROLLER_BUTTON_BACK 4)
1062 (define-public SDL_CONTROLLER_BUTTON_GUIDE 5)
1063 (define-public SDL_CONTROLLER_BUTTON_START 6)
1064 (define-public SDL_CONTROLLER_BUTTON_LEFTSTICK 7)
1065 (define-public SDL_CONTROLLER_BUTTON_RIGHTSTICK 8)
1066 (define-public SDL_CONTROLLER_BUTTON_LEFTSHOULDER 9)
1067 (define-public SDL_CONTROLLER_BUTTON_RIGHTSHOULDER 10)
1068 (define-public SDL_CONTROLLER_BUTTON_DPAD_UP 11)
1069 (define-public SDL_CONTROLLER_BUTTON_DPAD_DOWN 12)
1070 (define-public SDL_CONTROLLER_BUTTON_DPAD_LEFT 13)
1071 (define-public SDL_CONTROLLER_BUTTON_DPAD_RIGHT 14)
1072 (define-public SDL_CONTROLLER_BUTTON_MAX 15)
1073
1074 (define-foreign sdl-game-controller-add-mapping
1075 int "SDL_GameControllerAddMapping" '(*))
1076
1077 (define-foreign sdl-game-controller-open
1078 '* "SDL_GameControllerOpen" (list int))
1079
1080 (define-foreign sdl-game-controller-close
1081 void "SDL_GameControllerClose" '(*))
1082
1083 (define-foreign sdl-game-controller-event-state
1084 int "SDL_GameControllerEventState" (list int))
1085
1086 (define-foreign sdl-game-controller-from-instance-id
1087 '* "SDL_GameControllerFromInstanceID" (list int32))
1088
1089 (define-foreign sdl-game-controller-get-attached
1090 sdl-bool "SDL_GameControllerGetAttached" '(*))
1091
1092 (define-foreign sdl-game-controller-get-axis
1093 int16 "SDL_GameControllerGetAxis" (list '* int))
1094
1095 (define-foreign sdl-game-controller-get-axis-from-string
1096 int "SDL_GameControllerGetAxisFromString" '(*))
1097
1098 (define-foreign sdl-game-controller-get-string-for-axis
1099 '* "SDL_GameControllerGetStringForAxis" (list int))
1100
1101 (define-foreign sdl-game-controller-get-button
1102 uint8 "SDL_GameControllerGetButton" (list '* int))
1103
1104 (define-foreign sdl-game-controller-get-button-from-string
1105 int "SDL_GameControllerGetButtonFromString" '(*))
1106
1107 (define-foreign sdl-game-controller-get-string-for-button
1108 '* "SDL_GameControllerGetStringForButton" (list int))
1109
1110 (define-foreign sdl-game-controller-get-joystick
1111 '* "SDL_GameControllerGetJoystick" '(*))
1112
1113 (define-foreign sdl-game-controller-mapping
1114 '* "SDL_GameControllerMapping" '(*))
1115
1116 (define-foreign sdl-game-controller-mapping-for-guid
1117 '* "SDL_GameControllerMappingForGUID" '(*))
1118
1119 (define-foreign sdl-game-controller-name
1120 '* "SDL_GameControllerName" '(*))
1121
1122 (define-foreign sdl-game-controller-name-for-index
1123 '* "SDL_GameControllerNameForIndex" (list int))
1124
1125 (define-foreign sdl-game-controller-update
1126 void "SDL_GameControllerUpdate" '())
1127
1128 (define-foreign sdl-is-game-controller
1129 sdl-bool "SDL_IsGameController" (list int))