SDLRuby 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -22
  3. data/LICENSE.txt +21 -21
  4. data/README.md +31 -31
  5. data/Rakefile +12 -12
  6. data/SDLRuby.gemspec +38 -0
  7. data/examples/alert.rb +8 -0
  8. data/examples/window.rb +7 -0
  9. data/lib/SDLRuby/event/accessor.rb +2 -2
  10. data/lib/SDLRuby/event.rb +101 -101
  11. data/lib/SDLRuby/image/include/SDL_image.h.rb +61 -61
  12. data/lib/SDLRuby/mixer/include/SDL_mixer.h.rb +95 -95
  13. data/lib/SDLRuby/rw_ops/rw_object.rb +34 -34
  14. data/lib/SDLRuby/rw_ops.rb +91 -91
  15. data/lib/SDLRuby/sdl/include/SDL.h.rb +44 -44
  16. data/lib/SDLRuby/sdl/include/SDL_audio.h.rb +160 -160
  17. data/lib/SDLRuby/sdl/include/SDL_blendmode.h.rb +30 -30
  18. data/lib/SDLRuby/sdl/include/SDL_clipboard.h.rb +10 -10
  19. data/lib/SDLRuby/sdl/include/SDL_config.h.rb +13 -13
  20. data/lib/SDLRuby/sdl/include/SDL_cpuinfo.h.rb +27 -27
  21. data/lib/SDLRuby/sdl/include/SDL_endian.h.rb +12 -12
  22. data/lib/SDLRuby/sdl/include/SDL_error.h.rb +28 -28
  23. data/lib/SDLRuby/sdl/include/SDL_events.h.rb +472 -472
  24. data/lib/SDLRuby/sdl/include/SDL_filesystem.h.rb +6 -6
  25. data/lib/SDLRuby/sdl/include/SDL_gamecontroller.h.rb +147 -147
  26. data/lib/SDLRuby/sdl/include/SDL_gesture.h.rb +12 -12
  27. data/lib/SDLRuby/sdl/include/SDL_guid.h.rb +13 -13
  28. data/lib/SDLRuby/sdl/include/SDL_hints.h.rb +199 -199
  29. data/lib/SDLRuby/sdl/include/SDL_joystick.h.rb +131 -131
  30. data/lib/SDLRuby/sdl/include/SDL_keyboard.h.rb +35 -35
  31. data/lib/SDLRuby/sdl/include/SDL_keycode.h.rb +292 -292
  32. data/lib/SDLRuby/sdl/include/SDL_locale.h.rb +13 -13
  33. data/lib/SDLRuby/sdl/include/SDL_main.h.rb +3 -3
  34. data/lib/SDLRuby/sdl/include/SDL_messagebox.h.rb +58 -58
  35. data/lib/SDLRuby/sdl/include/SDL_misc.h.rb +5 -5
  36. data/lib/SDLRuby/sdl/include/SDL_mouse.h.rb +57 -57
  37. data/lib/SDLRuby/sdl/include/SDL_pixels.h.rb +285 -285
  38. data/lib/SDLRuby/sdl/include/SDL_platform.h.rb +3 -3
  39. data/lib/SDLRuby/sdl/include/SDL_power.h.rb +6 -6
  40. data/lib/SDLRuby/sdl/include/SDL_rect.h.rb +46 -46
  41. data/lib/SDLRuby/sdl/include/SDL_render.h.rb +131 -131
  42. data/lib/SDLRuby/sdl/include/SDL_revision.h.rb +2 -2
  43. data/lib/SDLRuby/sdl/include/SDL_rwops.h.rb +78 -78
  44. data/lib/SDLRuby/sdl/include/SDL_scancode.h.rb +252 -252
  45. data/lib/SDLRuby/sdl/include/SDL_sensor.h.rb +25 -25
  46. data/lib/SDLRuby/sdl/include/SDL_shape.h.rb +40 -40
  47. data/lib/SDLRuby/sdl/include/SDL_stdinc.h.rb +62 -62
  48. data/lib/SDLRuby/sdl/include/SDL_surface.h.rb +100 -100
  49. data/lib/SDLRuby/sdl/include/SDL_system.h.rb +6 -6
  50. data/lib/SDLRuby/sdl/include/SDL_syswm.h.rb +10 -10
  51. data/lib/SDLRuby/sdl/include/SDL_timer.h.rb +21 -21
  52. data/lib/SDLRuby/sdl/include/SDL_touch.h.rb +15 -15
  53. data/lib/SDLRuby/sdl/include/SDL_types.h.rb +3 -3
  54. data/lib/SDLRuby/sdl/include/SDL_version.h.rb +14 -14
  55. data/lib/SDLRuby/sdl/include/SDL_video.h.rb +264 -264
  56. data/lib/SDLRuby/sdl.rb +218 -218
  57. data/lib/SDLRuby/ttf/include/SDL_ttf.h.rb +54 -54
  58. data/lib/SDLRuby/version.rb +5 -5
  59. data/lib/SDLRuby/window/surfacer.rb +37 -37
  60. data/lib/SDLRuby.rb +32 -16
  61. data/sig/SDLRuby.rbs +4 -4
  62. data/sig/lib/SDLRuby/event/accessor.rbs +157 -157
  63. data/sig/lib/SDLRuby/event/type.rbs +67 -67
  64. data/sig/lib/SDLRuby/event.rbs +47 -47
  65. data/sig/lib/SDLRuby/keyboard.rbs +25 -25
  66. data/sig/lib/SDLRuby/mouse.rbs +35 -35
  67. data/sig/lib/SDLRuby/sdl.rbs +655 -655
  68. data/sig/lib/SDLRuby/timer.rbs +7 -7
  69. metadata +6 -3
@@ -1,472 +1,472 @@
1
- module SDLRuby::SDL
2
- require_relative "SDL_stdinc.h"
3
- require_relative "SDL_error.h"
4
- require_relative "SDL_video.h"
5
- require_relative "SDL_keyboard.h"
6
- require_relative "SDL_mouse.h"
7
- require_relative "SDL_joystick.h"
8
- require_relative "SDL_gamecontroller.h"
9
- require_relative "SDL_gesture.h"
10
- require_relative "SDL_touch.h"
11
-
12
- SDL_RELEASED = 0
13
- SDL_PRESSED = 1
14
-
15
- SDL_FIRSTEVENT = 0
16
- SDL_QUIT = 0x100
17
- SDL_APP_TERMINATING = 0x101
18
- SDL_APP_LOWMEMORY = 0x102
19
- SDL_APP_WILLENTERBACKGROUND = 0x103
20
- SDL_APP_DIDENTERBACKGROUND = 0x104
21
- SDL_APP_WILLENTERFOREGROUND = 0x105
22
- SDL_APP_DIDENTERFOREGROUND = 0x106
23
- SDL_LOCALECHANGED = 0x107
24
- SDL_DISPLAYEVENT = 0x150
25
- SDL_WINDOWEVENT = 0x200
26
- SDL_SYSWMEVENT = 0x201
27
- SDL_KEYDOWN = 0x300
28
- SDL_KEYUP = 0x301
29
- SDL_TEXTEDITING = 0x302
30
- SDL_TEXTINPUT = 0x303
31
- SDL_KEYMAPCHANGED = 0x304
32
- SDL_TEXTEDITING_EXT = 0x305
33
- SDL_MOUSEMOTION = 0x400
34
- SDL_MOUSEBUTTONDOWN = 0x401
35
- SDL_MOUSEBUTTONUP = 0x402
36
- SDL_MOUSEWHEEL = 0x403
37
- SDL_JOYAXISMOTION = 0x600
38
- SDL_JOYBALLMOTION = 0x601
39
- SDL_JOYHATMOTION = 0x602
40
- SDL_JOYBUTTONDOWN = 0x603
41
- SDL_JOYBUTTONUP = 0x604
42
- SDL_JOYDEVICEADDED = 0x605
43
- SDL_JOYDEVICEREMOVED = 0x606
44
- SDL_JOYBATTERYUPDATED = 0x607
45
- SDL_CONTROLLERAXISMOTION = 0x650
46
- SDL_CONTROLLERBUTTONDOWN = 0x651
47
- SDL_CONTROLLERBUTTONUP = 0x652
48
- SDL_CONTROLLERDEVICEADDED = 0x653
49
- SDL_CONTROLLERDEVICEREMOVED = 0x654
50
- SDL_CONTROLLERDEVICEREMAPPED = 0x655
51
- SDL_CONTROLLERTOUCHPADDOWN = 0x656
52
- SDL_CONTROLLERTOUCHPADMOTION = 0x657
53
- SDL_CONTROLLERTOUCHPADUP = 0x658
54
- SDL_CONTROLLERSENSORUPDATE = 0x659
55
- SDL_FINGERDOWN = 0x700
56
- SDL_FINGERUP = 0x701
57
- SDL_FINGERMOTION = 0x702
58
- SDL_DOLLARGESTURE = 0x800
59
- SDL_DOLLARRECORD = 0x801
60
- SDL_MULTIGESTURE = 0x802
61
- SDL_CLIPBOARDUPDATE = 0x900
62
- SDL_DROPFILE = 0x1000
63
- SDL_DROPTEXT = 0x1001
64
- SDL_DROPBEGIN = 0x1002
65
- SDL_DROPCOMPLETE = 0x1003
66
- SDL_AUDIODEVICEADDED = 0x1100
67
- SDL_AUDIODEVICEREMOVED = 0x1101
68
- SDL_SENSORUPDATE = 0x1200
69
- SDL_RENDER_TARGETS_RESET = 0x2000
70
- SDL_RENDER_DEVICE_RESET = 0x2001
71
- SDL_POLLSENTINEL = 0x7F00
72
- SDL_USEREVENT = 0x8000
73
- SDL_LASTEVENT = 0xFFFF
74
- typealias "SDL_EventType", "int"
75
-
76
- SDL_CommonEvent = struct(
77
- [
78
- "Uint32 type",
79
- "Uint32 timestamp",
80
- ]
81
- )
82
- SDL_DisplayEvent = struct(
83
- [
84
- "Uint32 type",
85
- "Uint32 timestamp",
86
- "Uint32 display",
87
- "Uint8 event",
88
- "Uint8 padding1",
89
- "Uint8 padding2",
90
- "Uint8 padding3",
91
- "Sint32 data1",
92
- ]
93
- )
94
- SDL_WindowEvent = struct(
95
- [
96
- "Uint32 type",
97
- "Uint32 timestamp",
98
- "Uint32 windowID",
99
- "Uint8 event",
100
- "Uint8 padding1",
101
- "Uint8 padding2",
102
- "Uint8 padding3",
103
- "Sint32 data1",
104
- "Sint32 data2",
105
- ]
106
- )
107
- SDL_KeyboardEvent = struct(
108
- [
109
- "Uint32 type",
110
- "Uint32 timestamp",
111
- "Uint32 windowID",
112
- "Uint8 state",
113
- "Uint8 repeat",
114
- "Uint8 padding2",
115
- "Uint8 padding3",
116
- { keysym: SDL_Keysym },
117
- ]
118
- )
119
- SDL_TEXTEDITINGEVENT_TEXT_SIZE = (32)
120
- SDL_TextEditingEvent = struct(
121
- [
122
- "Uint32 type",
123
- "Uint32 timestamp",
124
- "Uint32 windowID",
125
- "char text[#{SDL_TEXTEDITINGEVENT_TEXT_SIZE}]",
126
- "Sint32 start",
127
- "Sint32 length",
128
- ]
129
- )
130
- SDL_TextEditingExtEvent = struct(
131
- [
132
- "Uint32 type",
133
- "Uint32 timestamp",
134
- "Uint32 windowID",
135
- "char* text",
136
- "Sint32 start",
137
- "Sint32 length",
138
- ]
139
- )
140
- SDL_TEXTINPUTEVENT_TEXT_SIZE = (32)
141
- SDL_TextInputEvent = struct(
142
- [
143
- "Uint32 type",
144
- "Uint32 timestamp",
145
- "Uint32 windowID",
146
- "char text[#{SDL_TEXTINPUTEVENT_TEXT_SIZE}]",
147
- ]
148
- )
149
- SDL_MouseMotionEvent = struct(
150
- [
151
- "Uint32 type",
152
- "Uint32 timestamp",
153
- "Uint32 windowID",
154
- "Uint32 which",
155
- "Uint32 state",
156
- "Sint32 x",
157
- "Sint32 y",
158
- "Sint32 xrel",
159
- "Sint32 yrel",
160
- ]
161
- )
162
- SDL_MouseButtonEvent = struct(
163
- [
164
- "Uint32 type",
165
- "Uint32 timestamp",
166
- "Uint32 windowID",
167
- "Uint32 which",
168
- "Uint8 button",
169
- "Uint8 state",
170
- "Uint8 clicks",
171
- "Uint8 padding1",
172
- "Sint32 x",
173
- "Sint32 y",
174
- ]
175
- )
176
- SDL_MouseWheelEvent = struct(
177
- [
178
- "Uint32 type",
179
- "Uint32 timestamp",
180
- "Uint32 windowID",
181
- "Uint32 which",
182
- "Sint32 x",
183
- "Sint32 y",
184
- "Uint32 direction",
185
- "float preciseX",
186
- "float preciseY",
187
- "Sint32 mouseX",
188
- "Sint32 mouseY",
189
- ]
190
- )
191
- SDL_JoyAxisEvent = struct(
192
- [
193
- "Uint32 type",
194
- "Uint32 timestamp",
195
- "SDL_JoystickID which",
196
- "Uint8 axis",
197
- "Uint8 padding1",
198
- "Uint8 padding2",
199
- "Uint8 padding3",
200
- "Sint16 value",
201
- "Uint16 padding4",
202
- ]
203
- )
204
- SDL_JoyBallEvent = struct(
205
- [
206
- "Uint32 type",
207
- "Uint32 timestamp",
208
- "SDL_JoystickID which",
209
- "Uint8 ball",
210
- "Uint8 padding1",
211
- "Uint8 padding2",
212
- "Uint8 padding3",
213
- "Sint16 xrel",
214
- "Sint16 yrel",
215
- ]
216
- )
217
- SDL_JoyHatEvent = struct(
218
- [
219
- "Uint32 type",
220
- "Uint32 timestamp",
221
- "SDL_JoystickID which",
222
- "Uint8 hat",
223
- "Uint8 value",
224
- "Uint8 padding1",
225
- "Uint8 padding2",
226
- ]
227
- )
228
- SDL_JoyButtonEvent = struct(
229
- [
230
- "Uint32 type",
231
- "Uint32 timestamp",
232
- "SDL_JoystickID which",
233
- "Uint8 button",
234
- "Uint8 state",
235
- "Uint8 padding1",
236
- "Uint8 padding2",
237
- ]
238
- )
239
- SDL_JoyDeviceEvent = struct(
240
- [
241
- "Uint32 type",
242
- "Uint32 timestamp",
243
- "Sint32 which",
244
- ]
245
- )
246
- SDL_JoyBatteryEvent = struct(
247
- [
248
- "Uint32 type",
249
- "Uint32 timestamp",
250
- "SDL_JoystickID which",
251
- "SDL_JoystickPowerLevel level",
252
- ]
253
- )
254
- SDL_ControllerAxisEvent = struct(
255
- [
256
- "Uint32 type",
257
- "Uint32 timestamp",
258
- "SDL_JoystickID which",
259
- "Uint8 axis",
260
- "Uint8 padding1",
261
- "Uint8 padding2",
262
- "Uint8 padding3",
263
- "Sint16 value",
264
- "Uint16 padding4",
265
- ]
266
- )
267
- SDL_ControllerButtonEvent = struct(
268
- [
269
- "Uint32 type",
270
- "Uint32 timestamp",
271
- "SDL_JoystickID which",
272
- "Uint8 button",
273
- "Uint8 state",
274
- "Uint8 padding1",
275
- "Uint8 padding2",
276
- ]
277
- )
278
- SDL_ControllerDeviceEvent = struct(
279
- [
280
- "Uint32 type",
281
- "Uint32 timestamp",
282
- "Sint32 which",
283
- ]
284
- )
285
- SDL_ControllerTouchpadEvent = struct(
286
- [
287
- "Uint32 type",
288
- "Uint32 timestamp",
289
- "SDL_JoystickID which",
290
- "Sint32 touchpad",
291
- "Sint32 finger",
292
- "float x",
293
- "float y",
294
- "float pressure",
295
- ]
296
- )
297
- SDL_ControllerSensorEvent = struct(
298
- [
299
- "Uint32 type",
300
- "Uint32 timestamp",
301
- "SDL_JoystickID which",
302
- "Sint32 sensor",
303
- "float data[3]",
304
- "Uint64 timestamp_us",
305
- ]
306
- )
307
- SDL_AudioDeviceEvent = struct(
308
- [
309
- "Uint32 type",
310
- "Uint32 timestamp",
311
- "Uint32 which",
312
- "Uint8 iscapture",
313
- "Uint8 padding1",
314
- "Uint8 padding2",
315
- "Uint8 padding3",
316
- ]
317
- )
318
- SDL_TouchFingerEvent = struct(
319
- [
320
- "Uint32 type",
321
- "Uint32 timestamp",
322
- "SDL_TouchID touchId",
323
- "SDL_FingerID fingerId",
324
- "float x",
325
- "float y",
326
- "float dx",
327
- "float dy",
328
- "float pressure",
329
- "Uint32 windowID",
330
- ]
331
- )
332
- SDL_MultiGestureEvent = struct(
333
- [
334
- "Uint32 type",
335
- "Uint32 timestamp",
336
- "SDL_TouchID touchId",
337
- "float dTheta",
338
- "float dDist",
339
- "float x",
340
- "float y",
341
- "Uint16 numFingers",
342
- "Uint16 padding",
343
- ]
344
- )
345
- SDL_DollarGestureEvent = struct(
346
- [
347
- "Uint32 type",
348
- "Uint32 timestamp",
349
- "SDL_TouchID touchId",
350
- "SDL_GestureID gestureId",
351
- "Uint32 numFingers",
352
- "float error",
353
- "float x",
354
- "float y",
355
- ]
356
- )
357
- SDL_DropEvent = struct(
358
- [
359
- "Uint32 type",
360
- "Uint32 timestamp",
361
- "char *file",
362
- "Uint32 windowID",
363
- ]
364
- )
365
- SDL_SensorEvent = struct(
366
- [
367
- "Uint32 type",
368
- "Uint32 timestamp",
369
- "Sint32 which",
370
- "float data[6]",
371
- "Uint64 timestamp_us",
372
- ]
373
- )
374
- SDL_QuitEvent = struct(
375
- [
376
- "Uint32 type",
377
- "Uint32 timestamp",
378
- ]
379
- )
380
- SDL_OSEvent = struct(
381
- [
382
- "Uint32 type",
383
- "Uint32 timestamp",
384
- ]
385
- )
386
- SDL_UserEvent = struct(
387
- [
388
- "Uint32 type",
389
- "Uint32 timestamp",
390
- "Uint32 windowID",
391
- "Sint32 code",
392
- "void *data1",
393
- "void *data2",
394
- ]
395
- )
396
- SDL_SysWMEvent = struct(
397
- [
398
- "Uint32 type",
399
- "Uint32 timestamp",
400
- "SDL_SysWMmsg *msg",
401
- ]
402
- )
403
- SDL_Event = union(
404
- [
405
- "Uint32 type",
406
- { common: SDL_CommonEvent },
407
- { display: SDL_DisplayEvent },
408
- { window: SDL_WindowEvent },
409
- { key: SDL_KeyboardEvent },
410
- { edit: SDL_TextEditingEvent },
411
- { editExt: SDL_TextEditingExtEvent },
412
- { text: SDL_TextInputEvent },
413
- { motion: SDL_MouseMotionEvent },
414
- { button: SDL_MouseButtonEvent },
415
- { wheel: SDL_MouseWheelEvent },
416
- { jaxis: SDL_JoyAxisEvent },
417
- { jball: SDL_JoyBallEvent },
418
- { jhat: SDL_JoyHatEvent },
419
- { jbutton: SDL_JoyButtonEvent },
420
- { jdevice: SDL_JoyDeviceEvent },
421
- { jbattery: SDL_JoyBatteryEvent },
422
- { caxis: SDL_ControllerAxisEvent },
423
- { cbutton: SDL_ControllerButtonEvent },
424
- { cdevice: SDL_ControllerDeviceEvent },
425
- { ctouchpad: SDL_ControllerTouchpadEvent },
426
- { csensor: SDL_ControllerSensorEvent },
427
- { adevice: SDL_AudioDeviceEvent },
428
- { sensor: SDL_SensorEvent },
429
- { quit: SDL_QuitEvent },
430
- { user: SDL_UserEvent },
431
- { syswm: SDL_SysWMEvent },
432
- { tfinger: SDL_TouchFingerEvent },
433
- { mgesture: SDL_MultiGestureEvent },
434
- { dgesture: SDL_DollarGestureEvent },
435
- { drop: SDL_DropEvent },
436
- "Uint8 padding[#{Fiddle::SIZEOF_VOIDP <= 8 ? 56 : Fiddle::SIZEOF_VOIDP == 16 ? 64 : 3 * Fiddle::SIZEOF_VOIDP}]",
437
- ]
438
- )
439
-
440
- extern "void SDL_PumpEvents(void)"
441
-
442
- SDL_ADDEVENT = 0
443
- SDL_PEEKEVENT = 1
444
- SDL_GETEVENT = 2
445
- typealias "SDL_eventaction", "int"
446
-
447
- extern "int SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType)"
448
- extern "SDL_bool SDL_HasEvent(Uint32 type)"
449
- extern "SDL_bool SDL_HasEvents(Uint32 minType, Uint32 maxType)"
450
- extern "void SDL_FlushEvent(Uint32 type)"
451
- extern "void SDL_FlushEvents(Uint32 minType, Uint32 maxType)"
452
- extern "int SDL_PollEvent(SDL_Event * event)"
453
- extern "int SDL_WaitEvent(SDL_Event * event)"
454
- extern "int SDL_WaitEventTimeout(SDL_Event * event, int timeout)"
455
- extern "int SDL_PushEvent(SDL_Event * event)"
456
-
457
- typealias "SDL_EventFilter", "void*"
458
-
459
- extern "void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)"
460
- extern "SDL_bool SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata)"
461
- extern "void SDL_AddEventWatch(SDL_EventFilter filter, void *userdata)"
462
- extern "void SDL_DelEventWatch(SDL_EventFilter filter, void *userdata)"
463
- extern "void SDL_FilterEvents(SDL_EventFilter filter, void *userdata)"
464
-
465
- SDL_QUERY = -1
466
- SDL_IGNORE = 0
467
- SDL_DISABLE = 0
468
- SDL_ENABLE = 1
469
-
470
- extern "Uint8 SDL_EventState(Uint32 type, int state)"
471
- extern "Uint32 SDL_RegisterEvents(int numevents)"
472
- end
1
+ module SDLRuby::SDL
2
+ require_relative "SDL_stdinc.h"
3
+ require_relative "SDL_error.h"
4
+ require_relative "SDL_video.h"
5
+ require_relative "SDL_keyboard.h"
6
+ require_relative "SDL_mouse.h"
7
+ require_relative "SDL_joystick.h"
8
+ require_relative "SDL_gamecontroller.h"
9
+ require_relative "SDL_gesture.h"
10
+ require_relative "SDL_touch.h"
11
+
12
+ SDL_RELEASED = 0
13
+ SDL_PRESSED = 1
14
+
15
+ SDL_FIRSTEVENT = 0
16
+ SDL_QUIT = 0x100
17
+ SDL_APP_TERMINATING = 0x101
18
+ SDL_APP_LOWMEMORY = 0x102
19
+ SDL_APP_WILLENTERBACKGROUND = 0x103
20
+ SDL_APP_DIDENTERBACKGROUND = 0x104
21
+ SDL_APP_WILLENTERFOREGROUND = 0x105
22
+ SDL_APP_DIDENTERFOREGROUND = 0x106
23
+ SDL_LOCALECHANGED = 0x107
24
+ SDL_DISPLAYEVENT = 0x150
25
+ SDL_WINDOWEVENT = 0x200
26
+ SDL_SYSWMEVENT = 0x201
27
+ SDL_KEYDOWN = 0x300
28
+ SDL_KEYUP = 0x301
29
+ SDL_TEXTEDITING = 0x302
30
+ SDL_TEXTINPUT = 0x303
31
+ SDL_KEYMAPCHANGED = 0x304
32
+ SDL_TEXTEDITING_EXT = 0x305
33
+ SDL_MOUSEMOTION = 0x400
34
+ SDL_MOUSEBUTTONDOWN = 0x401
35
+ SDL_MOUSEBUTTONUP = 0x402
36
+ SDL_MOUSEWHEEL = 0x403
37
+ SDL_JOYAXISMOTION = 0x600
38
+ SDL_JOYBALLMOTION = 0x601
39
+ SDL_JOYHATMOTION = 0x602
40
+ SDL_JOYBUTTONDOWN = 0x603
41
+ SDL_JOYBUTTONUP = 0x604
42
+ SDL_JOYDEVICEADDED = 0x605
43
+ SDL_JOYDEVICEREMOVED = 0x606
44
+ SDL_JOYBATTERYUPDATED = 0x607
45
+ SDL_CONTROLLERAXISMOTION = 0x650
46
+ SDL_CONTROLLERBUTTONDOWN = 0x651
47
+ SDL_CONTROLLERBUTTONUP = 0x652
48
+ SDL_CONTROLLERDEVICEADDED = 0x653
49
+ SDL_CONTROLLERDEVICEREMOVED = 0x654
50
+ SDL_CONTROLLERDEVICEREMAPPED = 0x655
51
+ SDL_CONTROLLERTOUCHPADDOWN = 0x656
52
+ SDL_CONTROLLERTOUCHPADMOTION = 0x657
53
+ SDL_CONTROLLERTOUCHPADUP = 0x658
54
+ SDL_CONTROLLERSENSORUPDATE = 0x659
55
+ SDL_FINGERDOWN = 0x700
56
+ SDL_FINGERUP = 0x701
57
+ SDL_FINGERMOTION = 0x702
58
+ SDL_DOLLARGESTURE = 0x800
59
+ SDL_DOLLARRECORD = 0x801
60
+ SDL_MULTIGESTURE = 0x802
61
+ SDL_CLIPBOARDUPDATE = 0x900
62
+ SDL_DROPFILE = 0x1000
63
+ SDL_DROPTEXT = 0x1001
64
+ SDL_DROPBEGIN = 0x1002
65
+ SDL_DROPCOMPLETE = 0x1003
66
+ SDL_AUDIODEVICEADDED = 0x1100
67
+ SDL_AUDIODEVICEREMOVED = 0x1101
68
+ SDL_SENSORUPDATE = 0x1200
69
+ SDL_RENDER_TARGETS_RESET = 0x2000
70
+ SDL_RENDER_DEVICE_RESET = 0x2001
71
+ SDL_POLLSENTINEL = 0x7F00
72
+ SDL_USEREVENT = 0x8000
73
+ SDL_LASTEVENT = 0xFFFF
74
+ typealias "SDL_EventType", "int"
75
+
76
+ SDL_CommonEvent = struct(
77
+ [
78
+ "Uint32 type",
79
+ "Uint32 timestamp",
80
+ ]
81
+ )
82
+ SDL_DisplayEvent = struct(
83
+ [
84
+ "Uint32 type",
85
+ "Uint32 timestamp",
86
+ "Uint32 display",
87
+ "Uint8 event",
88
+ "Uint8 padding1",
89
+ "Uint8 padding2",
90
+ "Uint8 padding3",
91
+ "Sint32 data1",
92
+ ]
93
+ )
94
+ SDL_WindowEvent = struct(
95
+ [
96
+ "Uint32 type",
97
+ "Uint32 timestamp",
98
+ "Uint32 windowID",
99
+ "Uint8 event",
100
+ "Uint8 padding1",
101
+ "Uint8 padding2",
102
+ "Uint8 padding3",
103
+ "Sint32 data1",
104
+ "Sint32 data2",
105
+ ]
106
+ )
107
+ SDL_KeyboardEvent = struct(
108
+ [
109
+ "Uint32 type",
110
+ "Uint32 timestamp",
111
+ "Uint32 windowID",
112
+ "Uint8 state",
113
+ "Uint8 repeat",
114
+ "Uint8 padding2",
115
+ "Uint8 padding3",
116
+ { keysym: SDL_Keysym },
117
+ ]
118
+ )
119
+ SDL_TEXTEDITINGEVENT_TEXT_SIZE = (32)
120
+ SDL_TextEditingEvent = struct(
121
+ [
122
+ "Uint32 type",
123
+ "Uint32 timestamp",
124
+ "Uint32 windowID",
125
+ "char text[#{SDL_TEXTEDITINGEVENT_TEXT_SIZE}]",
126
+ "Sint32 start",
127
+ "Sint32 length",
128
+ ]
129
+ )
130
+ SDL_TextEditingExtEvent = struct(
131
+ [
132
+ "Uint32 type",
133
+ "Uint32 timestamp",
134
+ "Uint32 windowID",
135
+ "char* text",
136
+ "Sint32 start",
137
+ "Sint32 length",
138
+ ]
139
+ )
140
+ SDL_TEXTINPUTEVENT_TEXT_SIZE = (32)
141
+ SDL_TextInputEvent = struct(
142
+ [
143
+ "Uint32 type",
144
+ "Uint32 timestamp",
145
+ "Uint32 windowID",
146
+ "char text[#{SDL_TEXTINPUTEVENT_TEXT_SIZE}]",
147
+ ]
148
+ )
149
+ SDL_MouseMotionEvent = struct(
150
+ [
151
+ "Uint32 type",
152
+ "Uint32 timestamp",
153
+ "Uint32 windowID",
154
+ "Uint32 which",
155
+ "Uint32 state",
156
+ "Sint32 x",
157
+ "Sint32 y",
158
+ "Sint32 xrel",
159
+ "Sint32 yrel",
160
+ ]
161
+ )
162
+ SDL_MouseButtonEvent = struct(
163
+ [
164
+ "Uint32 type",
165
+ "Uint32 timestamp",
166
+ "Uint32 windowID",
167
+ "Uint32 which",
168
+ "Uint8 button",
169
+ "Uint8 state",
170
+ "Uint8 clicks",
171
+ "Uint8 padding1",
172
+ "Sint32 x",
173
+ "Sint32 y",
174
+ ]
175
+ )
176
+ SDL_MouseWheelEvent = struct(
177
+ [
178
+ "Uint32 type",
179
+ "Uint32 timestamp",
180
+ "Uint32 windowID",
181
+ "Uint32 which",
182
+ "Sint32 x",
183
+ "Sint32 y",
184
+ "Uint32 direction",
185
+ "float preciseX",
186
+ "float preciseY",
187
+ "Sint32 mouseX",
188
+ "Sint32 mouseY",
189
+ ]
190
+ )
191
+ SDL_JoyAxisEvent = struct(
192
+ [
193
+ "Uint32 type",
194
+ "Uint32 timestamp",
195
+ "SDL_JoystickID which",
196
+ "Uint8 axis",
197
+ "Uint8 padding1",
198
+ "Uint8 padding2",
199
+ "Uint8 padding3",
200
+ "Sint16 value",
201
+ "Uint16 padding4",
202
+ ]
203
+ )
204
+ SDL_JoyBallEvent = struct(
205
+ [
206
+ "Uint32 type",
207
+ "Uint32 timestamp",
208
+ "SDL_JoystickID which",
209
+ "Uint8 ball",
210
+ "Uint8 padding1",
211
+ "Uint8 padding2",
212
+ "Uint8 padding3",
213
+ "Sint16 xrel",
214
+ "Sint16 yrel",
215
+ ]
216
+ )
217
+ SDL_JoyHatEvent = struct(
218
+ [
219
+ "Uint32 type",
220
+ "Uint32 timestamp",
221
+ "SDL_JoystickID which",
222
+ "Uint8 hat",
223
+ "Uint8 value",
224
+ "Uint8 padding1",
225
+ "Uint8 padding2",
226
+ ]
227
+ )
228
+ SDL_JoyButtonEvent = struct(
229
+ [
230
+ "Uint32 type",
231
+ "Uint32 timestamp",
232
+ "SDL_JoystickID which",
233
+ "Uint8 button",
234
+ "Uint8 state",
235
+ "Uint8 padding1",
236
+ "Uint8 padding2",
237
+ ]
238
+ )
239
+ SDL_JoyDeviceEvent = struct(
240
+ [
241
+ "Uint32 type",
242
+ "Uint32 timestamp",
243
+ "Sint32 which",
244
+ ]
245
+ )
246
+ SDL_JoyBatteryEvent = struct(
247
+ [
248
+ "Uint32 type",
249
+ "Uint32 timestamp",
250
+ "SDL_JoystickID which",
251
+ "SDL_JoystickPowerLevel level",
252
+ ]
253
+ )
254
+ SDL_ControllerAxisEvent = struct(
255
+ [
256
+ "Uint32 type",
257
+ "Uint32 timestamp",
258
+ "SDL_JoystickID which",
259
+ "Uint8 axis",
260
+ "Uint8 padding1",
261
+ "Uint8 padding2",
262
+ "Uint8 padding3",
263
+ "Sint16 value",
264
+ "Uint16 padding4",
265
+ ]
266
+ )
267
+ SDL_ControllerButtonEvent = struct(
268
+ [
269
+ "Uint32 type",
270
+ "Uint32 timestamp",
271
+ "SDL_JoystickID which",
272
+ "Uint8 button",
273
+ "Uint8 state",
274
+ "Uint8 padding1",
275
+ "Uint8 padding2",
276
+ ]
277
+ )
278
+ SDL_ControllerDeviceEvent = struct(
279
+ [
280
+ "Uint32 type",
281
+ "Uint32 timestamp",
282
+ "Sint32 which",
283
+ ]
284
+ )
285
+ SDL_ControllerTouchpadEvent = struct(
286
+ [
287
+ "Uint32 type",
288
+ "Uint32 timestamp",
289
+ "SDL_JoystickID which",
290
+ "Sint32 touchpad",
291
+ "Sint32 finger",
292
+ "float x",
293
+ "float y",
294
+ "float pressure",
295
+ ]
296
+ )
297
+ SDL_ControllerSensorEvent = struct(
298
+ [
299
+ "Uint32 type",
300
+ "Uint32 timestamp",
301
+ "SDL_JoystickID which",
302
+ "Sint32 sensor",
303
+ "float data[3]",
304
+ "Uint64 timestamp_us",
305
+ ]
306
+ )
307
+ SDL_AudioDeviceEvent = struct(
308
+ [
309
+ "Uint32 type",
310
+ "Uint32 timestamp",
311
+ "Uint32 which",
312
+ "Uint8 iscapture",
313
+ "Uint8 padding1",
314
+ "Uint8 padding2",
315
+ "Uint8 padding3",
316
+ ]
317
+ )
318
+ SDL_TouchFingerEvent = struct(
319
+ [
320
+ "Uint32 type",
321
+ "Uint32 timestamp",
322
+ "SDL_TouchID touchId",
323
+ "SDL_FingerID fingerId",
324
+ "float x",
325
+ "float y",
326
+ "float dx",
327
+ "float dy",
328
+ "float pressure",
329
+ "Uint32 windowID",
330
+ ]
331
+ )
332
+ SDL_MultiGestureEvent = struct(
333
+ [
334
+ "Uint32 type",
335
+ "Uint32 timestamp",
336
+ "SDL_TouchID touchId",
337
+ "float dTheta",
338
+ "float dDist",
339
+ "float x",
340
+ "float y",
341
+ "Uint16 numFingers",
342
+ "Uint16 padding",
343
+ ]
344
+ )
345
+ SDL_DollarGestureEvent = struct(
346
+ [
347
+ "Uint32 type",
348
+ "Uint32 timestamp",
349
+ "SDL_TouchID touchId",
350
+ "SDL_GestureID gestureId",
351
+ "Uint32 numFingers",
352
+ "float error",
353
+ "float x",
354
+ "float y",
355
+ ]
356
+ )
357
+ SDL_DropEvent = struct(
358
+ [
359
+ "Uint32 type",
360
+ "Uint32 timestamp",
361
+ "char *file",
362
+ "Uint32 windowID",
363
+ ]
364
+ )
365
+ SDL_SensorEvent = struct(
366
+ [
367
+ "Uint32 type",
368
+ "Uint32 timestamp",
369
+ "Sint32 which",
370
+ "float data[6]",
371
+ "Uint64 timestamp_us",
372
+ ]
373
+ )
374
+ SDL_QuitEvent = struct(
375
+ [
376
+ "Uint32 type",
377
+ "Uint32 timestamp",
378
+ ]
379
+ )
380
+ SDL_OSEvent = struct(
381
+ [
382
+ "Uint32 type",
383
+ "Uint32 timestamp",
384
+ ]
385
+ )
386
+ SDL_UserEvent = struct(
387
+ [
388
+ "Uint32 type",
389
+ "Uint32 timestamp",
390
+ "Uint32 windowID",
391
+ "Sint32 code",
392
+ "void *data1",
393
+ "void *data2",
394
+ ]
395
+ )
396
+ SDL_SysWMEvent = struct(
397
+ [
398
+ "Uint32 type",
399
+ "Uint32 timestamp",
400
+ "SDL_SysWMmsg *msg",
401
+ ]
402
+ )
403
+ SDL_Event = union(
404
+ [
405
+ "Uint32 type",
406
+ { common: SDL_CommonEvent },
407
+ { display: SDL_DisplayEvent },
408
+ { window: SDL_WindowEvent },
409
+ { key: SDL_KeyboardEvent },
410
+ { edit: SDL_TextEditingEvent },
411
+ { editExt: SDL_TextEditingExtEvent },
412
+ { text: SDL_TextInputEvent },
413
+ { motion: SDL_MouseMotionEvent },
414
+ { button: SDL_MouseButtonEvent },
415
+ { wheel: SDL_MouseWheelEvent },
416
+ { jaxis: SDL_JoyAxisEvent },
417
+ { jball: SDL_JoyBallEvent },
418
+ { jhat: SDL_JoyHatEvent },
419
+ { jbutton: SDL_JoyButtonEvent },
420
+ { jdevice: SDL_JoyDeviceEvent },
421
+ { jbattery: SDL_JoyBatteryEvent },
422
+ { caxis: SDL_ControllerAxisEvent },
423
+ { cbutton: SDL_ControllerButtonEvent },
424
+ { cdevice: SDL_ControllerDeviceEvent },
425
+ { ctouchpad: SDL_ControllerTouchpadEvent },
426
+ { csensor: SDL_ControllerSensorEvent },
427
+ { adevice: SDL_AudioDeviceEvent },
428
+ { sensor: SDL_SensorEvent },
429
+ { quit: SDL_QuitEvent },
430
+ { user: SDL_UserEvent },
431
+ { syswm: SDL_SysWMEvent },
432
+ { tfinger: SDL_TouchFingerEvent },
433
+ { mgesture: SDL_MultiGestureEvent },
434
+ { dgesture: SDL_DollarGestureEvent },
435
+ { drop: SDL_DropEvent },
436
+ "Uint8 padding[#{Fiddle::SIZEOF_VOIDP <= 8 ? 56 : Fiddle::SIZEOF_VOIDP == 16 ? 64 : 3 * Fiddle::SIZEOF_VOIDP}]",
437
+ ]
438
+ )
439
+
440
+ extern "void SDL_PumpEvents(void)"
441
+
442
+ SDL_ADDEVENT = 0
443
+ SDL_PEEKEVENT = 1
444
+ SDL_GETEVENT = 2
445
+ typealias "SDL_eventaction", "int"
446
+
447
+ extern "int SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType)"
448
+ extern "SDL_bool SDL_HasEvent(Uint32 type)"
449
+ extern "SDL_bool SDL_HasEvents(Uint32 minType, Uint32 maxType)"
450
+ extern "void SDL_FlushEvent(Uint32 type)"
451
+ extern "void SDL_FlushEvents(Uint32 minType, Uint32 maxType)"
452
+ extern "int SDL_PollEvent(SDL_Event * event)"
453
+ extern "int SDL_WaitEvent(SDL_Event * event)"
454
+ extern "int SDL_WaitEventTimeout(SDL_Event * event, int timeout)"
455
+ extern "int SDL_PushEvent(SDL_Event * event)"
456
+
457
+ typealias "SDL_EventFilter", "void*"
458
+
459
+ extern "void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata)"
460
+ extern "SDL_bool SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata)"
461
+ extern "void SDL_AddEventWatch(SDL_EventFilter filter, void *userdata)"
462
+ extern "void SDL_DelEventWatch(SDL_EventFilter filter, void *userdata)"
463
+ extern "void SDL_FilterEvents(SDL_EventFilter filter, void *userdata)"
464
+
465
+ SDL_QUERY = -1
466
+ SDL_IGNORE = 0
467
+ SDL_DISABLE = 0
468
+ SDL_ENABLE = 1
469
+
470
+ extern "Uint8 SDL_EventState(Uint32 type, int state)"
471
+ extern "Uint32 SDL_RegisterEvents(int numevents)"
472
+ end