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