sdl2-bindings 0.1.0 → 0.1.1

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +124 -108
  3. data/LICENSE.txt +0 -0
  4. data/README.md +77 -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 +232 -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 +392 -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 +238 -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 +556 -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 +358 -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,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
- 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
+ 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
+