sdl2-bindings 0.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ChangeLog +55 -0
- data/LICENSE.txt +21 -0
- data/README.md +46 -0
- data/lib/sdl2.rb +166 -0
- data/lib/sdl2_audio.rb +201 -0
- data/lib/sdl2_blendmode.rb +68 -0
- data/lib/sdl2_clipboard.rb +51 -0
- data/lib/sdl2_cpuinfo.rb +100 -0
- data/lib/sdl2_error.rb +61 -0
- data/lib/sdl2_events.rb +499 -0
- data/lib/sdl2_filesystem.rb +48 -0
- data/lib/sdl2_framerate.rb +67 -0
- data/lib/sdl2_gamecontroller.rb +188 -0
- data/lib/sdl2_gesture.rb +55 -0
- data/lib/sdl2_gfxPrimitives.rb +222 -0
- data/lib/sdl2_haptic.rb +268 -0
- data/lib/sdl2_hints.rb +68 -0
- data/lib/sdl2_image.rb +185 -0
- data/lib/sdl2_imageFilter.rb +132 -0
- data/lib/sdl2_joystick.rb +193 -0
- data/lib/sdl2_keyboard.rb +99 -0
- data/lib/sdl2_keycode.rb +297 -0
- data/lib/sdl2_log.rb +114 -0
- data/lib/sdl2_main.rb +67 -0
- data/lib/sdl2_messagebox.rb +96 -0
- data/lib/sdl2_mixer.rb +304 -0
- data/lib/sdl2_mouse.rb +115 -0
- data/lib/sdl2_pixels.rb +212 -0
- data/lib/sdl2_platform.rb +45 -0
- data/lib/sdl2_power.rb +51 -0
- data/lib/sdl2_rect.rb +102 -0
- data/lib/sdl2_render.rb +277 -0
- data/lib/sdl2_rotozoom.rb +66 -0
- data/lib/sdl2_rwops.rb +208 -0
- data/lib/sdl2_scancode.rb +287 -0
- data/lib/sdl2_shape.rb +77 -0
- data/lib/sdl2_surface.rb +179 -0
- data/lib/sdl2_timer.rb +62 -0
- data/lib/sdl2_touch.rb +73 -0
- data/lib/sdl2_ttf.rb +190 -0
- data/lib/sdl2_version.rb +62 -0
- data/lib/sdl2_video.rb +408 -0
- data/lib/sdl2_vulkan.rb +64 -0
- metadata +88 -0
data/lib/sdl2_log.rb
ADDED
@@ -0,0 +1,114 @@
|
|
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_MAX_LOG_MESSAGE = 4096
|
14
|
+
|
15
|
+
# Enum
|
16
|
+
|
17
|
+
SDL_LOG_CATEGORY_APPLICATION = 0
|
18
|
+
SDL_LOG_CATEGORY_ERROR = 1
|
19
|
+
SDL_LOG_CATEGORY_ASSERT = 2
|
20
|
+
SDL_LOG_CATEGORY_SYSTEM = 3
|
21
|
+
SDL_LOG_CATEGORY_AUDIO = 4
|
22
|
+
SDL_LOG_CATEGORY_VIDEO = 5
|
23
|
+
SDL_LOG_CATEGORY_RENDER = 6
|
24
|
+
SDL_LOG_CATEGORY_INPUT = 7
|
25
|
+
SDL_LOG_CATEGORY_TEST = 8
|
26
|
+
SDL_LOG_CATEGORY_RESERVED1 = 9
|
27
|
+
SDL_LOG_CATEGORY_RESERVED2 = 10
|
28
|
+
SDL_LOG_CATEGORY_RESERVED3 = 11
|
29
|
+
SDL_LOG_CATEGORY_RESERVED4 = 12
|
30
|
+
SDL_LOG_CATEGORY_RESERVED5 = 13
|
31
|
+
SDL_LOG_CATEGORY_RESERVED6 = 14
|
32
|
+
SDL_LOG_CATEGORY_RESERVED7 = 15
|
33
|
+
SDL_LOG_CATEGORY_RESERVED8 = 16
|
34
|
+
SDL_LOG_CATEGORY_RESERVED9 = 17
|
35
|
+
SDL_LOG_CATEGORY_RESERVED10 = 18
|
36
|
+
SDL_LOG_CATEGORY_CUSTOM = 19
|
37
|
+
SDL_LOG_PRIORITY_VERBOSE = 1
|
38
|
+
SDL_LOG_PRIORITY_DEBUG = 2
|
39
|
+
SDL_LOG_PRIORITY_INFO = 3
|
40
|
+
SDL_LOG_PRIORITY_WARN = 4
|
41
|
+
SDL_LOG_PRIORITY_ERROR = 5
|
42
|
+
SDL_LOG_PRIORITY_CRITICAL = 6
|
43
|
+
SDL_NUM_LOG_PRIORITIES = 7
|
44
|
+
|
45
|
+
# Typedef
|
46
|
+
|
47
|
+
typedef :int, :SDL_LogPriority
|
48
|
+
callback :SDL_LogOutputFunction, [:pointer, :int, :int, :pointer], :void
|
49
|
+
|
50
|
+
# Struct
|
51
|
+
|
52
|
+
|
53
|
+
# Function
|
54
|
+
|
55
|
+
def self.setup_log_symbols()
|
56
|
+
symbols = [
|
57
|
+
:SDL_LogSetAllPriority,
|
58
|
+
:SDL_LogSetPriority,
|
59
|
+
:SDL_LogGetPriority,
|
60
|
+
:SDL_LogResetPriorities,
|
61
|
+
:SDL_Log,
|
62
|
+
:SDL_LogVerbose,
|
63
|
+
:SDL_LogDebug,
|
64
|
+
:SDL_LogInfo,
|
65
|
+
:SDL_LogWarn,
|
66
|
+
:SDL_LogError,
|
67
|
+
:SDL_LogCritical,
|
68
|
+
:SDL_LogMessage,
|
69
|
+
:SDL_LogGetOutputFunction,
|
70
|
+
:SDL_LogSetOutputFunction,
|
71
|
+
]
|
72
|
+
args = {
|
73
|
+
:SDL_LogSetAllPriority => [:int],
|
74
|
+
:SDL_LogSetPriority => [:int, :int],
|
75
|
+
:SDL_LogGetPriority => [:int],
|
76
|
+
:SDL_LogResetPriorities => [],
|
77
|
+
:SDL_Log => [:pointer],
|
78
|
+
:SDL_LogVerbose => [:int, :pointer],
|
79
|
+
:SDL_LogDebug => [:int, :pointer],
|
80
|
+
:SDL_LogInfo => [:int, :pointer],
|
81
|
+
:SDL_LogWarn => [:int, :pointer],
|
82
|
+
:SDL_LogError => [:int, :pointer],
|
83
|
+
:SDL_LogCritical => [:int, :pointer],
|
84
|
+
:SDL_LogMessage => [:int, :int, :pointer],
|
85
|
+
:SDL_LogGetOutputFunction => [:pointer, :pointer],
|
86
|
+
:SDL_LogSetOutputFunction => [:pointer, :pointer],
|
87
|
+
}
|
88
|
+
retvals = {
|
89
|
+
:SDL_LogSetAllPriority => :void,
|
90
|
+
:SDL_LogSetPriority => :void,
|
91
|
+
:SDL_LogGetPriority => :int,
|
92
|
+
:SDL_LogResetPriorities => :void,
|
93
|
+
:SDL_Log => :void,
|
94
|
+
:SDL_LogVerbose => :void,
|
95
|
+
:SDL_LogDebug => :void,
|
96
|
+
:SDL_LogInfo => :void,
|
97
|
+
:SDL_LogWarn => :void,
|
98
|
+
:SDL_LogError => :void,
|
99
|
+
:SDL_LogCritical => :void,
|
100
|
+
:SDL_LogMessage => :void,
|
101
|
+
:SDL_LogGetOutputFunction => :void,
|
102
|
+
:SDL_LogSetOutputFunction => :void,
|
103
|
+
}
|
104
|
+
symbols.each do |sym|
|
105
|
+
begin
|
106
|
+
attach_function sym, args[sym], retvals[sym]
|
107
|
+
rescue FFI::NotFoundError => error
|
108
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
data/lib/sdl2_main.rb
ADDED
@@ -0,0 +1,67 @@
|
|
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_INIT_TIMER = 0x00000001
|
14
|
+
SDL_INIT_AUDIO = 0x00000010
|
15
|
+
SDL_INIT_VIDEO = 0x00000020
|
16
|
+
SDL_INIT_JOYSTICK = 0x00000200
|
17
|
+
SDL_INIT_HAPTIC = 0x00001000
|
18
|
+
SDL_INIT_GAMECONTROLLER = 0x00002000
|
19
|
+
SDL_INIT_EVENTS = 0x00004000
|
20
|
+
SDL_INIT_SENSOR = 0x00008000
|
21
|
+
SDL_INIT_NOPARACHUTE = 0x00100000
|
22
|
+
SDL_INIT_EVERYTHING = ( SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR )
|
23
|
+
|
24
|
+
# Enum
|
25
|
+
|
26
|
+
|
27
|
+
# Typedef
|
28
|
+
|
29
|
+
|
30
|
+
# Struct
|
31
|
+
|
32
|
+
|
33
|
+
# Function
|
34
|
+
|
35
|
+
def self.setup_main_symbols()
|
36
|
+
symbols = [
|
37
|
+
:SDL_Init,
|
38
|
+
:SDL_InitSubSystem,
|
39
|
+
:SDL_QuitSubSystem,
|
40
|
+
:SDL_WasInit,
|
41
|
+
:SDL_Quit,
|
42
|
+
]
|
43
|
+
args = {
|
44
|
+
:SDL_Init => [:uint],
|
45
|
+
:SDL_InitSubSystem => [:uint],
|
46
|
+
:SDL_QuitSubSystem => [:uint],
|
47
|
+
:SDL_WasInit => [:uint],
|
48
|
+
:SDL_Quit => [],
|
49
|
+
}
|
50
|
+
retvals = {
|
51
|
+
:SDL_Init => :int,
|
52
|
+
:SDL_InitSubSystem => :int,
|
53
|
+
:SDL_QuitSubSystem => :void,
|
54
|
+
:SDL_WasInit => :uint,
|
55
|
+
:SDL_Quit => :void,
|
56
|
+
}
|
57
|
+
symbols.each do |sym|
|
58
|
+
begin
|
59
|
+
attach_function sym, args[sym], retvals[sym]
|
60
|
+
rescue FFI::NotFoundError => error
|
61
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
@@ -0,0 +1,96 @@
|
|
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
|
+
SDL_MESSAGEBOX_ERROR = 16
|
17
|
+
SDL_MESSAGEBOX_WARNING = 32
|
18
|
+
SDL_MESSAGEBOX_INFORMATION = 64
|
19
|
+
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 1
|
20
|
+
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 2
|
21
|
+
SDL_MESSAGEBOX_COLOR_BACKGROUND = 0
|
22
|
+
SDL_MESSAGEBOX_COLOR_TEXT = 1
|
23
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = 2
|
24
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = 3
|
25
|
+
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = 4
|
26
|
+
SDL_MESSAGEBOX_COLOR_MAX = 5
|
27
|
+
|
28
|
+
# Typedef
|
29
|
+
|
30
|
+
typedef :int, :SDL_MessageBoxFlags
|
31
|
+
typedef :int, :SDL_MessageBoxButtonFlags
|
32
|
+
typedef :int, :SDL_MessageBoxColorType
|
33
|
+
|
34
|
+
# Struct
|
35
|
+
|
36
|
+
class SDL_MessageBoxButtonData < FFI::Struct
|
37
|
+
layout(
|
38
|
+
:flags, :uint,
|
39
|
+
:buttonid, :int,
|
40
|
+
:text, :pointer,
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
class SDL_MessageBoxColor < FFI::Struct
|
45
|
+
layout(
|
46
|
+
:r, :uchar,
|
47
|
+
:g, :uchar,
|
48
|
+
:b, :uchar,
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
class SDL_MessageBoxColorScheme < FFI::Struct
|
53
|
+
layout(
|
54
|
+
:colors, [SDL_MessageBoxColor, 5],
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
class SDL_MessageBoxData < FFI::Struct
|
59
|
+
layout(
|
60
|
+
:flags, :uint,
|
61
|
+
:window, :pointer,
|
62
|
+
:title, :pointer,
|
63
|
+
:message, :pointer,
|
64
|
+
:numbuttons, :int,
|
65
|
+
:buttons, :pointer,
|
66
|
+
:colorScheme, :pointer,
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
# Function
|
72
|
+
|
73
|
+
def self.setup_messagebox_symbols()
|
74
|
+
symbols = [
|
75
|
+
:SDL_ShowMessageBox,
|
76
|
+
:SDL_ShowSimpleMessageBox,
|
77
|
+
]
|
78
|
+
args = {
|
79
|
+
:SDL_ShowMessageBox => [:pointer, :pointer],
|
80
|
+
:SDL_ShowSimpleMessageBox => [:uint, :pointer, :pointer, :pointer],
|
81
|
+
}
|
82
|
+
retvals = {
|
83
|
+
:SDL_ShowMessageBox => :int,
|
84
|
+
:SDL_ShowSimpleMessageBox => :int,
|
85
|
+
}
|
86
|
+
symbols.each do |sym|
|
87
|
+
begin
|
88
|
+
attach_function sym, args[sym], retvals[sym]
|
89
|
+
rescue FFI::NotFoundError => error
|
90
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
data/lib/sdl2_mixer.rb
ADDED
@@ -0,0 +1,304 @@
|
|
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
|
+
MIX_INIT_FLAC = 1
|
17
|
+
MIX_INIT_MOD = 2
|
18
|
+
MIX_INIT_MP3 = 8
|
19
|
+
MIX_INIT_OGG = 16
|
20
|
+
MIX_INIT_MID = 32
|
21
|
+
MIX_INIT_OPUS = 64
|
22
|
+
MIX_NO_FADING = 0
|
23
|
+
MIX_FADING_OUT = 1
|
24
|
+
MIX_FADING_IN = 2
|
25
|
+
MUS_NONE = 0
|
26
|
+
MUS_CMD = 1
|
27
|
+
MUS_WAV = 2
|
28
|
+
MUS_MOD = 3
|
29
|
+
MUS_MID = 4
|
30
|
+
MUS_OGG = 5
|
31
|
+
MUS_MP3 = 6
|
32
|
+
MUS_MP3_MAD_UNUSED = 7
|
33
|
+
MUS_FLAC = 8
|
34
|
+
MUS_MODPLUG_UNUSED = 9
|
35
|
+
MUS_OPUS = 10
|
36
|
+
|
37
|
+
# Typedef
|
38
|
+
|
39
|
+
typedef :int, :MIX_InitFlags
|
40
|
+
typedef :int, :Mix_Fading
|
41
|
+
typedef :int, :Mix_MusicType
|
42
|
+
callback :Mix_EffectFunc_t, [:int, :pointer, :int, :pointer], :void
|
43
|
+
callback :Mix_EffectDone_t, [:int, :pointer], :void
|
44
|
+
|
45
|
+
# Struct
|
46
|
+
|
47
|
+
class Mix_Chunk < FFI::Struct
|
48
|
+
layout(
|
49
|
+
:allocated, :int,
|
50
|
+
:abuf, :pointer,
|
51
|
+
:alen, :uint,
|
52
|
+
:volume, :uchar,
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
# Function
|
58
|
+
|
59
|
+
def self.setup_mixer_symbols()
|
60
|
+
symbols = [
|
61
|
+
:Mix_Linked_Version,
|
62
|
+
:Mix_Init,
|
63
|
+
:Mix_Quit,
|
64
|
+
:Mix_OpenAudio,
|
65
|
+
:Mix_OpenAudioDevice,
|
66
|
+
:Mix_AllocateChannels,
|
67
|
+
:Mix_QuerySpec,
|
68
|
+
:Mix_LoadWAV_RW,
|
69
|
+
:Mix_LoadMUS,
|
70
|
+
:Mix_LoadMUS_RW,
|
71
|
+
:Mix_LoadMUSType_RW,
|
72
|
+
:Mix_QuickLoad_WAV,
|
73
|
+
:Mix_QuickLoad_RAW,
|
74
|
+
:Mix_FreeChunk,
|
75
|
+
:Mix_FreeMusic,
|
76
|
+
:Mix_GetNumChunkDecoders,
|
77
|
+
:Mix_GetChunkDecoder,
|
78
|
+
:Mix_HasChunkDecoder,
|
79
|
+
:Mix_GetNumMusicDecoders,
|
80
|
+
:Mix_GetMusicDecoder,
|
81
|
+
:Mix_HasMusicDecoder,
|
82
|
+
:Mix_GetMusicType,
|
83
|
+
:Mix_SetPostMix,
|
84
|
+
:Mix_HookMusic,
|
85
|
+
:Mix_HookMusicFinished,
|
86
|
+
:Mix_GetMusicHookData,
|
87
|
+
:Mix_ChannelFinished,
|
88
|
+
:Mix_RegisterEffect,
|
89
|
+
:Mix_UnregisterEffect,
|
90
|
+
:Mix_UnregisterAllEffects,
|
91
|
+
:Mix_SetPanning,
|
92
|
+
:Mix_SetPosition,
|
93
|
+
:Mix_SetDistance,
|
94
|
+
:Mix_SetReverseStereo,
|
95
|
+
:Mix_ReserveChannels,
|
96
|
+
:Mix_GroupChannel,
|
97
|
+
:Mix_GroupChannels,
|
98
|
+
:Mix_GroupAvailable,
|
99
|
+
:Mix_GroupCount,
|
100
|
+
:Mix_GroupOldest,
|
101
|
+
:Mix_GroupNewer,
|
102
|
+
:Mix_PlayChannelTimed,
|
103
|
+
:Mix_PlayMusic,
|
104
|
+
:Mix_FadeInMusic,
|
105
|
+
:Mix_FadeInMusicPos,
|
106
|
+
:Mix_FadeInChannelTimed,
|
107
|
+
:Mix_Volume,
|
108
|
+
:Mix_VolumeChunk,
|
109
|
+
:Mix_VolumeMusic,
|
110
|
+
:Mix_HaltChannel,
|
111
|
+
:Mix_HaltGroup,
|
112
|
+
:Mix_HaltMusic,
|
113
|
+
:Mix_ExpireChannel,
|
114
|
+
:Mix_FadeOutChannel,
|
115
|
+
:Mix_FadeOutGroup,
|
116
|
+
:Mix_FadeOutMusic,
|
117
|
+
:Mix_FadingMusic,
|
118
|
+
:Mix_FadingChannel,
|
119
|
+
:Mix_Pause,
|
120
|
+
:Mix_Resume,
|
121
|
+
:Mix_Paused,
|
122
|
+
:Mix_PauseMusic,
|
123
|
+
:Mix_ResumeMusic,
|
124
|
+
:Mix_RewindMusic,
|
125
|
+
:Mix_PausedMusic,
|
126
|
+
:Mix_SetMusicPosition,
|
127
|
+
:Mix_Playing,
|
128
|
+
:Mix_PlayingMusic,
|
129
|
+
:Mix_SetMusicCMD,
|
130
|
+
:Mix_SetSynchroValue,
|
131
|
+
:Mix_GetSynchroValue,
|
132
|
+
:Mix_SetSoundFonts,
|
133
|
+
:Mix_GetSoundFonts,
|
134
|
+
:Mix_EachSoundFont,
|
135
|
+
:Mix_GetChunk,
|
136
|
+
:Mix_CloseAudio,
|
137
|
+
]
|
138
|
+
args = {
|
139
|
+
:Mix_Linked_Version => [],
|
140
|
+
:Mix_Init => [:int],
|
141
|
+
:Mix_Quit => [],
|
142
|
+
:Mix_OpenAudio => [:int, :ushort, :int, :int],
|
143
|
+
:Mix_OpenAudioDevice => [:int, :ushort, :int, :int, :pointer, :int],
|
144
|
+
:Mix_AllocateChannels => [:int],
|
145
|
+
:Mix_QuerySpec => [:pointer, :pointer, :pointer],
|
146
|
+
:Mix_LoadWAV_RW => [:pointer, :int],
|
147
|
+
:Mix_LoadMUS => [:pointer],
|
148
|
+
:Mix_LoadMUS_RW => [:pointer, :int],
|
149
|
+
:Mix_LoadMUSType_RW => [:pointer, :int, :int],
|
150
|
+
:Mix_QuickLoad_WAV => [:pointer],
|
151
|
+
:Mix_QuickLoad_RAW => [:pointer, :uint],
|
152
|
+
:Mix_FreeChunk => [:pointer],
|
153
|
+
:Mix_FreeMusic => [:pointer],
|
154
|
+
:Mix_GetNumChunkDecoders => [],
|
155
|
+
:Mix_GetChunkDecoder => [:int],
|
156
|
+
:Mix_HasChunkDecoder => [:pointer],
|
157
|
+
:Mix_GetNumMusicDecoders => [],
|
158
|
+
:Mix_GetMusicDecoder => [:int],
|
159
|
+
:Mix_HasMusicDecoder => [:pointer],
|
160
|
+
:Mix_GetMusicType => [:pointer],
|
161
|
+
:Mix_SetPostMix => [:pointer, :pointer],
|
162
|
+
:Mix_HookMusic => [:pointer, :pointer],
|
163
|
+
:Mix_HookMusicFinished => [:pointer],
|
164
|
+
:Mix_GetMusicHookData => [],
|
165
|
+
:Mix_ChannelFinished => [:pointer],
|
166
|
+
:Mix_RegisterEffect => [:int, :pointer, :pointer, :pointer],
|
167
|
+
:Mix_UnregisterEffect => [:int, :pointer],
|
168
|
+
:Mix_UnregisterAllEffects => [:int],
|
169
|
+
:Mix_SetPanning => [:int, :uchar, :uchar],
|
170
|
+
:Mix_SetPosition => [:int, :short, :uchar],
|
171
|
+
:Mix_SetDistance => [:int, :uchar],
|
172
|
+
:Mix_SetReverseStereo => [:int, :int],
|
173
|
+
:Mix_ReserveChannels => [:int],
|
174
|
+
:Mix_GroupChannel => [:int, :int],
|
175
|
+
:Mix_GroupChannels => [:int, :int, :int],
|
176
|
+
:Mix_GroupAvailable => [:int],
|
177
|
+
:Mix_GroupCount => [:int],
|
178
|
+
:Mix_GroupOldest => [:int],
|
179
|
+
:Mix_GroupNewer => [:int],
|
180
|
+
:Mix_PlayChannelTimed => [:int, :pointer, :int, :int],
|
181
|
+
:Mix_PlayMusic => [:pointer, :int],
|
182
|
+
:Mix_FadeInMusic => [:pointer, :int, :int],
|
183
|
+
:Mix_FadeInMusicPos => [:pointer, :int, :int, :double],
|
184
|
+
:Mix_FadeInChannelTimed => [:int, :pointer, :int, :int, :int],
|
185
|
+
:Mix_Volume => [:int, :int],
|
186
|
+
:Mix_VolumeChunk => [:pointer, :int],
|
187
|
+
:Mix_VolumeMusic => [:int],
|
188
|
+
:Mix_HaltChannel => [:int],
|
189
|
+
:Mix_HaltGroup => [:int],
|
190
|
+
:Mix_HaltMusic => [],
|
191
|
+
:Mix_ExpireChannel => [:int, :int],
|
192
|
+
:Mix_FadeOutChannel => [:int, :int],
|
193
|
+
:Mix_FadeOutGroup => [:int, :int],
|
194
|
+
:Mix_FadeOutMusic => [:int],
|
195
|
+
:Mix_FadingMusic => [],
|
196
|
+
:Mix_FadingChannel => [:int],
|
197
|
+
:Mix_Pause => [:int],
|
198
|
+
:Mix_Resume => [:int],
|
199
|
+
:Mix_Paused => [:int],
|
200
|
+
:Mix_PauseMusic => [],
|
201
|
+
:Mix_ResumeMusic => [],
|
202
|
+
:Mix_RewindMusic => [],
|
203
|
+
:Mix_PausedMusic => [],
|
204
|
+
:Mix_SetMusicPosition => [:double],
|
205
|
+
:Mix_Playing => [:int],
|
206
|
+
:Mix_PlayingMusic => [],
|
207
|
+
:Mix_SetMusicCMD => [:pointer],
|
208
|
+
:Mix_SetSynchroValue => [:int],
|
209
|
+
:Mix_GetSynchroValue => [],
|
210
|
+
:Mix_SetSoundFonts => [:pointer],
|
211
|
+
:Mix_GetSoundFonts => [],
|
212
|
+
:Mix_EachSoundFont => [:pointer, :pointer],
|
213
|
+
:Mix_GetChunk => [:int],
|
214
|
+
:Mix_CloseAudio => [],
|
215
|
+
}
|
216
|
+
retvals = {
|
217
|
+
:Mix_Linked_Version => :pointer,
|
218
|
+
:Mix_Init => :int,
|
219
|
+
:Mix_Quit => :void,
|
220
|
+
:Mix_OpenAudio => :int,
|
221
|
+
:Mix_OpenAudioDevice => :int,
|
222
|
+
:Mix_AllocateChannels => :int,
|
223
|
+
:Mix_QuerySpec => :int,
|
224
|
+
:Mix_LoadWAV_RW => :pointer,
|
225
|
+
:Mix_LoadMUS => :pointer,
|
226
|
+
:Mix_LoadMUS_RW => :pointer,
|
227
|
+
:Mix_LoadMUSType_RW => :pointer,
|
228
|
+
:Mix_QuickLoad_WAV => :pointer,
|
229
|
+
:Mix_QuickLoad_RAW => :pointer,
|
230
|
+
:Mix_FreeChunk => :void,
|
231
|
+
:Mix_FreeMusic => :void,
|
232
|
+
:Mix_GetNumChunkDecoders => :int,
|
233
|
+
:Mix_GetChunkDecoder => :pointer,
|
234
|
+
:Mix_HasChunkDecoder => :int,
|
235
|
+
:Mix_GetNumMusicDecoders => :int,
|
236
|
+
:Mix_GetMusicDecoder => :pointer,
|
237
|
+
:Mix_HasMusicDecoder => :int,
|
238
|
+
:Mix_GetMusicType => :int,
|
239
|
+
:Mix_SetPostMix => :void,
|
240
|
+
:Mix_HookMusic => :void,
|
241
|
+
:Mix_HookMusicFinished => :void,
|
242
|
+
:Mix_GetMusicHookData => :pointer,
|
243
|
+
:Mix_ChannelFinished => :void,
|
244
|
+
:Mix_RegisterEffect => :int,
|
245
|
+
:Mix_UnregisterEffect => :int,
|
246
|
+
:Mix_UnregisterAllEffects => :int,
|
247
|
+
:Mix_SetPanning => :int,
|
248
|
+
:Mix_SetPosition => :int,
|
249
|
+
:Mix_SetDistance => :int,
|
250
|
+
:Mix_SetReverseStereo => :int,
|
251
|
+
:Mix_ReserveChannels => :int,
|
252
|
+
:Mix_GroupChannel => :int,
|
253
|
+
:Mix_GroupChannels => :int,
|
254
|
+
:Mix_GroupAvailable => :int,
|
255
|
+
:Mix_GroupCount => :int,
|
256
|
+
:Mix_GroupOldest => :int,
|
257
|
+
:Mix_GroupNewer => :int,
|
258
|
+
:Mix_PlayChannelTimed => :int,
|
259
|
+
:Mix_PlayMusic => :int,
|
260
|
+
:Mix_FadeInMusic => :int,
|
261
|
+
:Mix_FadeInMusicPos => :int,
|
262
|
+
:Mix_FadeInChannelTimed => :int,
|
263
|
+
:Mix_Volume => :int,
|
264
|
+
:Mix_VolumeChunk => :int,
|
265
|
+
:Mix_VolumeMusic => :int,
|
266
|
+
:Mix_HaltChannel => :int,
|
267
|
+
:Mix_HaltGroup => :int,
|
268
|
+
:Mix_HaltMusic => :int,
|
269
|
+
:Mix_ExpireChannel => :int,
|
270
|
+
:Mix_FadeOutChannel => :int,
|
271
|
+
:Mix_FadeOutGroup => :int,
|
272
|
+
:Mix_FadeOutMusic => :int,
|
273
|
+
:Mix_FadingMusic => :int,
|
274
|
+
:Mix_FadingChannel => :int,
|
275
|
+
:Mix_Pause => :void,
|
276
|
+
:Mix_Resume => :void,
|
277
|
+
:Mix_Paused => :int,
|
278
|
+
:Mix_PauseMusic => :void,
|
279
|
+
:Mix_ResumeMusic => :void,
|
280
|
+
:Mix_RewindMusic => :void,
|
281
|
+
:Mix_PausedMusic => :int,
|
282
|
+
:Mix_SetMusicPosition => :int,
|
283
|
+
:Mix_Playing => :int,
|
284
|
+
:Mix_PlayingMusic => :int,
|
285
|
+
:Mix_SetMusicCMD => :int,
|
286
|
+
:Mix_SetSynchroValue => :int,
|
287
|
+
:Mix_GetSynchroValue => :int,
|
288
|
+
:Mix_SetSoundFonts => :int,
|
289
|
+
:Mix_GetSoundFonts => :pointer,
|
290
|
+
:Mix_EachSoundFont => :int,
|
291
|
+
:Mix_GetChunk => :pointer,
|
292
|
+
:Mix_CloseAudio => :void,
|
293
|
+
}
|
294
|
+
symbols.each do |sym|
|
295
|
+
begin
|
296
|
+
attach_function sym, args[sym], retvals[sym]
|
297
|
+
rescue FFI::NotFoundError => error
|
298
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
end
|
304
|
+
|