sdl2-bindings 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +83 -79
  3. data/LICENSE.txt +1 -1
  4. data/README.md +49 -49
  5. data/lib/sdl2.rb +170 -170
  6. data/lib/sdl2_audio.rb +219 -201
  7. data/lib/sdl2_blendmode.rb +69 -69
  8. data/lib/sdl2_clipboard.rb +51 -51
  9. data/lib/sdl2_cpuinfo.rb +106 -106
  10. data/lib/sdl2_error.rb +64 -64
  11. data/lib/sdl2_events.rb +530 -530
  12. data/lib/sdl2_filesystem.rb +48 -48
  13. data/lib/sdl2_framerate.rb +67 -67
  14. data/lib/sdl2_gamecontroller.rb +254 -254
  15. data/lib/sdl2_gesture.rb +55 -55
  16. data/lib/sdl2_gfxPrimitives.rb +222 -222
  17. data/lib/sdl2_haptic.rb +269 -269
  18. data/lib/sdl2_hints.rb +174 -174
  19. data/lib/sdl2_image.rb +185 -185
  20. data/lib/sdl2_imageFilter.rb +132 -132
  21. data/lib/sdl2_joystick.rb +230 -230
  22. data/lib/sdl2_keyboard.rb +99 -99
  23. data/lib/sdl2_keycode.rb +304 -304
  24. data/lib/sdl2_log.rb +115 -115
  25. data/lib/sdl2_main.rb +67 -67
  26. data/lib/sdl2_messagebox.rb +98 -98
  27. data/lib/sdl2_mixer.rb +317 -307
  28. data/lib/sdl2_mouse.rb +117 -117
  29. data/lib/sdl2_pixels.rb +224 -224
  30. data/lib/sdl2_platform.rb +45 -45
  31. data/lib/sdl2_power.rb +51 -51
  32. data/lib/sdl2_rect.rb +102 -102
  33. data/lib/sdl2_render.rb +290 -290
  34. data/lib/sdl2_rotozoom.rb +66 -66
  35. data/lib/sdl2_rwops.rb +208 -208
  36. data/lib/sdl2_scancode.rb +287 -287
  37. data/lib/sdl2_shape.rb +77 -77
  38. data/lib/sdl2_stdinc.rb +393 -393
  39. data/lib/sdl2_surface.rb +182 -182
  40. data/lib/sdl2_syswm.rb +154 -154
  41. data/lib/sdl2_timer.rb +62 -62
  42. data/lib/sdl2_touch.rb +73 -73
  43. data/lib/sdl2_ttf.rb +202 -190
  44. data/lib/sdl2_version.rb +62 -62
  45. data/lib/sdl2_video.rb +411 -411
  46. data/lib/sdl2_vulkan.rb +64 -64
  47. metadata +6 -6
data/lib/sdl2_shape.rb CHANGED
@@ -1,77 +1,77 @@
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_pixels'
9
-
10
- module SDL2
11
- extend FFI::Library
12
- # Define/Macro
13
-
14
- SDL_NONSHAPEABLE_WINDOW = -1
15
- SDL_INVALID_SHAPE_ARGUMENT = -2
16
- SDL_WINDOW_LACKS_SHAPE = -3
17
-
18
- # Enum
19
-
20
- ShapeModeDefault = 0
21
- ShapeModeBinarizeAlpha = 1
22
- ShapeModeReverseBinarizeAlpha = 2
23
- ShapeModeColorKey = 3
24
-
25
- # Typedef
26
-
27
- typedef :int, :WindowShapeMode
28
-
29
- # Struct
30
-
31
- class SDL_WindowShapeParams < FFI::Union
32
- layout(
33
- :binarizationCutoff, :uchar,
34
- :colorKey, SDL_Color,
35
- )
36
- end
37
-
38
- class SDL_WindowShapeMode < FFI::Struct
39
- layout(
40
- :mode, :int,
41
- :parameters, SDL_WindowShapeParams,
42
- )
43
- end
44
-
45
-
46
- # Function
47
-
48
- def self.setup_shape_symbols()
49
- symbols = [
50
- :SDL_CreateShapedWindow,
51
- :SDL_IsShapedWindow,
52
- :SDL_SetWindowShape,
53
- :SDL_GetShapedWindowMode,
54
- ]
55
- args = {
56
- :SDL_CreateShapedWindow => [:pointer, :uint, :uint, :uint, :uint, :uint],
57
- :SDL_IsShapedWindow => [:pointer],
58
- :SDL_SetWindowShape => [:pointer, :pointer, :pointer],
59
- :SDL_GetShapedWindowMode => [:pointer, :pointer],
60
- }
61
- retvals = {
62
- :SDL_CreateShapedWindow => :pointer,
63
- :SDL_IsShapedWindow => :int,
64
- :SDL_SetWindowShape => :int,
65
- :SDL_GetShapedWindowMode => :int,
66
- }
67
- symbols.each do |sym|
68
- begin
69
- attach_function sym, args[sym], retvals[sym]
70
- rescue FFI::NotFoundError => error
71
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
72
- end
73
- end
74
- end
75
-
76
- end
77
-
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_pixels'
9
+
10
+ module SDL2
11
+ extend FFI::Library
12
+ # Define/Macro
13
+
14
+ SDL_NONSHAPEABLE_WINDOW = -1
15
+ SDL_INVALID_SHAPE_ARGUMENT = -2
16
+ SDL_WINDOW_LACKS_SHAPE = -3
17
+
18
+ # Enum
19
+
20
+ ShapeModeDefault = 0
21
+ ShapeModeBinarizeAlpha = 1
22
+ ShapeModeReverseBinarizeAlpha = 2
23
+ ShapeModeColorKey = 3
24
+
25
+ # Typedef
26
+
27
+ typedef :int, :WindowShapeMode
28
+
29
+ # Struct
30
+
31
+ class SDL_WindowShapeParams < FFI::Union
32
+ layout(
33
+ :binarizationCutoff, :uchar,
34
+ :colorKey, SDL_Color,
35
+ )
36
+ end
37
+
38
+ class SDL_WindowShapeMode < FFI::Struct
39
+ layout(
40
+ :mode, :int,
41
+ :parameters, SDL_WindowShapeParams,
42
+ )
43
+ end
44
+
45
+
46
+ # Function
47
+
48
+ def self.setup_shape_symbols()
49
+ symbols = [
50
+ :SDL_CreateShapedWindow,
51
+ :SDL_IsShapedWindow,
52
+ :SDL_SetWindowShape,
53
+ :SDL_GetShapedWindowMode,
54
+ ]
55
+ args = {
56
+ :SDL_CreateShapedWindow => [:pointer, :uint, :uint, :uint, :uint, :uint],
57
+ :SDL_IsShapedWindow => [:pointer],
58
+ :SDL_SetWindowShape => [:pointer, :pointer, :pointer],
59
+ :SDL_GetShapedWindowMode => [:pointer, :pointer],
60
+ }
61
+ retvals = {
62
+ :SDL_CreateShapedWindow => :pointer,
63
+ :SDL_IsShapedWindow => :int,
64
+ :SDL_SetWindowShape => :int,
65
+ :SDL_GetShapedWindowMode => :int,
66
+ }
67
+ symbols.each do |sym|
68
+ begin
69
+ attach_function sym, args[sym], retvals[sym]
70
+ rescue FFI::NotFoundError => error
71
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
72
+ end
73
+ end
74
+ end
75
+
76
+ end
77
+
data/lib/sdl2_stdinc.rb CHANGED
@@ -1,393 +1,393 @@
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_FALSE = 0
17
- SDL_TRUE = 1
18
-
19
- # Typedef
20
-
21
- typedef :char, :int8_t
22
- typedef :short, :int16_t
23
- typedef :int, :int32_t
24
- typedef :long_long, :int64_t
25
- typedef :uchar, :uint8_t
26
- typedef :ushort, :uint16_t
27
- typedef :uint, :uint32_t
28
- typedef :ulong_long, :uint64_t
29
- typedef :int, :SDL_bool
30
- typedef :char, :Sint8
31
- typedef :uchar, :Uint8
32
- typedef :short, :Sint16
33
- typedef :ushort, :Uint16
34
- typedef :int, :Sint32
35
- typedef :uint, :Uint32
36
- typedef :long_long, :Sint64
37
- typedef :ulong_long, :Uint64
38
- callback :SDL_malloc_func, [:ulong], :pointer
39
- callback :SDL_calloc_func, [:ulong, :ulong], :pointer
40
- callback :SDL_realloc_func, [:pointer, :ulong], :pointer
41
- callback :SDL_free_func, [:pointer], :void
42
- typedef :pointer, :SDL_iconv_t
43
-
44
- # Struct
45
-
46
-
47
- # Function
48
-
49
- def self.setup_stdinc_symbols()
50
- symbols = [
51
- :SDL_malloc,
52
- :SDL_calloc,
53
- :SDL_realloc,
54
- :SDL_free,
55
- :SDL_GetMemoryFunctions,
56
- :SDL_SetMemoryFunctions,
57
- :SDL_GetNumAllocations,
58
- :SDL_getenv,
59
- :SDL_setenv,
60
- :SDL_qsort,
61
- :SDL_abs,
62
- :SDL_isdigit,
63
- :SDL_isspace,
64
- :SDL_isupper,
65
- :SDL_islower,
66
- :SDL_toupper,
67
- :SDL_tolower,
68
- :SDL_crc32,
69
- :SDL_memset,
70
- :SDL_memset4,
71
- :SDL_memcpy,
72
- :SDL_memmove,
73
- :SDL_memcmp,
74
- :SDL_wcslen,
75
- :SDL_wcslcpy,
76
- :SDL_wcslcat,
77
- :SDL_wcsdup,
78
- :SDL_wcsstr,
79
- :SDL_wcscmp,
80
- :SDL_wcsncmp,
81
- :SDL_wcscasecmp,
82
- :SDL_wcsncasecmp,
83
- :SDL_strlen,
84
- :SDL_strlcpy,
85
- :SDL_utf8strlcpy,
86
- :SDL_strlcat,
87
- :SDL_strdup,
88
- :SDL_strrev,
89
- :SDL_strupr,
90
- :SDL_strlwr,
91
- :SDL_strchr,
92
- :SDL_strrchr,
93
- :SDL_strstr,
94
- :SDL_strtokr,
95
- :SDL_utf8strlen,
96
- :SDL_itoa,
97
- :SDL_uitoa,
98
- :SDL_ltoa,
99
- :SDL_ultoa,
100
- :SDL_lltoa,
101
- :SDL_ulltoa,
102
- :SDL_atoi,
103
- :SDL_atof,
104
- :SDL_strtol,
105
- :SDL_strtoul,
106
- :SDL_strtoll,
107
- :SDL_strtoull,
108
- :SDL_strtod,
109
- :SDL_strcmp,
110
- :SDL_strncmp,
111
- :SDL_strcasecmp,
112
- :SDL_strncasecmp,
113
- :SDL_sscanf,
114
- :SDL_vsscanf,
115
- :SDL_snprintf,
116
- :SDL_vsnprintf,
117
- :SDL_acos,
118
- :SDL_acosf,
119
- :SDL_asin,
120
- :SDL_asinf,
121
- :SDL_atan,
122
- :SDL_atanf,
123
- :SDL_atan2,
124
- :SDL_atan2f,
125
- :SDL_ceil,
126
- :SDL_ceilf,
127
- :SDL_copysign,
128
- :SDL_copysignf,
129
- :SDL_cos,
130
- :SDL_cosf,
131
- :SDL_exp,
132
- :SDL_expf,
133
- :SDL_fabs,
134
- :SDL_fabsf,
135
- :SDL_floor,
136
- :SDL_floorf,
137
- :SDL_trunc,
138
- :SDL_truncf,
139
- :SDL_fmod,
140
- :SDL_fmodf,
141
- :SDL_log,
142
- :SDL_logf,
143
- :SDL_log10,
144
- :SDL_log10f,
145
- :SDL_pow,
146
- :SDL_powf,
147
- :SDL_scalbn,
148
- :SDL_scalbnf,
149
- :SDL_sin,
150
- :SDL_sinf,
151
- :SDL_sqrt,
152
- :SDL_sqrtf,
153
- :SDL_tan,
154
- :SDL_tanf,
155
- :SDL_iconv_open,
156
- :SDL_iconv_close,
157
- :SDL_iconv,
158
- :SDL_iconv_string,
159
- :SDL_memcpy4,
160
- ]
161
- args = {
162
- :SDL_malloc => [:ulong],
163
- :SDL_calloc => [:ulong, :ulong],
164
- :SDL_realloc => [:pointer, :ulong],
165
- :SDL_free => [:pointer],
166
- :SDL_GetMemoryFunctions => [:pointer, :pointer, :pointer, :pointer],
167
- :SDL_SetMemoryFunctions => [:SDL_malloc_func, :SDL_calloc_func, :SDL_realloc_func, :SDL_free_func],
168
- :SDL_GetNumAllocations => [],
169
- :SDL_getenv => [:pointer],
170
- :SDL_setenv => [:pointer, :pointer, :int],
171
- :SDL_qsort => [:pointer, :ulong, :ulong, :pointer],
172
- :SDL_abs => [:int],
173
- :SDL_isdigit => [:int],
174
- :SDL_isspace => [:int],
175
- :SDL_isupper => [:int],
176
- :SDL_islower => [:int],
177
- :SDL_toupper => [:int],
178
- :SDL_tolower => [:int],
179
- :SDL_crc32 => [:uint, :pointer, :ulong],
180
- :SDL_memset => [:pointer, :int, :ulong],
181
- :SDL_memset4 => [:pointer, :uint, :ulong],
182
- :SDL_memcpy => [:pointer, :pointer, :ulong],
183
- :SDL_memmove => [:pointer, :pointer, :ulong],
184
- :SDL_memcmp => [:pointer, :pointer, :ulong],
185
- :SDL_wcslen => [:pointer],
186
- :SDL_wcslcpy => [:pointer, :pointer, :ulong],
187
- :SDL_wcslcat => [:pointer, :pointer, :ulong],
188
- :SDL_wcsdup => [:pointer],
189
- :SDL_wcsstr => [:pointer, :pointer],
190
- :SDL_wcscmp => [:pointer, :pointer],
191
- :SDL_wcsncmp => [:pointer, :pointer, :ulong],
192
- :SDL_wcscasecmp => [:pointer, :pointer],
193
- :SDL_wcsncasecmp => [:pointer, :pointer, :ulong],
194
- :SDL_strlen => [:pointer],
195
- :SDL_strlcpy => [:pointer, :pointer, :ulong],
196
- :SDL_utf8strlcpy => [:pointer, :pointer, :ulong],
197
- :SDL_strlcat => [:pointer, :pointer, :ulong],
198
- :SDL_strdup => [:pointer],
199
- :SDL_strrev => [:pointer],
200
- :SDL_strupr => [:pointer],
201
- :SDL_strlwr => [:pointer],
202
- :SDL_strchr => [:pointer, :int],
203
- :SDL_strrchr => [:pointer, :int],
204
- :SDL_strstr => [:pointer, :pointer],
205
- :SDL_strtokr => [:pointer, :pointer, :pointer],
206
- :SDL_utf8strlen => [:pointer],
207
- :SDL_itoa => [:int, :pointer, :int],
208
- :SDL_uitoa => [:uint, :pointer, :int],
209
- :SDL_ltoa => [:long, :pointer, :int],
210
- :SDL_ultoa => [:ulong, :pointer, :int],
211
- :SDL_lltoa => [:long_long, :pointer, :int],
212
- :SDL_ulltoa => [:ulong_long, :pointer, :int],
213
- :SDL_atoi => [:pointer],
214
- :SDL_atof => [:pointer],
215
- :SDL_strtol => [:pointer, :pointer, :int],
216
- :SDL_strtoul => [:pointer, :pointer, :int],
217
- :SDL_strtoll => [:pointer, :pointer, :int],
218
- :SDL_strtoull => [:pointer, :pointer, :int],
219
- :SDL_strtod => [:pointer, :pointer],
220
- :SDL_strcmp => [:pointer, :pointer],
221
- :SDL_strncmp => [:pointer, :pointer, :ulong],
222
- :SDL_strcasecmp => [:pointer, :pointer],
223
- :SDL_strncasecmp => [:pointer, :pointer, :ulong],
224
- :SDL_sscanf => [:pointer, :pointer],
225
- :SDL_vsscanf => [:pointer, :pointer, :pointer],
226
- :SDL_snprintf => [:pointer, :ulong, :pointer],
227
- :SDL_vsnprintf => [:pointer, :ulong, :pointer, :pointer],
228
- :SDL_acos => [:double],
229
- :SDL_acosf => [:float],
230
- :SDL_asin => [:double],
231
- :SDL_asinf => [:float],
232
- :SDL_atan => [:double],
233
- :SDL_atanf => [:float],
234
- :SDL_atan2 => [:double, :double],
235
- :SDL_atan2f => [:float, :float],
236
- :SDL_ceil => [:double],
237
- :SDL_ceilf => [:float],
238
- :SDL_copysign => [:double, :double],
239
- :SDL_copysignf => [:float, :float],
240
- :SDL_cos => [:double],
241
- :SDL_cosf => [:float],
242
- :SDL_exp => [:double],
243
- :SDL_expf => [:float],
244
- :SDL_fabs => [:double],
245
- :SDL_fabsf => [:float],
246
- :SDL_floor => [:double],
247
- :SDL_floorf => [:float],
248
- :SDL_trunc => [:double],
249
- :SDL_truncf => [:float],
250
- :SDL_fmod => [:double, :double],
251
- :SDL_fmodf => [:float, :float],
252
- :SDL_log => [:double],
253
- :SDL_logf => [:float],
254
- :SDL_log10 => [:double],
255
- :SDL_log10f => [:float],
256
- :SDL_pow => [:double, :double],
257
- :SDL_powf => [:float, :float],
258
- :SDL_scalbn => [:double, :int],
259
- :SDL_scalbnf => [:float, :int],
260
- :SDL_sin => [:double],
261
- :SDL_sinf => [:float],
262
- :SDL_sqrt => [:double],
263
- :SDL_sqrtf => [:float],
264
- :SDL_tan => [:double],
265
- :SDL_tanf => [:float],
266
- :SDL_iconv_open => [:pointer, :pointer],
267
- :SDL_iconv_close => [:pointer],
268
- :SDL_iconv => [:pointer, :pointer, :pointer, :pointer, :pointer],
269
- :SDL_iconv_string => [:pointer, :pointer, :pointer, :ulong],
270
- :SDL_memcpy4 => [:pointer, :pointer, :ulong],
271
- }
272
- retvals = {
273
- :SDL_malloc => :pointer,
274
- :SDL_calloc => :pointer,
275
- :SDL_realloc => :pointer,
276
- :SDL_free => :void,
277
- :SDL_GetMemoryFunctions => :void,
278
- :SDL_SetMemoryFunctions => :int,
279
- :SDL_GetNumAllocations => :int,
280
- :SDL_getenv => :pointer,
281
- :SDL_setenv => :int,
282
- :SDL_qsort => :void,
283
- :SDL_abs => :int,
284
- :SDL_isdigit => :int,
285
- :SDL_isspace => :int,
286
- :SDL_isupper => :int,
287
- :SDL_islower => :int,
288
- :SDL_toupper => :int,
289
- :SDL_tolower => :int,
290
- :SDL_crc32 => :uint,
291
- :SDL_memset => :pointer,
292
- :SDL_memset4 => :void,
293
- :SDL_memcpy => :pointer,
294
- :SDL_memmove => :pointer,
295
- :SDL_memcmp => :int,
296
- :SDL_wcslen => :size_t,
297
- :SDL_wcslcpy => :size_t,
298
- :SDL_wcslcat => :size_t,
299
- :SDL_wcsdup => :pointer,
300
- :SDL_wcsstr => :pointer,
301
- :SDL_wcscmp => :int,
302
- :SDL_wcsncmp => :int,
303
- :SDL_wcscasecmp => :int,
304
- :SDL_wcsncasecmp => :int,
305
- :SDL_strlen => :size_t,
306
- :SDL_strlcpy => :size_t,
307
- :SDL_utf8strlcpy => :size_t,
308
- :SDL_strlcat => :size_t,
309
- :SDL_strdup => :pointer,
310
- :SDL_strrev => :pointer,
311
- :SDL_strupr => :pointer,
312
- :SDL_strlwr => :pointer,
313
- :SDL_strchr => :pointer,
314
- :SDL_strrchr => :pointer,
315
- :SDL_strstr => :pointer,
316
- :SDL_strtokr => :pointer,
317
- :SDL_utf8strlen => :size_t,
318
- :SDL_itoa => :pointer,
319
- :SDL_uitoa => :pointer,
320
- :SDL_ltoa => :pointer,
321
- :SDL_ultoa => :pointer,
322
- :SDL_lltoa => :pointer,
323
- :SDL_ulltoa => :pointer,
324
- :SDL_atoi => :int,
325
- :SDL_atof => :double,
326
- :SDL_strtol => :long,
327
- :SDL_strtoul => :ulong,
328
- :SDL_strtoll => :long_long,
329
- :SDL_strtoull => :ulong_long,
330
- :SDL_strtod => :double,
331
- :SDL_strcmp => :int,
332
- :SDL_strncmp => :int,
333
- :SDL_strcasecmp => :int,
334
- :SDL_strncasecmp => :int,
335
- :SDL_sscanf => :int,
336
- :SDL_vsscanf => :int,
337
- :SDL_snprintf => :int,
338
- :SDL_vsnprintf => :int,
339
- :SDL_acos => :double,
340
- :SDL_acosf => :float,
341
- :SDL_asin => :double,
342
- :SDL_asinf => :float,
343
- :SDL_atan => :double,
344
- :SDL_atanf => :float,
345
- :SDL_atan2 => :double,
346
- :SDL_atan2f => :float,
347
- :SDL_ceil => :double,
348
- :SDL_ceilf => :float,
349
- :SDL_copysign => :double,
350
- :SDL_copysignf => :float,
351
- :SDL_cos => :double,
352
- :SDL_cosf => :float,
353
- :SDL_exp => :double,
354
- :SDL_expf => :float,
355
- :SDL_fabs => :double,
356
- :SDL_fabsf => :float,
357
- :SDL_floor => :double,
358
- :SDL_floorf => :float,
359
- :SDL_trunc => :double,
360
- :SDL_truncf => :float,
361
- :SDL_fmod => :double,
362
- :SDL_fmodf => :float,
363
- :SDL_log => :double,
364
- :SDL_logf => :float,
365
- :SDL_log10 => :double,
366
- :SDL_log10f => :float,
367
- :SDL_pow => :double,
368
- :SDL_powf => :float,
369
- :SDL_scalbn => :double,
370
- :SDL_scalbnf => :float,
371
- :SDL_sin => :double,
372
- :SDL_sinf => :float,
373
- :SDL_sqrt => :double,
374
- :SDL_sqrtf => :float,
375
- :SDL_tan => :double,
376
- :SDL_tanf => :float,
377
- :SDL_iconv_open => :pointer,
378
- :SDL_iconv_close => :int,
379
- :SDL_iconv => :size_t,
380
- :SDL_iconv_string => :pointer,
381
- :SDL_memcpy4 => :pointer,
382
- }
383
- symbols.each do |sym|
384
- begin
385
- attach_function sym, args[sym], retvals[sym]
386
- rescue FFI::NotFoundError => error
387
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
388
- end
389
- end
390
- end
391
-
392
- end
393
-
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_FALSE = 0
17
+ SDL_TRUE = 1
18
+
19
+ # Typedef
20
+
21
+ typedef :char, :int8_t
22
+ typedef :short, :int16_t
23
+ typedef :int, :int32_t
24
+ typedef :long_long, :int64_t
25
+ typedef :uchar, :uint8_t
26
+ typedef :ushort, :uint16_t
27
+ typedef :uint, :uint32_t
28
+ typedef :ulong_long, :uint64_t
29
+ typedef :int, :SDL_bool
30
+ typedef :char, :Sint8
31
+ typedef :uchar, :Uint8
32
+ typedef :short, :Sint16
33
+ typedef :ushort, :Uint16
34
+ typedef :int, :Sint32
35
+ typedef :uint, :Uint32
36
+ typedef :long_long, :Sint64
37
+ typedef :ulong_long, :Uint64
38
+ callback :SDL_malloc_func, [:ulong], :pointer
39
+ callback :SDL_calloc_func, [:ulong, :ulong], :pointer
40
+ callback :SDL_realloc_func, [:pointer, :ulong], :pointer
41
+ callback :SDL_free_func, [:pointer], :void
42
+ typedef :pointer, :SDL_iconv_t
43
+
44
+ # Struct
45
+
46
+
47
+ # Function
48
+
49
+ def self.setup_stdinc_symbols()
50
+ symbols = [
51
+ :SDL_malloc,
52
+ :SDL_calloc,
53
+ :SDL_realloc,
54
+ :SDL_free,
55
+ :SDL_GetMemoryFunctions,
56
+ :SDL_SetMemoryFunctions,
57
+ :SDL_GetNumAllocations,
58
+ :SDL_getenv,
59
+ :SDL_setenv,
60
+ :SDL_qsort,
61
+ :SDL_abs,
62
+ :SDL_isdigit,
63
+ :SDL_isspace,
64
+ :SDL_isupper,
65
+ :SDL_islower,
66
+ :SDL_toupper,
67
+ :SDL_tolower,
68
+ :SDL_crc32,
69
+ :SDL_memset,
70
+ :SDL_memset4,
71
+ :SDL_memcpy,
72
+ :SDL_memmove,
73
+ :SDL_memcmp,
74
+ :SDL_wcslen,
75
+ :SDL_wcslcpy,
76
+ :SDL_wcslcat,
77
+ :SDL_wcsdup,
78
+ :SDL_wcsstr,
79
+ :SDL_wcscmp,
80
+ :SDL_wcsncmp,
81
+ :SDL_wcscasecmp,
82
+ :SDL_wcsncasecmp,
83
+ :SDL_strlen,
84
+ :SDL_strlcpy,
85
+ :SDL_utf8strlcpy,
86
+ :SDL_strlcat,
87
+ :SDL_strdup,
88
+ :SDL_strrev,
89
+ :SDL_strupr,
90
+ :SDL_strlwr,
91
+ :SDL_strchr,
92
+ :SDL_strrchr,
93
+ :SDL_strstr,
94
+ :SDL_strtokr,
95
+ :SDL_utf8strlen,
96
+ :SDL_itoa,
97
+ :SDL_uitoa,
98
+ :SDL_ltoa,
99
+ :SDL_ultoa,
100
+ :SDL_lltoa,
101
+ :SDL_ulltoa,
102
+ :SDL_atoi,
103
+ :SDL_atof,
104
+ :SDL_strtol,
105
+ :SDL_strtoul,
106
+ :SDL_strtoll,
107
+ :SDL_strtoull,
108
+ :SDL_strtod,
109
+ :SDL_strcmp,
110
+ :SDL_strncmp,
111
+ :SDL_strcasecmp,
112
+ :SDL_strncasecmp,
113
+ :SDL_sscanf,
114
+ :SDL_vsscanf,
115
+ :SDL_snprintf,
116
+ :SDL_vsnprintf,
117
+ :SDL_acos,
118
+ :SDL_acosf,
119
+ :SDL_asin,
120
+ :SDL_asinf,
121
+ :SDL_atan,
122
+ :SDL_atanf,
123
+ :SDL_atan2,
124
+ :SDL_atan2f,
125
+ :SDL_ceil,
126
+ :SDL_ceilf,
127
+ :SDL_copysign,
128
+ :SDL_copysignf,
129
+ :SDL_cos,
130
+ :SDL_cosf,
131
+ :SDL_exp,
132
+ :SDL_expf,
133
+ :SDL_fabs,
134
+ :SDL_fabsf,
135
+ :SDL_floor,
136
+ :SDL_floorf,
137
+ :SDL_trunc,
138
+ :SDL_truncf,
139
+ :SDL_fmod,
140
+ :SDL_fmodf,
141
+ :SDL_log,
142
+ :SDL_logf,
143
+ :SDL_log10,
144
+ :SDL_log10f,
145
+ :SDL_pow,
146
+ :SDL_powf,
147
+ :SDL_scalbn,
148
+ :SDL_scalbnf,
149
+ :SDL_sin,
150
+ :SDL_sinf,
151
+ :SDL_sqrt,
152
+ :SDL_sqrtf,
153
+ :SDL_tan,
154
+ :SDL_tanf,
155
+ :SDL_iconv_open,
156
+ :SDL_iconv_close,
157
+ :SDL_iconv,
158
+ :SDL_iconv_string,
159
+ :SDL_memcpy4,
160
+ ]
161
+ args = {
162
+ :SDL_malloc => [:ulong],
163
+ :SDL_calloc => [:ulong, :ulong],
164
+ :SDL_realloc => [:pointer, :ulong],
165
+ :SDL_free => [:pointer],
166
+ :SDL_GetMemoryFunctions => [:pointer, :pointer, :pointer, :pointer],
167
+ :SDL_SetMemoryFunctions => [:SDL_malloc_func, :SDL_calloc_func, :SDL_realloc_func, :SDL_free_func],
168
+ :SDL_GetNumAllocations => [],
169
+ :SDL_getenv => [:pointer],
170
+ :SDL_setenv => [:pointer, :pointer, :int],
171
+ :SDL_qsort => [:pointer, :ulong, :ulong, :pointer],
172
+ :SDL_abs => [:int],
173
+ :SDL_isdigit => [:int],
174
+ :SDL_isspace => [:int],
175
+ :SDL_isupper => [:int],
176
+ :SDL_islower => [:int],
177
+ :SDL_toupper => [:int],
178
+ :SDL_tolower => [:int],
179
+ :SDL_crc32 => [:uint, :pointer, :ulong],
180
+ :SDL_memset => [:pointer, :int, :ulong],
181
+ :SDL_memset4 => [:pointer, :uint, :ulong],
182
+ :SDL_memcpy => [:pointer, :pointer, :ulong],
183
+ :SDL_memmove => [:pointer, :pointer, :ulong],
184
+ :SDL_memcmp => [:pointer, :pointer, :ulong],
185
+ :SDL_wcslen => [:pointer],
186
+ :SDL_wcslcpy => [:pointer, :pointer, :ulong],
187
+ :SDL_wcslcat => [:pointer, :pointer, :ulong],
188
+ :SDL_wcsdup => [:pointer],
189
+ :SDL_wcsstr => [:pointer, :pointer],
190
+ :SDL_wcscmp => [:pointer, :pointer],
191
+ :SDL_wcsncmp => [:pointer, :pointer, :ulong],
192
+ :SDL_wcscasecmp => [:pointer, :pointer],
193
+ :SDL_wcsncasecmp => [:pointer, :pointer, :ulong],
194
+ :SDL_strlen => [:pointer],
195
+ :SDL_strlcpy => [:pointer, :pointer, :ulong],
196
+ :SDL_utf8strlcpy => [:pointer, :pointer, :ulong],
197
+ :SDL_strlcat => [:pointer, :pointer, :ulong],
198
+ :SDL_strdup => [:pointer],
199
+ :SDL_strrev => [:pointer],
200
+ :SDL_strupr => [:pointer],
201
+ :SDL_strlwr => [:pointer],
202
+ :SDL_strchr => [:pointer, :int],
203
+ :SDL_strrchr => [:pointer, :int],
204
+ :SDL_strstr => [:pointer, :pointer],
205
+ :SDL_strtokr => [:pointer, :pointer, :pointer],
206
+ :SDL_utf8strlen => [:pointer],
207
+ :SDL_itoa => [:int, :pointer, :int],
208
+ :SDL_uitoa => [:uint, :pointer, :int],
209
+ :SDL_ltoa => [:long, :pointer, :int],
210
+ :SDL_ultoa => [:ulong, :pointer, :int],
211
+ :SDL_lltoa => [:long_long, :pointer, :int],
212
+ :SDL_ulltoa => [:ulong_long, :pointer, :int],
213
+ :SDL_atoi => [:pointer],
214
+ :SDL_atof => [:pointer],
215
+ :SDL_strtol => [:pointer, :pointer, :int],
216
+ :SDL_strtoul => [:pointer, :pointer, :int],
217
+ :SDL_strtoll => [:pointer, :pointer, :int],
218
+ :SDL_strtoull => [:pointer, :pointer, :int],
219
+ :SDL_strtod => [:pointer, :pointer],
220
+ :SDL_strcmp => [:pointer, :pointer],
221
+ :SDL_strncmp => [:pointer, :pointer, :ulong],
222
+ :SDL_strcasecmp => [:pointer, :pointer],
223
+ :SDL_strncasecmp => [:pointer, :pointer, :ulong],
224
+ :SDL_sscanf => [:pointer, :pointer],
225
+ :SDL_vsscanf => [:pointer, :pointer, :pointer],
226
+ :SDL_snprintf => [:pointer, :ulong, :pointer],
227
+ :SDL_vsnprintf => [:pointer, :ulong, :pointer, :pointer],
228
+ :SDL_acos => [:double],
229
+ :SDL_acosf => [:float],
230
+ :SDL_asin => [:double],
231
+ :SDL_asinf => [:float],
232
+ :SDL_atan => [:double],
233
+ :SDL_atanf => [:float],
234
+ :SDL_atan2 => [:double, :double],
235
+ :SDL_atan2f => [:float, :float],
236
+ :SDL_ceil => [:double],
237
+ :SDL_ceilf => [:float],
238
+ :SDL_copysign => [:double, :double],
239
+ :SDL_copysignf => [:float, :float],
240
+ :SDL_cos => [:double],
241
+ :SDL_cosf => [:float],
242
+ :SDL_exp => [:double],
243
+ :SDL_expf => [:float],
244
+ :SDL_fabs => [:double],
245
+ :SDL_fabsf => [:float],
246
+ :SDL_floor => [:double],
247
+ :SDL_floorf => [:float],
248
+ :SDL_trunc => [:double],
249
+ :SDL_truncf => [:float],
250
+ :SDL_fmod => [:double, :double],
251
+ :SDL_fmodf => [:float, :float],
252
+ :SDL_log => [:double],
253
+ :SDL_logf => [:float],
254
+ :SDL_log10 => [:double],
255
+ :SDL_log10f => [:float],
256
+ :SDL_pow => [:double, :double],
257
+ :SDL_powf => [:float, :float],
258
+ :SDL_scalbn => [:double, :int],
259
+ :SDL_scalbnf => [:float, :int],
260
+ :SDL_sin => [:double],
261
+ :SDL_sinf => [:float],
262
+ :SDL_sqrt => [:double],
263
+ :SDL_sqrtf => [:float],
264
+ :SDL_tan => [:double],
265
+ :SDL_tanf => [:float],
266
+ :SDL_iconv_open => [:pointer, :pointer],
267
+ :SDL_iconv_close => [:pointer],
268
+ :SDL_iconv => [:pointer, :pointer, :pointer, :pointer, :pointer],
269
+ :SDL_iconv_string => [:pointer, :pointer, :pointer, :ulong],
270
+ :SDL_memcpy4 => [:pointer, :pointer, :ulong],
271
+ }
272
+ retvals = {
273
+ :SDL_malloc => :pointer,
274
+ :SDL_calloc => :pointer,
275
+ :SDL_realloc => :pointer,
276
+ :SDL_free => :void,
277
+ :SDL_GetMemoryFunctions => :void,
278
+ :SDL_SetMemoryFunctions => :int,
279
+ :SDL_GetNumAllocations => :int,
280
+ :SDL_getenv => :pointer,
281
+ :SDL_setenv => :int,
282
+ :SDL_qsort => :void,
283
+ :SDL_abs => :int,
284
+ :SDL_isdigit => :int,
285
+ :SDL_isspace => :int,
286
+ :SDL_isupper => :int,
287
+ :SDL_islower => :int,
288
+ :SDL_toupper => :int,
289
+ :SDL_tolower => :int,
290
+ :SDL_crc32 => :uint,
291
+ :SDL_memset => :pointer,
292
+ :SDL_memset4 => :void,
293
+ :SDL_memcpy => :pointer,
294
+ :SDL_memmove => :pointer,
295
+ :SDL_memcmp => :int,
296
+ :SDL_wcslen => :size_t,
297
+ :SDL_wcslcpy => :size_t,
298
+ :SDL_wcslcat => :size_t,
299
+ :SDL_wcsdup => :pointer,
300
+ :SDL_wcsstr => :pointer,
301
+ :SDL_wcscmp => :int,
302
+ :SDL_wcsncmp => :int,
303
+ :SDL_wcscasecmp => :int,
304
+ :SDL_wcsncasecmp => :int,
305
+ :SDL_strlen => :size_t,
306
+ :SDL_strlcpy => :size_t,
307
+ :SDL_utf8strlcpy => :size_t,
308
+ :SDL_strlcat => :size_t,
309
+ :SDL_strdup => :pointer,
310
+ :SDL_strrev => :pointer,
311
+ :SDL_strupr => :pointer,
312
+ :SDL_strlwr => :pointer,
313
+ :SDL_strchr => :pointer,
314
+ :SDL_strrchr => :pointer,
315
+ :SDL_strstr => :pointer,
316
+ :SDL_strtokr => :pointer,
317
+ :SDL_utf8strlen => :size_t,
318
+ :SDL_itoa => :pointer,
319
+ :SDL_uitoa => :pointer,
320
+ :SDL_ltoa => :pointer,
321
+ :SDL_ultoa => :pointer,
322
+ :SDL_lltoa => :pointer,
323
+ :SDL_ulltoa => :pointer,
324
+ :SDL_atoi => :int,
325
+ :SDL_atof => :double,
326
+ :SDL_strtol => :long,
327
+ :SDL_strtoul => :ulong,
328
+ :SDL_strtoll => :long_long,
329
+ :SDL_strtoull => :ulong_long,
330
+ :SDL_strtod => :double,
331
+ :SDL_strcmp => :int,
332
+ :SDL_strncmp => :int,
333
+ :SDL_strcasecmp => :int,
334
+ :SDL_strncasecmp => :int,
335
+ :SDL_sscanf => :int,
336
+ :SDL_vsscanf => :int,
337
+ :SDL_snprintf => :int,
338
+ :SDL_vsnprintf => :int,
339
+ :SDL_acos => :double,
340
+ :SDL_acosf => :float,
341
+ :SDL_asin => :double,
342
+ :SDL_asinf => :float,
343
+ :SDL_atan => :double,
344
+ :SDL_atanf => :float,
345
+ :SDL_atan2 => :double,
346
+ :SDL_atan2f => :float,
347
+ :SDL_ceil => :double,
348
+ :SDL_ceilf => :float,
349
+ :SDL_copysign => :double,
350
+ :SDL_copysignf => :float,
351
+ :SDL_cos => :double,
352
+ :SDL_cosf => :float,
353
+ :SDL_exp => :double,
354
+ :SDL_expf => :float,
355
+ :SDL_fabs => :double,
356
+ :SDL_fabsf => :float,
357
+ :SDL_floor => :double,
358
+ :SDL_floorf => :float,
359
+ :SDL_trunc => :double,
360
+ :SDL_truncf => :float,
361
+ :SDL_fmod => :double,
362
+ :SDL_fmodf => :float,
363
+ :SDL_log => :double,
364
+ :SDL_logf => :float,
365
+ :SDL_log10 => :double,
366
+ :SDL_log10f => :float,
367
+ :SDL_pow => :double,
368
+ :SDL_powf => :float,
369
+ :SDL_scalbn => :double,
370
+ :SDL_scalbnf => :float,
371
+ :SDL_sin => :double,
372
+ :SDL_sinf => :float,
373
+ :SDL_sqrt => :double,
374
+ :SDL_sqrtf => :float,
375
+ :SDL_tan => :double,
376
+ :SDL_tanf => :float,
377
+ :SDL_iconv_open => :pointer,
378
+ :SDL_iconv_close => :int,
379
+ :SDL_iconv => :size_t,
380
+ :SDL_iconv_string => :pointer,
381
+ :SDL_memcpy4 => :pointer,
382
+ }
383
+ symbols.each do |sym|
384
+ begin
385
+ attach_function sym, args[sym], retvals[sym]
386
+ rescue FFI::NotFoundError => error
387
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
388
+ end
389
+ end
390
+ end
391
+
392
+ end
393
+