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.
- checksums.yaml +4 -4
- data/ChangeLog +83 -79
- data/LICENSE.txt +1 -1
- data/README.md +49 -49
- data/lib/sdl2.rb +170 -170
- data/lib/sdl2_audio.rb +219 -201
- data/lib/sdl2_blendmode.rb +69 -69
- data/lib/sdl2_clipboard.rb +51 -51
- data/lib/sdl2_cpuinfo.rb +106 -106
- data/lib/sdl2_error.rb +64 -64
- data/lib/sdl2_events.rb +530 -530
- data/lib/sdl2_filesystem.rb +48 -48
- data/lib/sdl2_framerate.rb +67 -67
- data/lib/sdl2_gamecontroller.rb +254 -254
- data/lib/sdl2_gesture.rb +55 -55
- data/lib/sdl2_gfxPrimitives.rb +222 -222
- data/lib/sdl2_haptic.rb +269 -269
- data/lib/sdl2_hints.rb +174 -174
- data/lib/sdl2_image.rb +185 -185
- data/lib/sdl2_imageFilter.rb +132 -132
- data/lib/sdl2_joystick.rb +230 -230
- data/lib/sdl2_keyboard.rb +99 -99
- data/lib/sdl2_keycode.rb +304 -304
- data/lib/sdl2_log.rb +115 -115
- data/lib/sdl2_main.rb +67 -67
- data/lib/sdl2_messagebox.rb +98 -98
- data/lib/sdl2_mixer.rb +317 -307
- data/lib/sdl2_mouse.rb +117 -117
- data/lib/sdl2_pixels.rb +224 -224
- data/lib/sdl2_platform.rb +45 -45
- data/lib/sdl2_power.rb +51 -51
- data/lib/sdl2_rect.rb +102 -102
- data/lib/sdl2_render.rb +290 -290
- data/lib/sdl2_rotozoom.rb +66 -66
- data/lib/sdl2_rwops.rb +208 -208
- data/lib/sdl2_scancode.rb +287 -287
- data/lib/sdl2_shape.rb +77 -77
- data/lib/sdl2_stdinc.rb +393 -393
- data/lib/sdl2_surface.rb +182 -182
- data/lib/sdl2_syswm.rb +154 -154
- data/lib/sdl2_timer.rb +62 -62
- data/lib/sdl2_touch.rb +73 -73
- data/lib/sdl2_ttf.rb +202 -190
- data/lib/sdl2_version.rb +62 -62
- data/lib/sdl2_video.rb +411 -411
- data/lib/sdl2_vulkan.rb +64 -64
- metadata +6 -6
data/lib/sdl2_rotozoom.rb
CHANGED
@@ -1,66 +1,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 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 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
|
+
|
data/lib/sdl2_rwops.rb
CHANGED
@@ -1,208 +1,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 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, :ulong, :ulong],
|
149
|
-
:SDL_RWwrite => [:pointer, :pointer, :ulong, :ulong],
|
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 => :size_t,
|
179
|
-
:SDL_RWwrite => :size_t,
|
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 => :size_t,
|
191
|
-
:SDL_WriteLE16 => :size_t,
|
192
|
-
:SDL_WriteBE16 => :size_t,
|
193
|
-
:SDL_WriteLE32 => :size_t,
|
194
|
-
:SDL_WriteBE32 => :size_t,
|
195
|
-
:SDL_WriteLE64 => :size_t,
|
196
|
-
:SDL_WriteBE64 => :size_t,
|
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 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, :ulong, :ulong],
|
149
|
+
:SDL_RWwrite => [:pointer, :pointer, :ulong, :ulong],
|
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 => :size_t,
|
179
|
+
:SDL_RWwrite => :size_t,
|
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 => :size_t,
|
191
|
+
:SDL_WriteLE16 => :size_t,
|
192
|
+
:SDL_WriteBE16 => :size_t,
|
193
|
+
:SDL_WriteLE32 => :size_t,
|
194
|
+
:SDL_WriteBE32 => :size_t,
|
195
|
+
:SDL_WriteLE64 => :size_t,
|
196
|
+
:SDL_WriteBE64 => :size_t,
|
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
|
+
|