sdl2-bindings 0.0.0.pre

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.
@@ -0,0 +1,68 @@
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL2
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+ SDL_BLENDMODE_NONE = 0
17
+ SDL_BLENDMODE_BLEND = 1
18
+ SDL_BLENDMODE_ADD = 2
19
+ SDL_BLENDMODE_MOD = 4
20
+ SDL_BLENDMODE_INVALID = 2147483647
21
+ SDL_BLENDOPERATION_ADD = 1
22
+ SDL_BLENDOPERATION_SUBTRACT = 2
23
+ SDL_BLENDOPERATION_REV_SUBTRACT = 3
24
+ SDL_BLENDOPERATION_MINIMUM = 4
25
+ SDL_BLENDOPERATION_MAXIMUM = 5
26
+ SDL_BLENDFACTOR_ZERO = 1
27
+ SDL_BLENDFACTOR_ONE = 2
28
+ SDL_BLENDFACTOR_SRC_COLOR = 3
29
+ SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 4
30
+ SDL_BLENDFACTOR_SRC_ALPHA = 5
31
+ SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 6
32
+ SDL_BLENDFACTOR_DST_COLOR = 7
33
+ SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 8
34
+ SDL_BLENDFACTOR_DST_ALPHA = 9
35
+ SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 10
36
+
37
+ # Typedef
38
+
39
+ typedef :int, :SDL_BlendMode
40
+ typedef :int, :SDL_BlendOperation
41
+ typedef :int, :SDL_BlendFactor
42
+
43
+ # Struct
44
+
45
+
46
+ # Function
47
+
48
+ def self.setup_blendmode_symbols()
49
+ symbols = [
50
+ :SDL_ComposeCustomBlendMode,
51
+ ]
52
+ args = {
53
+ :SDL_ComposeCustomBlendMode => [:int, :int, :int, :int, :int, :int],
54
+ }
55
+ retvals = {
56
+ :SDL_ComposeCustomBlendMode => :int,
57
+ }
58
+ symbols.each do |sym|
59
+ begin
60
+ attach_function sym, args[sym], retvals[sym]
61
+ rescue FFI::NotFoundError => error
62
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
63
+ end
64
+ end
65
+ end
66
+
67
+ end
68
+
@@ -0,0 +1,51 @@
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL2
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ # Struct
21
+
22
+
23
+ # Function
24
+
25
+ def self.setup_clipboard_symbols()
26
+ symbols = [
27
+ :SDL_SetClipboardText,
28
+ :SDL_GetClipboardText,
29
+ :SDL_HasClipboardText,
30
+ ]
31
+ args = {
32
+ :SDL_SetClipboardText => [:pointer],
33
+ :SDL_GetClipboardText => [],
34
+ :SDL_HasClipboardText => [],
35
+ }
36
+ retvals = {
37
+ :SDL_SetClipboardText => :int,
38
+ :SDL_GetClipboardText => :pointer,
39
+ :SDL_HasClipboardText => :int,
40
+ }
41
+ symbols.each do |sym|
42
+ begin
43
+ attach_function sym, args[sym], retvals[sym]
44
+ rescue FFI::NotFoundError => error
45
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
46
+ end
47
+ end
48
+ end
49
+
50
+ end
51
+
@@ -0,0 +1,100 @@
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL2
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ SDL_CACHELINE_SIZE = 128
14
+
15
+ # Enum
16
+
17
+
18
+ # Typedef
19
+
20
+
21
+ # Struct
22
+
23
+
24
+ # Function
25
+
26
+ def self.setup_cpuinfo_symbols()
27
+ symbols = [
28
+ :SDL_GetCPUCount,
29
+ :SDL_GetCPUCacheLineSize,
30
+ :SDL_HasRDTSC,
31
+ :SDL_HasAltiVec,
32
+ :SDL_HasMMX,
33
+ :SDL_Has3DNow,
34
+ :SDL_HasSSE,
35
+ :SDL_HasSSE2,
36
+ :SDL_HasSSE3,
37
+ :SDL_HasSSE41,
38
+ :SDL_HasSSE42,
39
+ :SDL_HasAVX,
40
+ :SDL_HasAVX2,
41
+ :SDL_HasAVX512F,
42
+ :SDL_HasNEON,
43
+ :SDL_GetSystemRAM,
44
+ :SDL_SIMDGetAlignment,
45
+ :SDL_SIMDAlloc,
46
+ :SDL_SIMDFree,
47
+ ]
48
+ args = {
49
+ :SDL_GetCPUCount => [],
50
+ :SDL_GetCPUCacheLineSize => [],
51
+ :SDL_HasRDTSC => [],
52
+ :SDL_HasAltiVec => [],
53
+ :SDL_HasMMX => [],
54
+ :SDL_Has3DNow => [],
55
+ :SDL_HasSSE => [],
56
+ :SDL_HasSSE2 => [],
57
+ :SDL_HasSSE3 => [],
58
+ :SDL_HasSSE41 => [],
59
+ :SDL_HasSSE42 => [],
60
+ :SDL_HasAVX => [],
61
+ :SDL_HasAVX2 => [],
62
+ :SDL_HasAVX512F => [],
63
+ :SDL_HasNEON => [],
64
+ :SDL_GetSystemRAM => [],
65
+ :SDL_SIMDGetAlignment => [],
66
+ :SDL_SIMDAlloc => [:ulong],
67
+ :SDL_SIMDFree => [:pointer],
68
+ }
69
+ retvals = {
70
+ :SDL_GetCPUCount => :int,
71
+ :SDL_GetCPUCacheLineSize => :int,
72
+ :SDL_HasRDTSC => :int,
73
+ :SDL_HasAltiVec => :int,
74
+ :SDL_HasMMX => :int,
75
+ :SDL_Has3DNow => :int,
76
+ :SDL_HasSSE => :int,
77
+ :SDL_HasSSE2 => :int,
78
+ :SDL_HasSSE3 => :int,
79
+ :SDL_HasSSE41 => :int,
80
+ :SDL_HasSSE42 => :int,
81
+ :SDL_HasAVX => :int,
82
+ :SDL_HasAVX2 => :int,
83
+ :SDL_HasAVX512F => :int,
84
+ :SDL_HasNEON => :int,
85
+ :SDL_GetSystemRAM => :int,
86
+ :SDL_SIMDGetAlignment => :size_t,
87
+ :SDL_SIMDAlloc => :pointer,
88
+ :SDL_SIMDFree => :void,
89
+ }
90
+ symbols.each do |sym|
91
+ begin
92
+ attach_function sym, args[sym], retvals[sym]
93
+ rescue FFI::NotFoundError => error
94
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
95
+ end
96
+ end
97
+ end
98
+
99
+ end
100
+
@@ -0,0 +1,61 @@
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL2
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+ SDL_ENOMEM = 0
17
+ SDL_EFREAD = 1
18
+ SDL_EFWRITE = 2
19
+ SDL_EFSEEK = 3
20
+ SDL_UNSUPPORTED = 4
21
+ SDL_LASTERROR = 5
22
+
23
+ # Typedef
24
+
25
+ typedef :int, :SDL_errorcode
26
+
27
+ # Struct
28
+
29
+
30
+ # Function
31
+
32
+ def self.setup_error_symbols()
33
+ symbols = [
34
+ :SDL_SetError,
35
+ :SDL_GetError,
36
+ :SDL_ClearError,
37
+ :SDL_Error,
38
+ ]
39
+ args = {
40
+ :SDL_SetError => [:pointer],
41
+ :SDL_GetError => [],
42
+ :SDL_ClearError => [],
43
+ :SDL_Error => [:int],
44
+ }
45
+ retvals = {
46
+ :SDL_SetError => :int,
47
+ :SDL_GetError => :pointer,
48
+ :SDL_ClearError => :void,
49
+ :SDL_Error => :int,
50
+ }
51
+ symbols.each do |sym|
52
+ begin
53
+ attach_function sym, args[sym], retvals[sym]
54
+ rescue FFI::NotFoundError => error
55
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
56
+ end
57
+ end
58
+ end
59
+
60
+ end
61
+
@@ -0,0 +1,499 @@
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+ require_relative 'sdl2_keyboard'
9
+
10
+ module SDL2
11
+ extend FFI::Library
12
+ # Define/Macro
13
+
14
+ SDL_RELEASED = 0
15
+ SDL_PRESSED = 1
16
+ SDL_TEXTEDITINGEVENT_TEXT_SIZE = ( 32 )
17
+ SDL_TEXTINPUTEVENT_TEXT_SIZE = ( 32 )
18
+ SDL_QUERY = -1
19
+ SDL_IGNORE = 0
20
+ SDL_DISABLE = 0
21
+ SDL_ENABLE = 1
22
+
23
+ # Enum
24
+
25
+ SDL_FIRSTEVENT = 0
26
+ SDL_QUIT = 256
27
+ SDL_APP_TERMINATING = 257
28
+ SDL_APP_LOWMEMORY = 258
29
+ SDL_APP_WILLENTERBACKGROUND = 259
30
+ SDL_APP_DIDENTERBACKGROUND = 260
31
+ SDL_APP_WILLENTERFOREGROUND = 261
32
+ SDL_APP_DIDENTERFOREGROUND = 262
33
+ SDL_DISPLAYEVENT = 336
34
+ SDL_WINDOWEVENT = 512
35
+ SDL_SYSWMEVENT = 513
36
+ SDL_KEYDOWN = 768
37
+ SDL_KEYUP = 769
38
+ SDL_TEXTEDITING = 770
39
+ SDL_TEXTINPUT = 771
40
+ SDL_KEYMAPCHANGED = 772
41
+ SDL_MOUSEMOTION = 1024
42
+ SDL_MOUSEBUTTONDOWN = 1025
43
+ SDL_MOUSEBUTTONUP = 1026
44
+ SDL_MOUSEWHEEL = 1027
45
+ SDL_JOYAXISMOTION = 1536
46
+ SDL_JOYBALLMOTION = 1537
47
+ SDL_JOYHATMOTION = 1538
48
+ SDL_JOYBUTTONDOWN = 1539
49
+ SDL_JOYBUTTONUP = 1540
50
+ SDL_JOYDEVICEADDED = 1541
51
+ SDL_JOYDEVICEREMOVED = 1542
52
+ SDL_CONTROLLERAXISMOTION = 1616
53
+ SDL_CONTROLLERBUTTONDOWN = 1617
54
+ SDL_CONTROLLERBUTTONUP = 1618
55
+ SDL_CONTROLLERDEVICEADDED = 1619
56
+ SDL_CONTROLLERDEVICEREMOVED = 1620
57
+ SDL_CONTROLLERDEVICEREMAPPED = 1621
58
+ SDL_FINGERDOWN = 1792
59
+ SDL_FINGERUP = 1793
60
+ SDL_FINGERMOTION = 1794
61
+ SDL_DOLLARGESTURE = 2048
62
+ SDL_DOLLARRECORD = 2049
63
+ SDL_MULTIGESTURE = 2050
64
+ SDL_CLIPBOARDUPDATE = 2304
65
+ SDL_DROPFILE = 4096
66
+ SDL_DROPTEXT = 4097
67
+ SDL_DROPBEGIN = 4098
68
+ SDL_DROPCOMPLETE = 4099
69
+ SDL_AUDIODEVICEADDED = 4352
70
+ SDL_AUDIODEVICEREMOVED = 4353
71
+ SDL_SENSORUPDATE = 4608
72
+ SDL_RENDER_TARGETS_RESET = 8192
73
+ SDL_RENDER_DEVICE_RESET = 8193
74
+ SDL_USEREVENT = 32768
75
+ SDL_LASTEVENT = 65535
76
+ SDL_ADDEVENT = 0
77
+ SDL_PEEKEVENT = 1
78
+ SDL_GETEVENT = 2
79
+
80
+ # Typedef
81
+
82
+ typedef :int, :SDL_EventType
83
+ typedef :int, :SDL_compile_time_assert_SDL_Event
84
+ typedef :int, :SDL_eventaction
85
+ callback :SDL_EventFilter, [:pointer, :pointer], :int
86
+
87
+ # Struct
88
+
89
+ class SDL_CommonEvent < FFI::Struct
90
+ layout(
91
+ :type, :uint,
92
+ :timestamp, :uint,
93
+ )
94
+ end
95
+
96
+ class SDL_DisplayEvent < FFI::Struct
97
+ layout(
98
+ :type, :uint,
99
+ :timestamp, :uint,
100
+ :display, :uint,
101
+ :event, :uchar,
102
+ :padding1, :uchar,
103
+ :padding2, :uchar,
104
+ :padding3, :uchar,
105
+ :data1, :int,
106
+ )
107
+ end
108
+
109
+ class SDL_WindowEvent < FFI::Struct
110
+ layout(
111
+ :type, :uint,
112
+ :timestamp, :uint,
113
+ :windowID, :uint,
114
+ :event, :uchar,
115
+ :padding1, :uchar,
116
+ :padding2, :uchar,
117
+ :padding3, :uchar,
118
+ :data1, :int,
119
+ :data2, :int,
120
+ )
121
+ end
122
+
123
+ class SDL_KeyboardEvent < FFI::Struct
124
+ layout(
125
+ :type, :uint,
126
+ :timestamp, :uint,
127
+ :windowID, :uint,
128
+ :state, :uchar,
129
+ :repeat, :uchar,
130
+ :padding2, :uchar,
131
+ :padding3, :uchar,
132
+ :keysym, SDL_Keysym,
133
+ )
134
+ end
135
+
136
+ class SDL_TextEditingEvent < FFI::Struct
137
+ layout(
138
+ :type, :uint,
139
+ :timestamp, :uint,
140
+ :windowID, :uint,
141
+ :text, [:char, 32],
142
+ :start, :int,
143
+ :length, :int,
144
+ )
145
+ end
146
+
147
+ class SDL_TextInputEvent < FFI::Struct
148
+ layout(
149
+ :type, :uint,
150
+ :timestamp, :uint,
151
+ :windowID, :uint,
152
+ :text, [:char, 32],
153
+ )
154
+ end
155
+
156
+ class SDL_MouseMotionEvent < FFI::Struct
157
+ layout(
158
+ :type, :uint,
159
+ :timestamp, :uint,
160
+ :windowID, :uint,
161
+ :which, :uint,
162
+ :state, :uint,
163
+ :x, :int,
164
+ :y, :int,
165
+ :xrel, :int,
166
+ :yrel, :int,
167
+ )
168
+ end
169
+
170
+ class SDL_MouseButtonEvent < FFI::Struct
171
+ layout(
172
+ :type, :uint,
173
+ :timestamp, :uint,
174
+ :windowID, :uint,
175
+ :which, :uint,
176
+ :button, :uchar,
177
+ :state, :uchar,
178
+ :clicks, :uchar,
179
+ :padding1, :uchar,
180
+ :x, :int,
181
+ :y, :int,
182
+ )
183
+ end
184
+
185
+ class SDL_MouseWheelEvent < FFI::Struct
186
+ layout(
187
+ :type, :uint,
188
+ :timestamp, :uint,
189
+ :windowID, :uint,
190
+ :which, :uint,
191
+ :x, :int,
192
+ :y, :int,
193
+ :direction, :uint,
194
+ )
195
+ end
196
+
197
+ class SDL_JoyAxisEvent < FFI::Struct
198
+ layout(
199
+ :type, :uint,
200
+ :timestamp, :uint,
201
+ :which, :int,
202
+ :axis, :uchar,
203
+ :padding1, :uchar,
204
+ :padding2, :uchar,
205
+ :padding3, :uchar,
206
+ :value, :short,
207
+ :padding4, :ushort,
208
+ )
209
+ end
210
+
211
+ class SDL_JoyBallEvent < FFI::Struct
212
+ layout(
213
+ :type, :uint,
214
+ :timestamp, :uint,
215
+ :which, :int,
216
+ :ball, :uchar,
217
+ :padding1, :uchar,
218
+ :padding2, :uchar,
219
+ :padding3, :uchar,
220
+ :xrel, :short,
221
+ :yrel, :short,
222
+ )
223
+ end
224
+
225
+ class SDL_JoyHatEvent < FFI::Struct
226
+ layout(
227
+ :type, :uint,
228
+ :timestamp, :uint,
229
+ :which, :int,
230
+ :hat, :uchar,
231
+ :value, :uchar,
232
+ :padding1, :uchar,
233
+ :padding2, :uchar,
234
+ )
235
+ end
236
+
237
+ class SDL_JoyButtonEvent < FFI::Struct
238
+ layout(
239
+ :type, :uint,
240
+ :timestamp, :uint,
241
+ :which, :int,
242
+ :button, :uchar,
243
+ :state, :uchar,
244
+ :padding1, :uchar,
245
+ :padding2, :uchar,
246
+ )
247
+ end
248
+
249
+ class SDL_JoyDeviceEvent < FFI::Struct
250
+ layout(
251
+ :type, :uint,
252
+ :timestamp, :uint,
253
+ :which, :int,
254
+ )
255
+ end
256
+
257
+ class SDL_ControllerAxisEvent < FFI::Struct
258
+ layout(
259
+ :type, :uint,
260
+ :timestamp, :uint,
261
+ :which, :int,
262
+ :axis, :uchar,
263
+ :padding1, :uchar,
264
+ :padding2, :uchar,
265
+ :padding3, :uchar,
266
+ :value, :short,
267
+ :padding4, :ushort,
268
+ )
269
+ end
270
+
271
+ class SDL_ControllerButtonEvent < FFI::Struct
272
+ layout(
273
+ :type, :uint,
274
+ :timestamp, :uint,
275
+ :which, :int,
276
+ :button, :uchar,
277
+ :state, :uchar,
278
+ :padding1, :uchar,
279
+ :padding2, :uchar,
280
+ )
281
+ end
282
+
283
+ class SDL_ControllerDeviceEvent < FFI::Struct
284
+ layout(
285
+ :type, :uint,
286
+ :timestamp, :uint,
287
+ :which, :int,
288
+ )
289
+ end
290
+
291
+ class SDL_AudioDeviceEvent < FFI::Struct
292
+ layout(
293
+ :type, :uint,
294
+ :timestamp, :uint,
295
+ :which, :uint,
296
+ :iscapture, :uchar,
297
+ :padding1, :uchar,
298
+ :padding2, :uchar,
299
+ :padding3, :uchar,
300
+ )
301
+ end
302
+
303
+ class SDL_TouchFingerEvent < FFI::Struct
304
+ layout(
305
+ :type, :uint,
306
+ :timestamp, :uint,
307
+ :touchId, :long_long,
308
+ :fingerId, :long_long,
309
+ :x, :float,
310
+ :y, :float,
311
+ :dx, :float,
312
+ :dy, :float,
313
+ :pressure, :float,
314
+ )
315
+ end
316
+
317
+ class SDL_MultiGestureEvent < FFI::Struct
318
+ layout(
319
+ :type, :uint,
320
+ :timestamp, :uint,
321
+ :touchId, :long_long,
322
+ :dTheta, :float,
323
+ :dDist, :float,
324
+ :x, :float,
325
+ :y, :float,
326
+ :numFingers, :ushort,
327
+ :padding, :ushort,
328
+ )
329
+ end
330
+
331
+ class SDL_DollarGestureEvent < FFI::Struct
332
+ layout(
333
+ :type, :uint,
334
+ :timestamp, :uint,
335
+ :touchId, :long_long,
336
+ :gestureId, :long_long,
337
+ :numFingers, :uint,
338
+ :error, :float,
339
+ :x, :float,
340
+ :y, :float,
341
+ )
342
+ end
343
+
344
+ class SDL_DropEvent < FFI::Struct
345
+ layout(
346
+ :type, :uint,
347
+ :timestamp, :uint,
348
+ :file, :pointer,
349
+ :windowID, :uint,
350
+ )
351
+ end
352
+
353
+ class SDL_SensorEvent < FFI::Struct
354
+ layout(
355
+ :type, :uint,
356
+ :timestamp, :uint,
357
+ :which, :int,
358
+ :data, [:float, 6],
359
+ )
360
+ end
361
+
362
+ class SDL_QuitEvent < FFI::Struct
363
+ layout(
364
+ :type, :uint,
365
+ :timestamp, :uint,
366
+ )
367
+ end
368
+
369
+ class SDL_OSEvent < FFI::Struct
370
+ layout(
371
+ :type, :uint,
372
+ :timestamp, :uint,
373
+ )
374
+ end
375
+
376
+ class SDL_UserEvent < FFI::Struct
377
+ layout(
378
+ :type, :uint,
379
+ :timestamp, :uint,
380
+ :windowID, :uint,
381
+ :code, :int,
382
+ :data1, :pointer,
383
+ :data2, :pointer,
384
+ )
385
+ end
386
+
387
+ class SDL_SysWMEvent < FFI::Struct
388
+ layout(
389
+ :type, :uint,
390
+ :timestamp, :uint,
391
+ :msg, :pointer,
392
+ )
393
+ end
394
+
395
+ class SDL_Event < FFI::Union
396
+ layout(
397
+ :type, :uint,
398
+ :common, SDL_CommonEvent,
399
+ :display, SDL_DisplayEvent,
400
+ :window, SDL_WindowEvent,
401
+ :key, SDL_KeyboardEvent,
402
+ :edit, SDL_TextEditingEvent,
403
+ :text, SDL_TextInputEvent,
404
+ :motion, SDL_MouseMotionEvent,
405
+ :button, SDL_MouseButtonEvent,
406
+ :wheel, SDL_MouseWheelEvent,
407
+ :jaxis, SDL_JoyAxisEvent,
408
+ :jball, SDL_JoyBallEvent,
409
+ :jhat, SDL_JoyHatEvent,
410
+ :jbutton, SDL_JoyButtonEvent,
411
+ :jdevice, SDL_JoyDeviceEvent,
412
+ :caxis, SDL_ControllerAxisEvent,
413
+ :cbutton, SDL_ControllerButtonEvent,
414
+ :cdevice, SDL_ControllerDeviceEvent,
415
+ :adevice, SDL_AudioDeviceEvent,
416
+ :sensor, SDL_SensorEvent,
417
+ :quit, SDL_QuitEvent,
418
+ :user, SDL_UserEvent,
419
+ :syswm, SDL_SysWMEvent,
420
+ :tfinger, SDL_TouchFingerEvent,
421
+ :mgesture, SDL_MultiGestureEvent,
422
+ :dgesture, SDL_DollarGestureEvent,
423
+ :drop, SDL_DropEvent,
424
+ :padding, [:uchar, 56],
425
+ )
426
+ end
427
+
428
+
429
+ # Function
430
+
431
+ def self.setup_events_symbols()
432
+ symbols = [
433
+ :SDL_PumpEvents,
434
+ :SDL_PeepEvents,
435
+ :SDL_HasEvent,
436
+ :SDL_HasEvents,
437
+ :SDL_FlushEvent,
438
+ :SDL_FlushEvents,
439
+ :SDL_PollEvent,
440
+ :SDL_WaitEvent,
441
+ :SDL_WaitEventTimeout,
442
+ :SDL_PushEvent,
443
+ :SDL_SetEventFilter,
444
+ :SDL_GetEventFilter,
445
+ :SDL_AddEventWatch,
446
+ :SDL_DelEventWatch,
447
+ :SDL_FilterEvents,
448
+ :SDL_EventState,
449
+ :SDL_RegisterEvents,
450
+ ]
451
+ args = {
452
+ :SDL_PumpEvents => [],
453
+ :SDL_PeepEvents => [:pointer, :int, :int, :uint, :uint],
454
+ :SDL_HasEvent => [:uint],
455
+ :SDL_HasEvents => [:uint, :uint],
456
+ :SDL_FlushEvent => [:uint],
457
+ :SDL_FlushEvents => [:uint, :uint],
458
+ :SDL_PollEvent => [:pointer],
459
+ :SDL_WaitEvent => [:pointer],
460
+ :SDL_WaitEventTimeout => [:pointer, :int],
461
+ :SDL_PushEvent => [:pointer],
462
+ :SDL_SetEventFilter => [:pointer, :pointer],
463
+ :SDL_GetEventFilter => [:pointer, :pointer],
464
+ :SDL_AddEventWatch => [:pointer, :pointer],
465
+ :SDL_DelEventWatch => [:pointer, :pointer],
466
+ :SDL_FilterEvents => [:pointer, :pointer],
467
+ :SDL_EventState => [:uint, :int],
468
+ :SDL_RegisterEvents => [:int],
469
+ }
470
+ retvals = {
471
+ :SDL_PumpEvents => :void,
472
+ :SDL_PeepEvents => :int,
473
+ :SDL_HasEvent => :int,
474
+ :SDL_HasEvents => :int,
475
+ :SDL_FlushEvent => :void,
476
+ :SDL_FlushEvents => :void,
477
+ :SDL_PollEvent => :int,
478
+ :SDL_WaitEvent => :int,
479
+ :SDL_WaitEventTimeout => :int,
480
+ :SDL_PushEvent => :int,
481
+ :SDL_SetEventFilter => :void,
482
+ :SDL_GetEventFilter => :int,
483
+ :SDL_AddEventWatch => :void,
484
+ :SDL_DelEventWatch => :void,
485
+ :SDL_FilterEvents => :void,
486
+ :SDL_EventState => :uchar,
487
+ :SDL_RegisterEvents => :uint,
488
+ }
489
+ symbols.each do |sym|
490
+ begin
491
+ attach_function sym, args[sym], retvals[sym]
492
+ rescue FFI::NotFoundError => error
493
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
494
+ end
495
+ end
496
+ end
497
+
498
+ end
499
+