sdl2-bindings 0.0.9 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +129 -96
- data/LICENSE.txt +0 -0
- data/README.md +78 -55
- data/lib/sdl2.rb +131 -172
- data/lib/sdl2_audio.rb +261 -222
- data/lib/sdl2_blendmode.rb +72 -69
- data/lib/sdl2_clipboard.rb +56 -51
- data/lib/sdl2_cpuinfo.rb +129 -106
- data/lib/sdl2_error.rb +71 -64
- data/lib/sdl2_events.rb +564 -533
- data/lib/sdl2_filesystem.rb +52 -48
- data/lib/sdl2_framerate.rb +74 -67
- data/lib/sdl2_gamecontroller.rb +329 -274
- data/lib/sdl2_gesture.rb +61 -55
- data/lib/sdl2_gfxPrimitives.rb +283 -222
- data/lib/sdl2_haptic.rb +301 -269
- data/lib/sdl2_hidapi.rb +139 -118
- data/lib/sdl2_hints.rb +221 -198
- data/lib/sdl2_image.rb +232 -185
- data/lib/sdl2_imageFilter.rb +164 -132
- data/lib/sdl2_joystick.rb +294 -239
- data/lib/sdl2_keyboard.rb +125 -99
- data/lib/sdl2_keycode.rb +307 -305
- data/lib/sdl2_log.rb +131 -115
- data/lib/sdl2_main.rb +74 -67
- data/lib/sdl2_messagebox.rb +102 -98
- data/lib/sdl2_misc.rb +48 -45
- data/lib/sdl2_mixer.rb +392 -317
- data/lib/sdl2_mouse.rb +136 -117
- data/lib/sdl2_pixels.rb +240 -224
- data/lib/sdl2_platform.rb +48 -45
- data/lib/sdl2_power.rb +54 -51
- data/lib/sdl2_rect.rb +145 -102
- data/lib/sdl2_render.rb +408 -322
- data/lib/sdl2_rotozoom.rb +76 -66
- data/lib/sdl2_rwops.rb +242 -208
- data/lib/sdl2_scancode.rb +289 -287
- data/lib/sdl2_sensor.rb +115 -97
- data/lib/sdl2_shape.rb +83 -77
- data/lib/sdl2_sound.rb +154 -0
- data/lib/sdl2_stdinc.rb +556 -439
- data/lib/sdl2_surface.rb +229 -188
- data/lib/sdl2_syswm.rb +160 -157
- data/lib/sdl2_timer.rb +74 -65
- data/lib/sdl2_touch.rb +86 -75
- data/lib/sdl2_ttf.rb +358 -202
- data/lib/sdl2_version.rb +67 -62
- data/lib/sdl2_video.rb +540 -446
- data/lib/sdl2_vulkan.rb +72 -64
- metadata +18 -3
data/lib/sdl2_sensor.rb
CHANGED
@@ -1,97 +1,115 @@
|
|
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
|
10
|
-
extend FFI::Library
|
11
|
-
# Define/Macro
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# Enum
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
# Typedef
|
23
|
-
|
24
|
-
typedef :int, :SDL_SensorID
|
25
|
-
typedef :int, :SDL_SensorType
|
26
|
-
|
27
|
-
# Struct
|
28
|
-
|
29
|
-
|
30
|
-
# Function
|
31
|
-
|
32
|
-
def self.setup_sensor_symbols()
|
33
|
-
symbols = [
|
34
|
-
:SDL_LockSensors,
|
35
|
-
:SDL_UnlockSensors,
|
36
|
-
:SDL_NumSensors,
|
37
|
-
:SDL_SensorGetDeviceName,
|
38
|
-
:SDL_SensorGetDeviceType,
|
39
|
-
:SDL_SensorGetDeviceNonPortableType,
|
40
|
-
:SDL_SensorGetDeviceInstanceID,
|
41
|
-
:SDL_SensorOpen,
|
42
|
-
:SDL_SensorFromInstanceID,
|
43
|
-
:SDL_SensorGetName,
|
44
|
-
:SDL_SensorGetType,
|
45
|
-
:SDL_SensorGetNonPortableType,
|
46
|
-
:SDL_SensorGetInstanceID,
|
47
|
-
:SDL_SensorGetData,
|
48
|
-
:SDL_SensorClose,
|
49
|
-
:SDL_SensorUpdate,
|
50
|
-
]
|
51
|
-
|
52
|
-
:SDL_LockSensors =>
|
53
|
-
:SDL_UnlockSensors =>
|
54
|
-
:SDL_NumSensors =>
|
55
|
-
:SDL_SensorGetDeviceName =>
|
56
|
-
:SDL_SensorGetDeviceType =>
|
57
|
-
:SDL_SensorGetDeviceNonPortableType =>
|
58
|
-
:SDL_SensorGetDeviceInstanceID =>
|
59
|
-
:SDL_SensorOpen =>
|
60
|
-
:SDL_SensorFromInstanceID =>
|
61
|
-
:SDL_SensorGetName =>
|
62
|
-
:SDL_SensorGetType =>
|
63
|
-
:SDL_SensorGetNonPortableType =>
|
64
|
-
:SDL_SensorGetInstanceID =>
|
65
|
-
:SDL_SensorGetData =>
|
66
|
-
:SDL_SensorClose =>
|
67
|
-
:SDL_SensorUpdate =>
|
68
|
-
}
|
69
|
-
|
70
|
-
:SDL_LockSensors =>
|
71
|
-
:SDL_UnlockSensors =>
|
72
|
-
:SDL_NumSensors =>
|
73
|
-
:SDL_SensorGetDeviceName => :
|
74
|
-
:SDL_SensorGetDeviceType => :int,
|
75
|
-
:SDL_SensorGetDeviceNonPortableType => :int,
|
76
|
-
:SDL_SensorGetDeviceInstanceID => :int,
|
77
|
-
:SDL_SensorOpen => :
|
78
|
-
:SDL_SensorFromInstanceID => :
|
79
|
-
:SDL_SensorGetName => :pointer,
|
80
|
-
:SDL_SensorGetType => :
|
81
|
-
:SDL_SensorGetNonPortableType => :
|
82
|
-
:SDL_SensorGetInstanceID => :
|
83
|
-
:SDL_SensorGetData => :int,
|
84
|
-
:SDL_SensorClose => :
|
85
|
-
:SDL_SensorUpdate =>
|
86
|
-
}
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
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
|
+
STANDARD_GRAVITY = 9.80665
|
14
|
+
|
15
|
+
# Enum
|
16
|
+
|
17
|
+
SENSOR_INVALID = -1
|
18
|
+
SENSOR_UNKNOWN = 0
|
19
|
+
SENSOR_ACCEL = 1
|
20
|
+
SENSOR_GYRO = 2
|
21
|
+
|
22
|
+
# Typedef
|
23
|
+
|
24
|
+
typedef :int, :SDL_SensorID
|
25
|
+
typedef :int, :SDL_SensorType
|
26
|
+
|
27
|
+
# Struct
|
28
|
+
|
29
|
+
|
30
|
+
# Function
|
31
|
+
|
32
|
+
def self.setup_sensor_symbols(output_error = false)
|
33
|
+
symbols = [
|
34
|
+
:SDL_LockSensors,
|
35
|
+
:SDL_UnlockSensors,
|
36
|
+
:SDL_NumSensors,
|
37
|
+
:SDL_SensorGetDeviceName,
|
38
|
+
:SDL_SensorGetDeviceType,
|
39
|
+
:SDL_SensorGetDeviceNonPortableType,
|
40
|
+
:SDL_SensorGetDeviceInstanceID,
|
41
|
+
:SDL_SensorOpen,
|
42
|
+
:SDL_SensorFromInstanceID,
|
43
|
+
:SDL_SensorGetName,
|
44
|
+
:SDL_SensorGetType,
|
45
|
+
:SDL_SensorGetNonPortableType,
|
46
|
+
:SDL_SensorGetInstanceID,
|
47
|
+
:SDL_SensorGetData,
|
48
|
+
:SDL_SensorClose,
|
49
|
+
:SDL_SensorUpdate,
|
50
|
+
]
|
51
|
+
apis = {
|
52
|
+
:SDL_LockSensors => :LockSensors,
|
53
|
+
:SDL_UnlockSensors => :UnlockSensors,
|
54
|
+
:SDL_NumSensors => :NumSensors,
|
55
|
+
:SDL_SensorGetDeviceName => :SensorGetDeviceName,
|
56
|
+
:SDL_SensorGetDeviceType => :SensorGetDeviceType,
|
57
|
+
:SDL_SensorGetDeviceNonPortableType => :SensorGetDeviceNonPortableType,
|
58
|
+
:SDL_SensorGetDeviceInstanceID => :SensorGetDeviceInstanceID,
|
59
|
+
:SDL_SensorOpen => :SensorOpen,
|
60
|
+
:SDL_SensorFromInstanceID => :SensorFromInstanceID,
|
61
|
+
:SDL_SensorGetName => :SensorGetName,
|
62
|
+
:SDL_SensorGetType => :SensorGetType,
|
63
|
+
:SDL_SensorGetNonPortableType => :SensorGetNonPortableType,
|
64
|
+
:SDL_SensorGetInstanceID => :SensorGetInstanceID,
|
65
|
+
:SDL_SensorGetData => :SensorGetData,
|
66
|
+
:SDL_SensorClose => :SensorClose,
|
67
|
+
:SDL_SensorUpdate => :SensorUpdate,
|
68
|
+
}
|
69
|
+
args = {
|
70
|
+
:SDL_LockSensors => [],
|
71
|
+
:SDL_UnlockSensors => [],
|
72
|
+
:SDL_NumSensors => [],
|
73
|
+
:SDL_SensorGetDeviceName => [:int],
|
74
|
+
:SDL_SensorGetDeviceType => [:int],
|
75
|
+
:SDL_SensorGetDeviceNonPortableType => [:int],
|
76
|
+
:SDL_SensorGetDeviceInstanceID => [:int],
|
77
|
+
:SDL_SensorOpen => [:int],
|
78
|
+
:SDL_SensorFromInstanceID => [:int],
|
79
|
+
:SDL_SensorGetName => [:pointer],
|
80
|
+
:SDL_SensorGetType => [:pointer],
|
81
|
+
:SDL_SensorGetNonPortableType => [:pointer],
|
82
|
+
:SDL_SensorGetInstanceID => [:pointer],
|
83
|
+
:SDL_SensorGetData => [:pointer, :pointer, :int],
|
84
|
+
:SDL_SensorClose => [:pointer],
|
85
|
+
:SDL_SensorUpdate => [],
|
86
|
+
}
|
87
|
+
retvals = {
|
88
|
+
:SDL_LockSensors => :void,
|
89
|
+
:SDL_UnlockSensors => :void,
|
90
|
+
:SDL_NumSensors => :int,
|
91
|
+
:SDL_SensorGetDeviceName => :pointer,
|
92
|
+
:SDL_SensorGetDeviceType => :int,
|
93
|
+
:SDL_SensorGetDeviceNonPortableType => :int,
|
94
|
+
:SDL_SensorGetDeviceInstanceID => :int,
|
95
|
+
:SDL_SensorOpen => :pointer,
|
96
|
+
:SDL_SensorFromInstanceID => :pointer,
|
97
|
+
:SDL_SensorGetName => :pointer,
|
98
|
+
:SDL_SensorGetType => :int,
|
99
|
+
:SDL_SensorGetNonPortableType => :int,
|
100
|
+
:SDL_SensorGetInstanceID => :int,
|
101
|
+
:SDL_SensorGetData => :int,
|
102
|
+
:SDL_SensorClose => :void,
|
103
|
+
:SDL_SensorUpdate => :void,
|
104
|
+
}
|
105
|
+
symbols.each do |sym|
|
106
|
+
begin
|
107
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
108
|
+
rescue FFI::NotFoundError => error
|
109
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
data/lib/sdl2_shape.rb
CHANGED
@@ -1,77 +1,83 @@
|
|
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
|
11
|
-
extend FFI::Library
|
12
|
-
# Define/Macro
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
32
|
-
layout(
|
33
|
-
:binarizationCutoff, :uchar,
|
34
|
-
:colorKey,
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
class
|
39
|
-
layout(
|
40
|
-
:mode, :int,
|
41
|
-
:parameters,
|
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
|
-
|
56
|
-
:SDL_CreateShapedWindow =>
|
57
|
-
:SDL_IsShapedWindow =>
|
58
|
-
:SDL_SetWindowShape =>
|
59
|
-
:SDL_GetShapedWindowMode =>
|
60
|
-
}
|
61
|
-
|
62
|
-
:SDL_CreateShapedWindow => :pointer,
|
63
|
-
:SDL_IsShapedWindow => :
|
64
|
-
:SDL_SetWindowShape => :
|
65
|
-
:SDL_GetShapedWindowMode => :
|
66
|
-
}
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
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 SDL
|
11
|
+
extend FFI::Library
|
12
|
+
# Define/Macro
|
13
|
+
|
14
|
+
NONSHAPEABLE_WINDOW = -1
|
15
|
+
INVALID_SHAPE_ARGUMENT = -2
|
16
|
+
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 WindowShapeParams < FFI::Union
|
32
|
+
layout(
|
33
|
+
:binarizationCutoff, :uchar,
|
34
|
+
:colorKey, Color,
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
class WindowShapeMode < FFI::Struct
|
39
|
+
layout(
|
40
|
+
:mode, :int,
|
41
|
+
:parameters, WindowShapeParams,
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
# Function
|
47
|
+
|
48
|
+
def self.setup_shape_symbols(output_error = false)
|
49
|
+
symbols = [
|
50
|
+
:SDL_CreateShapedWindow,
|
51
|
+
:SDL_IsShapedWindow,
|
52
|
+
:SDL_SetWindowShape,
|
53
|
+
:SDL_GetShapedWindowMode,
|
54
|
+
]
|
55
|
+
apis = {
|
56
|
+
:SDL_CreateShapedWindow => :CreateShapedWindow,
|
57
|
+
:SDL_IsShapedWindow => :IsShapedWindow,
|
58
|
+
:SDL_SetWindowShape => :SetWindowShape,
|
59
|
+
:SDL_GetShapedWindowMode => :GetShapedWindowMode,
|
60
|
+
}
|
61
|
+
args = {
|
62
|
+
:SDL_CreateShapedWindow => [:pointer, :uint, :uint, :uint, :uint, :uint],
|
63
|
+
:SDL_IsShapedWindow => [:pointer],
|
64
|
+
:SDL_SetWindowShape => [:pointer, :pointer, :pointer],
|
65
|
+
:SDL_GetShapedWindowMode => [:pointer, :pointer],
|
66
|
+
}
|
67
|
+
retvals = {
|
68
|
+
:SDL_CreateShapedWindow => :pointer,
|
69
|
+
:SDL_IsShapedWindow => :int,
|
70
|
+
:SDL_SetWindowShape => :int,
|
71
|
+
:SDL_GetShapedWindowMode => :int,
|
72
|
+
}
|
73
|
+
symbols.each do |sym|
|
74
|
+
begin
|
75
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
76
|
+
rescue FFI::NotFoundError => error
|
77
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
data/lib/sdl2_sound.rb
ADDED
@@ -0,0 +1,154 @@
|
|
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
|
+
SOUND_VER_MAJOR = 2
|
14
|
+
SOUND_VER_MINOR = 0
|
15
|
+
SOUND_VER_PATCH = 1
|
16
|
+
|
17
|
+
# Enum
|
18
|
+
|
19
|
+
SOUND_SAMPLEFLAG_NONE = 0
|
20
|
+
SOUND_SAMPLEFLAG_CANSEEK = 1
|
21
|
+
SOUND_SAMPLEFLAG_EOF = 536870912
|
22
|
+
SOUND_SAMPLEFLAG_ERROR = 1073741824
|
23
|
+
SOUND_SAMPLEFLAG_EAGAIN = -2147483648
|
24
|
+
|
25
|
+
# Typedef
|
26
|
+
|
27
|
+
typedef :int, :Sound_SampleFlags
|
28
|
+
|
29
|
+
# Struct
|
30
|
+
|
31
|
+
class Sound_AudioInfo < FFI::Struct
|
32
|
+
layout(
|
33
|
+
:format, :ushort,
|
34
|
+
:channels, :uchar,
|
35
|
+
:rate, :uint,
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
class Sound_DecoderInfo < FFI::Struct
|
40
|
+
layout(
|
41
|
+
:extensions, :pointer,
|
42
|
+
:description, :pointer,
|
43
|
+
:author, :pointer,
|
44
|
+
:url, :pointer,
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
class Sound_Sample < FFI::Struct
|
49
|
+
layout(
|
50
|
+
:opaque, :pointer,
|
51
|
+
:decoder, :pointer,
|
52
|
+
:desired, Sound_AudioInfo,
|
53
|
+
:actual, Sound_AudioInfo,
|
54
|
+
:buffer, :pointer,
|
55
|
+
:buffer_size, :uint,
|
56
|
+
:flags, :int,
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
class Sound_Version < FFI::Struct
|
61
|
+
layout(
|
62
|
+
:major, :int,
|
63
|
+
:minor, :int,
|
64
|
+
:patch, :int,
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
# Function
|
70
|
+
|
71
|
+
def self.setup_sound_symbols(output_error = false)
|
72
|
+
symbols = [
|
73
|
+
:Sound_GetLinkedVersion,
|
74
|
+
:Sound_Init,
|
75
|
+
:Sound_Quit,
|
76
|
+
:Sound_AvailableDecoders,
|
77
|
+
:Sound_GetError,
|
78
|
+
:Sound_ClearError,
|
79
|
+
:Sound_NewSample,
|
80
|
+
:Sound_NewSampleFromMem,
|
81
|
+
:Sound_NewSampleFromFile,
|
82
|
+
:Sound_FreeSample,
|
83
|
+
:Sound_GetDuration,
|
84
|
+
:Sound_SetBufferSize,
|
85
|
+
:Sound_Decode,
|
86
|
+
:Sound_DecodeAll,
|
87
|
+
:Sound_Rewind,
|
88
|
+
:Sound_Seek,
|
89
|
+
]
|
90
|
+
apis = {
|
91
|
+
:Sound_GetLinkedVersion => :Sound_GetLinkedVersion,
|
92
|
+
:Sound_Init => :Sound_Init,
|
93
|
+
:Sound_Quit => :Sound_Quit,
|
94
|
+
:Sound_AvailableDecoders => :Sound_AvailableDecoders,
|
95
|
+
:Sound_GetError => :Sound_GetError,
|
96
|
+
:Sound_ClearError => :Sound_ClearError,
|
97
|
+
:Sound_NewSample => :Sound_NewSample,
|
98
|
+
:Sound_NewSampleFromMem => :Sound_NewSampleFromMem,
|
99
|
+
:Sound_NewSampleFromFile => :Sound_NewSampleFromFile,
|
100
|
+
:Sound_FreeSample => :Sound_FreeSample,
|
101
|
+
:Sound_GetDuration => :Sound_GetDuration,
|
102
|
+
:Sound_SetBufferSize => :Sound_SetBufferSize,
|
103
|
+
:Sound_Decode => :Sound_Decode,
|
104
|
+
:Sound_DecodeAll => :Sound_DecodeAll,
|
105
|
+
:Sound_Rewind => :Sound_Rewind,
|
106
|
+
:Sound_Seek => :Sound_Seek,
|
107
|
+
}
|
108
|
+
args = {
|
109
|
+
:Sound_GetLinkedVersion => [:pointer],
|
110
|
+
:Sound_Init => [],
|
111
|
+
:Sound_Quit => [],
|
112
|
+
:Sound_AvailableDecoders => [],
|
113
|
+
:Sound_GetError => [],
|
114
|
+
:Sound_ClearError => [],
|
115
|
+
:Sound_NewSample => [:pointer, :pointer, :pointer, :uint],
|
116
|
+
:Sound_NewSampleFromMem => [:pointer, :uint, :pointer, :pointer, :uint],
|
117
|
+
:Sound_NewSampleFromFile => [:pointer, :pointer, :uint],
|
118
|
+
:Sound_FreeSample => [:pointer],
|
119
|
+
:Sound_GetDuration => [:pointer],
|
120
|
+
:Sound_SetBufferSize => [:pointer, :uint],
|
121
|
+
:Sound_Decode => [:pointer],
|
122
|
+
:Sound_DecodeAll => [:pointer],
|
123
|
+
:Sound_Rewind => [:pointer],
|
124
|
+
:Sound_Seek => [:pointer, :uint],
|
125
|
+
}
|
126
|
+
retvals = {
|
127
|
+
:Sound_GetLinkedVersion => :void,
|
128
|
+
:Sound_Init => :int,
|
129
|
+
:Sound_Quit => :int,
|
130
|
+
:Sound_AvailableDecoders => :pointer,
|
131
|
+
:Sound_GetError => :pointer,
|
132
|
+
:Sound_ClearError => :void,
|
133
|
+
:Sound_NewSample => :pointer,
|
134
|
+
:Sound_NewSampleFromMem => :pointer,
|
135
|
+
:Sound_NewSampleFromFile => :pointer,
|
136
|
+
:Sound_FreeSample => :void,
|
137
|
+
:Sound_GetDuration => :int,
|
138
|
+
:Sound_SetBufferSize => :int,
|
139
|
+
:Sound_Decode => :uint,
|
140
|
+
:Sound_DecodeAll => :uint,
|
141
|
+
:Sound_Rewind => :int,
|
142
|
+
:Sound_Seek => :int,
|
143
|
+
}
|
144
|
+
symbols.each do |sym|
|
145
|
+
begin
|
146
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
147
|
+
rescue FFI::NotFoundError => error
|
148
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
|