sdl2-bindings 0.1.0 → 0.1.3

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