sdl2-bindings 0.0.8 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +124 -92
  3. data/LICENSE.txt +1 -1
  4. data/README.md +77 -53
  5. data/lib/sdl2.rb +131 -172
  6. data/lib/sdl2_audio.rb +261 -222
  7. data/lib/sdl2_blendmode.rb +72 -69
  8. data/lib/sdl2_clipboard.rb +56 -51
  9. data/lib/sdl2_cpuinfo.rb +129 -106
  10. data/lib/sdl2_error.rb +71 -64
  11. data/lib/sdl2_events.rb +564 -533
  12. data/lib/sdl2_filesystem.rb +52 -48
  13. data/lib/sdl2_framerate.rb +74 -67
  14. data/lib/sdl2_gamecontroller.rb +329 -274
  15. data/lib/sdl2_gesture.rb +61 -55
  16. data/lib/sdl2_gfxPrimitives.rb +283 -222
  17. data/lib/sdl2_haptic.rb +301 -269
  18. data/lib/sdl2_hidapi.rb +139 -118
  19. data/lib/sdl2_hints.rb +221 -197
  20. data/lib/sdl2_image.rb +232 -185
  21. data/lib/sdl2_imageFilter.rb +164 -132
  22. data/lib/sdl2_joystick.rb +294 -239
  23. data/lib/sdl2_keyboard.rb +125 -99
  24. data/lib/sdl2_keycode.rb +307 -305
  25. data/lib/sdl2_log.rb +131 -115
  26. data/lib/sdl2_main.rb +74 -67
  27. data/lib/sdl2_messagebox.rb +102 -98
  28. data/lib/sdl2_misc.rb +48 -45
  29. data/lib/sdl2_mixer.rb +392 -317
  30. data/lib/sdl2_mouse.rb +136 -117
  31. data/lib/sdl2_pixels.rb +240 -224
  32. data/lib/sdl2_platform.rb +48 -45
  33. data/lib/sdl2_power.rb +54 -51
  34. data/lib/sdl2_rect.rb +145 -102
  35. data/lib/sdl2_render.rb +408 -322
  36. data/lib/sdl2_rotozoom.rb +76 -66
  37. data/lib/sdl2_rwops.rb +238 -208
  38. data/lib/sdl2_scancode.rb +289 -287
  39. data/lib/sdl2_sensor.rb +115 -97
  40. data/lib/sdl2_shape.rb +83 -77
  41. data/lib/sdl2_sound.rb +154 -0
  42. data/lib/sdl2_stdinc.rb +556 -439
  43. data/lib/sdl2_surface.rb +229 -188
  44. data/lib/sdl2_syswm.rb +160 -156
  45. data/lib/sdl2_timer.rb +74 -65
  46. data/lib/sdl2_touch.rb +86 -75
  47. data/lib/sdl2_ttf.rb +358 -202
  48. data/lib/sdl2_version.rb +67 -62
  49. data/lib/sdl2_video.rb +540 -446
  50. data/lib/sdl2_vulkan.rb +72 -64
  51. metadata +19 -4
data/lib/sdl2_rotozoom.rb CHANGED
@@ -1,66 +1,76 @@
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_gfx_rotozoom_symbols()
26
- symbols = [
27
- :rotozoomSurface,
28
- :rotozoomSurfaceXY,
29
- :rotozoomSurfaceSize,
30
- :rotozoomSurfaceSizeXY,
31
- :zoomSurface,
32
- :zoomSurfaceSize,
33
- :shrinkSurface,
34
- :rotateSurface90Degrees,
35
- ]
36
- args = {
37
- :rotozoomSurface => [:pointer, :double, :double, :int],
38
- :rotozoomSurfaceXY => [:pointer, :double, :double, :double, :int],
39
- :rotozoomSurfaceSize => [:int, :int, :double, :double, :pointer, :pointer],
40
- :rotozoomSurfaceSizeXY => [:int, :int, :double, :double, :double, :pointer, :pointer],
41
- :zoomSurface => [:pointer, :double, :double, :int],
42
- :zoomSurfaceSize => [:int, :int, :double, :double, :pointer, :pointer],
43
- :shrinkSurface => [:pointer, :int, :int],
44
- :rotateSurface90Degrees => [:pointer, :int],
45
- }
46
- retvals = {
47
- :rotozoomSurface => :pointer,
48
- :rotozoomSurfaceXY => :pointer,
49
- :rotozoomSurfaceSize => :void,
50
- :rotozoomSurfaceSizeXY => :void,
51
- :zoomSurface => :pointer,
52
- :zoomSurfaceSize => :void,
53
- :shrinkSurface => :pointer,
54
- :rotateSurface90Degrees => :pointer,
55
- }
56
- symbols.each do |sym|
57
- begin
58
- attach_function sym, args[sym], retvals[sym]
59
- rescue FFI::NotFoundError => error
60
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
61
- end
62
- end
63
- end
64
-
65
- end
66
-
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 SDL
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_gfx_rotozoom_symbols(output_error = false)
26
+ symbols = [
27
+ :rotozoomSurface,
28
+ :rotozoomSurfaceXY,
29
+ :rotozoomSurfaceSize,
30
+ :rotozoomSurfaceSizeXY,
31
+ :zoomSurface,
32
+ :zoomSurfaceSize,
33
+ :shrinkSurface,
34
+ :rotateSurface90Degrees,
35
+ ]
36
+ apis = {
37
+ :rotozoomSurface => :rotozoomSurface,
38
+ :rotozoomSurfaceXY => :rotozoomSurfaceXY,
39
+ :rotozoomSurfaceSize => :rotozoomSurfaceSize,
40
+ :rotozoomSurfaceSizeXY => :rotozoomSurfaceSizeXY,
41
+ :zoomSurface => :zoomSurface,
42
+ :zoomSurfaceSize => :zoomSurfaceSize,
43
+ :shrinkSurface => :shrinkSurface,
44
+ :rotateSurface90Degrees => :rotateSurface90Degrees,
45
+ }
46
+ args = {
47
+ :rotozoomSurface => [:pointer, :double, :double, :int],
48
+ :rotozoomSurfaceXY => [:pointer, :double, :double, :double, :int],
49
+ :rotozoomSurfaceSize => [:int, :int, :double, :double, :pointer, :pointer],
50
+ :rotozoomSurfaceSizeXY => [:int, :int, :double, :double, :double, :pointer, :pointer],
51
+ :zoomSurface => [:pointer, :double, :double, :int],
52
+ :zoomSurfaceSize => [:int, :int, :double, :double, :pointer, :pointer],
53
+ :shrinkSurface => [:pointer, :int, :int],
54
+ :rotateSurface90Degrees => [:pointer, :int],
55
+ }
56
+ retvals = {
57
+ :rotozoomSurface => :pointer,
58
+ :rotozoomSurfaceXY => :pointer,
59
+ :rotozoomSurfaceSize => :void,
60
+ :rotozoomSurfaceSizeXY => :void,
61
+ :zoomSurface => :pointer,
62
+ :zoomSurfaceSize => :void,
63
+ :shrinkSurface => :pointer,
64
+ :rotateSurface90Degrees => :pointer,
65
+ }
66
+ symbols.each do |sym|
67
+ begin
68
+ attach_function apis[sym], sym, args[sym], retvals[sym]
69
+ rescue FFI::NotFoundError => error
70
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
71
+ end
72
+ end
73
+ end
74
+
75
+ end
76
+
data/lib/sdl2_rwops.rb CHANGED
@@ -1,208 +1,238 @@
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_RWOPS_UNKNOWN = 0
14
- SDL_RWOPS_WINFILE = 1
15
- SDL_RWOPS_STDFILE = 2
16
- SDL_RWOPS_JNIFILE = 3
17
- SDL_RWOPS_MEMORY = 4
18
- SDL_RWOPS_MEMORY_RO = 5
19
-
20
- # Enum
21
-
22
-
23
- # Typedef
24
-
25
-
26
- class SDL_RWops_mem < FFI::Struct
27
- layout(
28
- :base, :pointer,
29
- :here, :pointer,
30
- :stop, :pointer,
31
- )
32
- end
33
-
34
- class SDL_RWops_unknown < FFI::Struct
35
- layout(
36
- :data1, :pointer,
37
- :data2, :pointer,
38
- )
39
- end
40
- class SDL_RWops_windowsio_buffer < FFI::Struct
41
- layout(
42
- :data, :pointer,
43
- :size, :size_t,
44
- :left, :size_t,
45
- )
46
- end
47
-
48
- class SDL_RWops_windowsio < FFI::Struct
49
- layout(
50
- :append, :int,
51
- :h, :pointer,
52
- :buffer, SDL_RWops_windowsio_buffer.by_value,
53
- )
54
- end
55
-
56
- class SDL_Default_RWops_hidden < FFI::Union
57
- layout(
58
- :mem, SDL_RWops_mem.by_value,
59
- :unknown, SDL_RWops_unknown.by_value,
60
- )
61
- end
62
-
63
- class SDL_Win32_RWops_hidden < FFI::Union
64
- layout(
65
- :mem, SDL_RWops_mem.by_value,
66
- :unknown, SDL_RWops_unknown.by_value,
67
- :windowsio, SDL_RWops_windowsio.by_value,
68
- )
69
- end
70
-
71
- class SDL_Default_RWops < FFI::Struct
72
- layout(
73
- :size, :pointer,
74
- :seek, :pointer,
75
- :read, :pointer,
76
- :write, :pointer,
77
- :close, :pointer,
78
- :type, :uint,
79
- :hidden, SDL_Default_RWops_hidden.by_value,
80
- )
81
- end
82
-
83
- class SDL_Win32_RWops < FFI::Struct
84
- layout(
85
- :size, :pointer,
86
- :seek, :pointer,
87
- :read, :pointer,
88
- :write, :pointer,
89
- :close, :pointer,
90
- :type, :uint,
91
- :hidden, SDL_Win32_RWops_hidden.by_value
92
- )
93
- end
94
-
95
- if RUBY_PLATFORM =~ /mswin|msys|mingw|cygwin/
96
- SDL_RWops = SDL_Win32_RWops
97
- else
98
- SDL_RWops = SDL_Default_RWops
99
- end
100
-
101
-
102
- # Struct
103
-
104
-
105
- # Function
106
-
107
- def self.setup_rwops_symbols()
108
- symbols = [
109
- :SDL_RWFromFile,
110
- :SDL_RWFromFP,
111
- :SDL_RWFromMem,
112
- :SDL_RWFromConstMem,
113
- :SDL_AllocRW,
114
- :SDL_FreeRW,
115
- :SDL_RWsize,
116
- :SDL_RWseek,
117
- :SDL_RWtell,
118
- :SDL_RWread,
119
- :SDL_RWwrite,
120
- :SDL_RWclose,
121
- :SDL_LoadFile_RW,
122
- :SDL_LoadFile,
123
- :SDL_ReadU8,
124
- :SDL_ReadLE16,
125
- :SDL_ReadBE16,
126
- :SDL_ReadLE32,
127
- :SDL_ReadBE32,
128
- :SDL_ReadLE64,
129
- :SDL_ReadBE64,
130
- :SDL_WriteU8,
131
- :SDL_WriteLE16,
132
- :SDL_WriteBE16,
133
- :SDL_WriteLE32,
134
- :SDL_WriteBE32,
135
- :SDL_WriteLE64,
136
- :SDL_WriteBE64,
137
- ]
138
- args = {
139
- :SDL_RWFromFile => [:pointer, :pointer],
140
- :SDL_RWFromFP => [:pointer, :int],
141
- :SDL_RWFromMem => [:pointer, :int],
142
- :SDL_RWFromConstMem => [:pointer, :int],
143
- :SDL_AllocRW => [],
144
- :SDL_FreeRW => [:pointer],
145
- :SDL_RWsize => [:pointer],
146
- :SDL_RWseek => [:pointer, :long_long, :int],
147
- :SDL_RWtell => [:pointer],
148
- :SDL_RWread => [:pointer, :pointer, :int, :int],
149
- :SDL_RWwrite => [:pointer, :pointer, :int, :int],
150
- :SDL_RWclose => [:pointer],
151
- :SDL_LoadFile_RW => [:pointer, :pointer, :int],
152
- :SDL_LoadFile => [:pointer, :pointer],
153
- :SDL_ReadU8 => [:pointer],
154
- :SDL_ReadLE16 => [:pointer],
155
- :SDL_ReadBE16 => [:pointer],
156
- :SDL_ReadLE32 => [:pointer],
157
- :SDL_ReadBE32 => [:pointer],
158
- :SDL_ReadLE64 => [:pointer],
159
- :SDL_ReadBE64 => [:pointer],
160
- :SDL_WriteU8 => [:pointer, :uchar],
161
- :SDL_WriteLE16 => [:pointer, :ushort],
162
- :SDL_WriteBE16 => [:pointer, :ushort],
163
- :SDL_WriteLE32 => [:pointer, :uint],
164
- :SDL_WriteBE32 => [:pointer, :uint],
165
- :SDL_WriteLE64 => [:pointer, :ulong_long],
166
- :SDL_WriteBE64 => [:pointer, :ulong_long],
167
- }
168
- retvals = {
169
- :SDL_RWFromFile => :pointer,
170
- :SDL_RWFromFP => :pointer,
171
- :SDL_RWFromMem => :pointer,
172
- :SDL_RWFromConstMem => :pointer,
173
- :SDL_AllocRW => :pointer,
174
- :SDL_FreeRW => :void,
175
- :SDL_RWsize => :long_long,
176
- :SDL_RWseek => :long_long,
177
- :SDL_RWtell => :long_long,
178
- :SDL_RWread => :int,
179
- :SDL_RWwrite => :int,
180
- :SDL_RWclose => :int,
181
- :SDL_LoadFile_RW => :pointer,
182
- :SDL_LoadFile => :pointer,
183
- :SDL_ReadU8 => :uchar,
184
- :SDL_ReadLE16 => :ushort,
185
- :SDL_ReadBE16 => :ushort,
186
- :SDL_ReadLE32 => :uint,
187
- :SDL_ReadBE32 => :uint,
188
- :SDL_ReadLE64 => :ulong_long,
189
- :SDL_ReadBE64 => :ulong_long,
190
- :SDL_WriteU8 => :int,
191
- :SDL_WriteLE16 => :int,
192
- :SDL_WriteBE16 => :int,
193
- :SDL_WriteLE32 => :int,
194
- :SDL_WriteBE32 => :int,
195
- :SDL_WriteLE64 => :int,
196
- :SDL_WriteBE64 => :int,
197
- }
198
- symbols.each do |sym|
199
- begin
200
- attach_function sym, args[sym], retvals[sym]
201
- rescue FFI::NotFoundError => error
202
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
203
- end
204
- end
205
- end
206
-
207
- end
208
-
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 SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ RWOPS_UNKNOWN = 0
14
+ RWOPS_WINFILE = 1
15
+ RWOPS_STDFILE = 2
16
+ RWOPS_JNIFILE = 3
17
+ RWOPS_MEMORY = 4
18
+ RWOPS_MEMORY_RO = 5
19
+
20
+ # Enum
21
+
22
+
23
+ # Typedef
24
+
25
+
26
+ class RWops_mem < FFI::Struct
27
+ layout(
28
+ :base, :pointer,
29
+ :here, :pointer,
30
+ :stop, :pointer,
31
+ )
32
+ end
33
+
34
+ class RWops_unknown < FFI::Struct
35
+ layout(
36
+ :data1, :pointer,
37
+ :data2, :pointer,
38
+ )
39
+ end
40
+ class RWops_windowsio_buffer < FFI::Struct
41
+ layout(
42
+ :data, :pointer,
43
+ :size, :size_t,
44
+ :left, :size_t,
45
+ )
46
+ end
47
+
48
+ class RWops_windowsio < FFI::Struct
49
+ layout(
50
+ :append, :int,
51
+ :h, :pointer,
52
+ :buffer, RWops_windowsio_buffer,
53
+ )
54
+ end
55
+
56
+ class Default_RWops_hidden < FFI::Union
57
+ layout(
58
+ :mem, RWops_mem,
59
+ :unknown, RWops_unknown,
60
+ )
61
+ end
62
+
63
+ class Win32_RWops_hidden < FFI::Union
64
+ layout(
65
+ :mem, RWops_mem,
66
+ :unknown, RWops_unknown,
67
+ :windowsio, RWops_windowsio,
68
+ )
69
+ end
70
+
71
+ class Default_RWops < FFI::Struct
72
+ layout(
73
+ :size, :pointer,
74
+ :seek, :pointer,
75
+ :read, :pointer,
76
+ :write, :pointer,
77
+ :close, :pointer,
78
+ :type, :uint,
79
+ :hidden, Default_RWops_hidden,
80
+ )
81
+ end
82
+
83
+ class Win32_RWops < FFI::Struct
84
+ layout(
85
+ :size, :pointer,
86
+ :seek, :pointer,
87
+ :read, :pointer,
88
+ :write, :pointer,
89
+ :close, :pointer,
90
+ :type, :uint,
91
+ :hidden, Win32_RWops_hidden
92
+ )
93
+ end
94
+
95
+ if RUBY_PLATFORM =~ /mswin|msys|mingw|cygwin/
96
+ RWops = Win32_RWops
97
+ else
98
+ RWops = Default_RWops
99
+ end
100
+
101
+
102
+ # Struct
103
+
104
+
105
+ # Function
106
+
107
+ def self.setup_rwops_symbols(output_error = false)
108
+ symbols = [
109
+ :SDL_RWFromFile,
110
+ :SDL_RWFromFP,
111
+ :SDL_RWFromMem,
112
+ :SDL_RWFromConstMem,
113
+ :SDL_AllocRW,
114
+ :SDL_FreeRW,
115
+ :SDL_RWsize,
116
+ :SDL_RWseek,
117
+ :SDL_RWtell,
118
+ :SDL_RWread,
119
+ :SDL_RWwrite,
120
+ :SDL_RWclose,
121
+ :SDL_LoadFile_RW,
122
+ :SDL_LoadFile,
123
+ :SDL_ReadU8,
124
+ :SDL_ReadLE16,
125
+ :SDL_ReadBE16,
126
+ :SDL_ReadLE32,
127
+ :SDL_ReadBE32,
128
+ :SDL_ReadLE64,
129
+ :SDL_ReadBE64,
130
+ :SDL_WriteU8,
131
+ :SDL_WriteLE16,
132
+ :SDL_WriteBE16,
133
+ :SDL_WriteLE32,
134
+ :SDL_WriteBE32,
135
+ :SDL_WriteLE64,
136
+ :SDL_WriteBE64,
137
+ ]
138
+ apis = {
139
+ :SDL_RWFromFile => :RWFromFile,
140
+ :SDL_RWFromFP => :RWFromFP,
141
+ :SDL_RWFromMem => :RWFromMem,
142
+ :SDL_RWFromConstMem => :RWFromConstMem,
143
+ :SDL_AllocRW => :AllocRW,
144
+ :SDL_FreeRW => :FreeRW,
145
+ :SDL_RWsize => :RWsize,
146
+ :SDL_RWseek => :RWseek,
147
+ :SDL_RWtell => :RWtell,
148
+ :SDL_RWread => :RWread,
149
+ :SDL_RWwrite => :RWwrite,
150
+ :SDL_RWclose => :RWclose,
151
+ :SDL_LoadFile_RW => :LoadFile_RW,
152
+ :SDL_LoadFile => :LoadFile,
153
+ :SDL_ReadU8 => :ReadU8,
154
+ :SDL_ReadLE16 => :ReadLE16,
155
+ :SDL_ReadBE16 => :ReadBE16,
156
+ :SDL_ReadLE32 => :ReadLE32,
157
+ :SDL_ReadBE32 => :ReadBE32,
158
+ :SDL_ReadLE64 => :ReadLE64,
159
+ :SDL_ReadBE64 => :ReadBE64,
160
+ :SDL_WriteU8 => :WriteU8,
161
+ :SDL_WriteLE16 => :WriteLE16,
162
+ :SDL_WriteBE16 => :WriteBE16,
163
+ :SDL_WriteLE32 => :WriteLE32,
164
+ :SDL_WriteBE32 => :WriteBE32,
165
+ :SDL_WriteLE64 => :WriteLE64,
166
+ :SDL_WriteBE64 => :WriteBE64,
167
+ }
168
+ args = {
169
+ :SDL_RWFromFile => [:pointer, :pointer],
170
+ :SDL_RWFromFP => [:pointer, :int],
171
+ :SDL_RWFromMem => [:pointer, :int],
172
+ :SDL_RWFromConstMem => [:pointer, :int],
173
+ :SDL_AllocRW => [],
174
+ :SDL_FreeRW => [:pointer],
175
+ :SDL_RWsize => [:pointer],
176
+ :SDL_RWseek => [:pointer, :long_long, :int],
177
+ :SDL_RWtell => [:pointer],
178
+ :SDL_RWread => [:pointer, :pointer, :int, :int],
179
+ :SDL_RWwrite => [:pointer, :pointer, :int, :int],
180
+ :SDL_RWclose => [:pointer],
181
+ :SDL_LoadFile_RW => [:pointer, :pointer, :int],
182
+ :SDL_LoadFile => [:pointer, :pointer],
183
+ :SDL_ReadU8 => [:pointer],
184
+ :SDL_ReadLE16 => [:pointer],
185
+ :SDL_ReadBE16 => [:pointer],
186
+ :SDL_ReadLE32 => [:pointer],
187
+ :SDL_ReadBE32 => [:pointer],
188
+ :SDL_ReadLE64 => [:pointer],
189
+ :SDL_ReadBE64 => [:pointer],
190
+ :SDL_WriteU8 => [:pointer, :uchar],
191
+ :SDL_WriteLE16 => [:pointer, :ushort],
192
+ :SDL_WriteBE16 => [:pointer, :ushort],
193
+ :SDL_WriteLE32 => [:pointer, :uint],
194
+ :SDL_WriteBE32 => [:pointer, :uint],
195
+ :SDL_WriteLE64 => [:pointer, :ulong_long],
196
+ :SDL_WriteBE64 => [:pointer, :ulong_long],
197
+ }
198
+ retvals = {
199
+ :SDL_RWFromFile => :pointer,
200
+ :SDL_RWFromFP => :pointer,
201
+ :SDL_RWFromMem => :pointer,
202
+ :SDL_RWFromConstMem => :pointer,
203
+ :SDL_AllocRW => :pointer,
204
+ :SDL_FreeRW => :void,
205
+ :SDL_RWsize => :long_long,
206
+ :SDL_RWseek => :long_long,
207
+ :SDL_RWtell => :long_long,
208
+ :SDL_RWread => :int,
209
+ :SDL_RWwrite => :int,
210
+ :SDL_RWclose => :int,
211
+ :SDL_LoadFile_RW => :pointer,
212
+ :SDL_LoadFile => :pointer,
213
+ :SDL_ReadU8 => :uchar,
214
+ :SDL_ReadLE16 => :ushort,
215
+ :SDL_ReadBE16 => :ushort,
216
+ :SDL_ReadLE32 => :uint,
217
+ :SDL_ReadBE32 => :uint,
218
+ :SDL_ReadLE64 => :ulong_long,
219
+ :SDL_ReadBE64 => :ulong_long,
220
+ :SDL_WriteU8 => :int,
221
+ :SDL_WriteLE16 => :int,
222
+ :SDL_WriteBE16 => :int,
223
+ :SDL_WriteLE32 => :int,
224
+ :SDL_WriteBE32 => :int,
225
+ :SDL_WriteLE64 => :int,
226
+ :SDL_WriteBE64 => :int,
227
+ }
228
+ symbols.each do |sym|
229
+ begin
230
+ attach_function apis[sym], sym, args[sym], retvals[sym]
231
+ rescue FFI::NotFoundError => error
232
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
233
+ end
234
+ end
235
+ end
236
+
237
+ end
238
+