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.
- checksums.yaml +4 -4
- data/ChangeLog +134 -108
- data/LICENSE.txt +0 -0
- data/README.md +86 -68
- data/lib/sdl2.rb +131 -127
- data/lib/sdl2_audio.rb +261 -261
- data/lib/sdl2_blendmode.rb +72 -72
- data/lib/sdl2_clipboard.rb +56 -56
- data/lib/sdl2_cpuinfo.rb +129 -129
- data/lib/sdl2_error.rb +71 -71
- data/lib/sdl2_events.rb +564 -552
- data/lib/sdl2_filesystem.rb +52 -52
- data/lib/sdl2_framerate.rb +74 -74
- data/lib/sdl2_gamecontroller.rb +329 -329
- data/lib/sdl2_gesture.rb +61 -61
- data/lib/sdl2_gfxPrimitives.rb +283 -283
- data/lib/sdl2_haptic.rb +301 -301
- data/lib/sdl2_hidapi.rb +139 -139
- data/lib/sdl2_hints.rb +221 -207
- data/lib/sdl2_image.rb +296 -232
- data/lib/sdl2_imageFilter.rb +164 -164
- data/lib/sdl2_joystick.rb +294 -294
- data/lib/sdl2_keyboard.rb +125 -117
- data/lib/sdl2_keycode.rb +307 -307
- data/lib/sdl2_log.rb +131 -131
- data/lib/sdl2_main.rb +74 -74
- data/lib/sdl2_messagebox.rb +102 -102
- data/lib/sdl2_misc.rb +48 -48
- data/lib/sdl2_mixer.rb +464 -392
- data/lib/sdl2_mouse.rb +136 -136
- data/lib/sdl2_pixels.rb +240 -240
- data/lib/sdl2_platform.rb +48 -48
- data/lib/sdl2_power.rb +54 -54
- data/lib/sdl2_rect.rb +145 -109
- data/lib/sdl2_render.rb +408 -404
- data/lib/sdl2_rotozoom.rb +76 -76
- data/lib/sdl2_rwops.rb +242 -238
- data/lib/sdl2_scancode.rb +289 -289
- data/lib/sdl2_sensor.rb +115 -115
- data/lib/sdl2_shape.rb +83 -83
- data/lib/sdl2_sound.rb +154 -0
- data/lib/sdl2_stdinc.rb +548 -564
- data/lib/sdl2_surface.rb +229 -229
- data/lib/sdl2_syswm.rb +160 -160
- data/lib/sdl2_timer.rb +74 -74
- data/lib/sdl2_touch.rb +86 -82
- data/lib/sdl2_ttf.rb +414 -357
- data/lib/sdl2_version.rb +67 -67
- data/lib/sdl2_video.rb +540 -540
- data/lib/sdl2_vulkan.rb +72 -72
- metadata +3 -2
data/lib/sdl2_audio.rb
CHANGED
@@ -1,261 +1,261 @@
|
|
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
|
-
AUDIO_MASK_BITSIZE = 0xFF
|
14
|
-
AUDIO_MASK_DATATYPE = (1 << 8)
|
15
|
-
AUDIO_MASK_ENDIAN = (1 << 12)
|
16
|
-
AUDIO_MASK_SIGNED = (1 << 15)
|
17
|
-
AUDIO_U8 = 0x0008
|
18
|
-
AUDIO_S8 = 0x8008
|
19
|
-
AUDIO_U16LSB = 0x0010
|
20
|
-
AUDIO_S16LSB = 0x8010
|
21
|
-
AUDIO_U16MSB = 0x1010
|
22
|
-
AUDIO_S16MSB = 0x9010
|
23
|
-
AUDIO_U16 = AUDIO_U16LSB
|
24
|
-
AUDIO_S16 = AUDIO_S16LSB
|
25
|
-
AUDIO_S32LSB = 0x8020
|
26
|
-
AUDIO_S32MSB = 0x9020
|
27
|
-
AUDIO_S32 = AUDIO_S32LSB
|
28
|
-
AUDIO_F32LSB = 0x8120
|
29
|
-
AUDIO_F32MSB = 0x9120
|
30
|
-
AUDIO_F32 = AUDIO_F32LSB
|
31
|
-
AUDIO_U16SYS = AUDIO_U16LSB
|
32
|
-
AUDIO_S16SYS = AUDIO_S16LSB
|
33
|
-
AUDIO_S32SYS = AUDIO_S32LSB
|
34
|
-
AUDIO_F32SYS = AUDIO_F32LSB
|
35
|
-
AUDIO_ALLOW_FREQUENCY_CHANGE = 0x00000001
|
36
|
-
AUDIO_ALLOW_FORMAT_CHANGE = 0x00000002
|
37
|
-
AUDIO_ALLOW_CHANNELS_CHANGE = 0x00000004
|
38
|
-
AUDIO_ALLOW_SAMPLES_CHANGE = 0x00000008
|
39
|
-
AUDIO_ALLOW_ANY_CHANGE = (AUDIO_ALLOW_FREQUENCY_CHANGE | AUDIO_ALLOW_FORMAT_CHANGE | AUDIO_ALLOW_CHANNELS_CHANGE | AUDIO_ALLOW_SAMPLES_CHANGE)
|
40
|
-
AUDIOCVT_MAX_FILTERS = 9
|
41
|
-
MIX_MAXVOLUME = 128
|
42
|
-
|
43
|
-
# Enum
|
44
|
-
|
45
|
-
AUDIO_STOPPED = 0
|
46
|
-
AUDIO_PLAYING = 1
|
47
|
-
AUDIO_PAUSED = 2
|
48
|
-
|
49
|
-
# Typedef
|
50
|
-
|
51
|
-
typedef :ushort, :SDL_AudioFormat
|
52
|
-
callback :SDL_AudioCallback, [:pointer, :pointer, :int], :void
|
53
|
-
callback :SDL_AudioFilter, [:pointer, :ushort], :void
|
54
|
-
typedef :uint, :SDL_AudioDeviceID
|
55
|
-
typedef :int, :SDL_AudioStatus
|
56
|
-
|
57
|
-
# Struct
|
58
|
-
|
59
|
-
class AudioSpec < FFI::Struct
|
60
|
-
layout(
|
61
|
-
:freq, :int,
|
62
|
-
:format, :ushort,
|
63
|
-
:channels, :uchar,
|
64
|
-
:silence, :uchar,
|
65
|
-
:samples, :ushort,
|
66
|
-
:padding, :ushort,
|
67
|
-
:size, :uint,
|
68
|
-
:callback, :pointer,
|
69
|
-
:userdata, :pointer,
|
70
|
-
)
|
71
|
-
end
|
72
|
-
|
73
|
-
class AudioCVT < FFI::Struct
|
74
|
-
layout(
|
75
|
-
:needed, :int,
|
76
|
-
:src_format, :ushort,
|
77
|
-
:dst_format, :ushort,
|
78
|
-
:rate_incr, :double,
|
79
|
-
:buf, :pointer,
|
80
|
-
:len, :int,
|
81
|
-
:len_cvt, :int,
|
82
|
-
:len_mult, :int,
|
83
|
-
:len_ratio, :double,
|
84
|
-
:filters, [:pointer, 10],
|
85
|
-
:filter_index, :int,
|
86
|
-
)
|
87
|
-
end
|
88
|
-
|
89
|
-
|
90
|
-
# Function
|
91
|
-
|
92
|
-
def self.setup_audio_symbols(output_error = false)
|
93
|
-
symbols = [
|
94
|
-
:SDL_GetNumAudioDrivers,
|
95
|
-
:SDL_GetAudioDriver,
|
96
|
-
:SDL_AudioInit,
|
97
|
-
:SDL_AudioQuit,
|
98
|
-
:SDL_GetCurrentAudioDriver,
|
99
|
-
:SDL_OpenAudio,
|
100
|
-
:SDL_GetNumAudioDevices,
|
101
|
-
:SDL_GetAudioDeviceName,
|
102
|
-
:SDL_GetAudioDeviceSpec,
|
103
|
-
:SDL_OpenAudioDevice,
|
104
|
-
:SDL_GetAudioStatus,
|
105
|
-
:SDL_GetAudioDeviceStatus,
|
106
|
-
:SDL_PauseAudio,
|
107
|
-
:SDL_PauseAudioDevice,
|
108
|
-
:SDL_LoadWAV_RW,
|
109
|
-
:SDL_FreeWAV,
|
110
|
-
:SDL_BuildAudioCVT,
|
111
|
-
:SDL_ConvertAudio,
|
112
|
-
:SDL_NewAudioStream,
|
113
|
-
:SDL_AudioStreamPut,
|
114
|
-
:SDL_AudioStreamGet,
|
115
|
-
:SDL_AudioStreamAvailable,
|
116
|
-
:SDL_AudioStreamFlush,
|
117
|
-
:SDL_AudioStreamClear,
|
118
|
-
:SDL_FreeAudioStream,
|
119
|
-
:SDL_MixAudio,
|
120
|
-
:SDL_MixAudioFormat,
|
121
|
-
:SDL_QueueAudio,
|
122
|
-
:SDL_DequeueAudio,
|
123
|
-
:SDL_GetQueuedAudioSize,
|
124
|
-
:SDL_ClearQueuedAudio,
|
125
|
-
:SDL_LockAudio,
|
126
|
-
:SDL_LockAudioDevice,
|
127
|
-
:SDL_UnlockAudio,
|
128
|
-
:SDL_UnlockAudioDevice,
|
129
|
-
:SDL_CloseAudio,
|
130
|
-
:SDL_CloseAudioDevice,
|
131
|
-
]
|
132
|
-
apis = {
|
133
|
-
:SDL_GetNumAudioDrivers => :GetNumAudioDrivers,
|
134
|
-
:SDL_GetAudioDriver => :GetAudioDriver,
|
135
|
-
:SDL_AudioInit => :AudioInit,
|
136
|
-
:SDL_AudioQuit => :AudioQuit,
|
137
|
-
:SDL_GetCurrentAudioDriver => :GetCurrentAudioDriver,
|
138
|
-
:SDL_OpenAudio => :OpenAudio,
|
139
|
-
:SDL_GetNumAudioDevices => :GetNumAudioDevices,
|
140
|
-
:SDL_GetAudioDeviceName => :GetAudioDeviceName,
|
141
|
-
:SDL_GetAudioDeviceSpec => :GetAudioDeviceSpec,
|
142
|
-
:SDL_OpenAudioDevice => :OpenAudioDevice,
|
143
|
-
:SDL_GetAudioStatus => :GetAudioStatus,
|
144
|
-
:SDL_GetAudioDeviceStatus => :GetAudioDeviceStatus,
|
145
|
-
:SDL_PauseAudio => :PauseAudio,
|
146
|
-
:SDL_PauseAudioDevice => :PauseAudioDevice,
|
147
|
-
:SDL_LoadWAV_RW => :LoadWAV_RW,
|
148
|
-
:SDL_FreeWAV => :FreeWAV,
|
149
|
-
:SDL_BuildAudioCVT => :BuildAudioCVT,
|
150
|
-
:SDL_ConvertAudio => :ConvertAudio,
|
151
|
-
:SDL_NewAudioStream => :NewAudioStream,
|
152
|
-
:SDL_AudioStreamPut => :AudioStreamPut,
|
153
|
-
:SDL_AudioStreamGet => :AudioStreamGet,
|
154
|
-
:SDL_AudioStreamAvailable => :AudioStreamAvailable,
|
155
|
-
:SDL_AudioStreamFlush => :AudioStreamFlush,
|
156
|
-
:SDL_AudioStreamClear => :AudioStreamClear,
|
157
|
-
:SDL_FreeAudioStream => :FreeAudioStream,
|
158
|
-
:SDL_MixAudio => :MixAudio,
|
159
|
-
:SDL_MixAudioFormat => :MixAudioFormat,
|
160
|
-
:SDL_QueueAudio => :QueueAudio,
|
161
|
-
:SDL_DequeueAudio => :DequeueAudio,
|
162
|
-
:SDL_GetQueuedAudioSize => :GetQueuedAudioSize,
|
163
|
-
:SDL_ClearQueuedAudio => :ClearQueuedAudio,
|
164
|
-
:SDL_LockAudio => :LockAudio,
|
165
|
-
:SDL_LockAudioDevice => :LockAudioDevice,
|
166
|
-
:SDL_UnlockAudio => :UnlockAudio,
|
167
|
-
:SDL_UnlockAudioDevice => :UnlockAudioDevice,
|
168
|
-
:SDL_CloseAudio => :CloseAudio,
|
169
|
-
:SDL_CloseAudioDevice => :CloseAudioDevice,
|
170
|
-
}
|
171
|
-
args = {
|
172
|
-
:SDL_GetNumAudioDrivers => [],
|
173
|
-
:SDL_GetAudioDriver => [:int],
|
174
|
-
:SDL_AudioInit => [:pointer],
|
175
|
-
:SDL_AudioQuit => [],
|
176
|
-
:SDL_GetCurrentAudioDriver => [],
|
177
|
-
:SDL_OpenAudio => [:pointer, :pointer],
|
178
|
-
:SDL_GetNumAudioDevices => [:int],
|
179
|
-
:SDL_GetAudioDeviceName => [:int, :int],
|
180
|
-
:SDL_GetAudioDeviceSpec => [:int, :int, :pointer],
|
181
|
-
:SDL_OpenAudioDevice => [:pointer, :int, :pointer, :pointer, :int],
|
182
|
-
:SDL_GetAudioStatus => [],
|
183
|
-
:SDL_GetAudioDeviceStatus => [:uint],
|
184
|
-
:SDL_PauseAudio => [:int],
|
185
|
-
:SDL_PauseAudioDevice => [:uint, :int],
|
186
|
-
:SDL_LoadWAV_RW => [:pointer, :int, :pointer, :pointer, :pointer],
|
187
|
-
:SDL_FreeWAV => [:pointer],
|
188
|
-
:SDL_BuildAudioCVT => [:pointer, :ushort, :uchar, :int, :ushort, :uchar, :int],
|
189
|
-
:SDL_ConvertAudio => [:pointer],
|
190
|
-
:SDL_NewAudioStream => [:ushort, :uchar, :int, :ushort, :uchar, :int],
|
191
|
-
:SDL_AudioStreamPut => [:pointer, :pointer, :int],
|
192
|
-
:SDL_AudioStreamGet => [:pointer, :pointer, :int],
|
193
|
-
:SDL_AudioStreamAvailable => [:pointer],
|
194
|
-
:SDL_AudioStreamFlush => [:pointer],
|
195
|
-
:SDL_AudioStreamClear => [:pointer],
|
196
|
-
:SDL_FreeAudioStream => [:pointer],
|
197
|
-
:SDL_MixAudio => [:pointer, :pointer, :uint, :int],
|
198
|
-
:SDL_MixAudioFormat => [:pointer, :pointer, :ushort, :uint, :int],
|
199
|
-
:SDL_QueueAudio => [:uint, :pointer, :uint],
|
200
|
-
:SDL_DequeueAudio => [:uint, :pointer, :uint],
|
201
|
-
:SDL_GetQueuedAudioSize => [:uint],
|
202
|
-
:SDL_ClearQueuedAudio => [:uint],
|
203
|
-
:SDL_LockAudio => [],
|
204
|
-
:SDL_LockAudioDevice => [:uint],
|
205
|
-
:SDL_UnlockAudio => [],
|
206
|
-
:SDL_UnlockAudioDevice => [:uint],
|
207
|
-
:SDL_CloseAudio => [],
|
208
|
-
:SDL_CloseAudioDevice => [:uint],
|
209
|
-
}
|
210
|
-
retvals = {
|
211
|
-
:SDL_GetNumAudioDrivers => :int,
|
212
|
-
:SDL_GetAudioDriver => :pointer,
|
213
|
-
:SDL_AudioInit => :int,
|
214
|
-
:SDL_AudioQuit => :void,
|
215
|
-
:SDL_GetCurrentAudioDriver => :pointer,
|
216
|
-
:SDL_OpenAudio => :int,
|
217
|
-
:SDL_GetNumAudioDevices => :int,
|
218
|
-
:SDL_GetAudioDeviceName => :pointer,
|
219
|
-
:SDL_GetAudioDeviceSpec => :int,
|
220
|
-
:SDL_OpenAudioDevice => :uint,
|
221
|
-
:SDL_GetAudioStatus => :int,
|
222
|
-
:SDL_GetAudioDeviceStatus => :int,
|
223
|
-
:SDL_PauseAudio => :void,
|
224
|
-
:SDL_PauseAudioDevice => :void,
|
225
|
-
:SDL_LoadWAV_RW => :pointer,
|
226
|
-
:SDL_FreeWAV => :void,
|
227
|
-
:SDL_BuildAudioCVT => :int,
|
228
|
-
:SDL_ConvertAudio => :int,
|
229
|
-
:SDL_NewAudioStream => :pointer,
|
230
|
-
:SDL_AudioStreamPut => :int,
|
231
|
-
:SDL_AudioStreamGet => :int,
|
232
|
-
:SDL_AudioStreamAvailable => :int,
|
233
|
-
:SDL_AudioStreamFlush => :int,
|
234
|
-
:SDL_AudioStreamClear => :void,
|
235
|
-
:SDL_FreeAudioStream => :void,
|
236
|
-
:SDL_MixAudio => :void,
|
237
|
-
:SDL_MixAudioFormat => :void,
|
238
|
-
:SDL_QueueAudio => :int,
|
239
|
-
:SDL_DequeueAudio => :uint,
|
240
|
-
:SDL_GetQueuedAudioSize => :uint,
|
241
|
-
:SDL_ClearQueuedAudio => :void,
|
242
|
-
:SDL_LockAudio => :void,
|
243
|
-
:SDL_LockAudioDevice => :void,
|
244
|
-
:SDL_UnlockAudio => :void,
|
245
|
-
:SDL_UnlockAudioDevice => :void,
|
246
|
-
:SDL_CloseAudio => :void,
|
247
|
-
:SDL_CloseAudioDevice => :void,
|
248
|
-
}
|
249
|
-
symbols.each do |sym|
|
250
|
-
begin
|
251
|
-
attach_function apis[sym], sym, args[sym], retvals[sym]
|
252
|
-
rescue FFI::NotFoundError => error
|
253
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
254
|
-
end
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
end
|
259
|
-
|
260
|
-
# TODO : def SDL_LoadWAV
|
261
|
-
|
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
|
+
AUDIO_MASK_BITSIZE = 0xFF
|
14
|
+
AUDIO_MASK_DATATYPE = (1 << 8)
|
15
|
+
AUDIO_MASK_ENDIAN = (1 << 12)
|
16
|
+
AUDIO_MASK_SIGNED = (1 << 15)
|
17
|
+
AUDIO_U8 = 0x0008
|
18
|
+
AUDIO_S8 = 0x8008
|
19
|
+
AUDIO_U16LSB = 0x0010
|
20
|
+
AUDIO_S16LSB = 0x8010
|
21
|
+
AUDIO_U16MSB = 0x1010
|
22
|
+
AUDIO_S16MSB = 0x9010
|
23
|
+
AUDIO_U16 = AUDIO_U16LSB
|
24
|
+
AUDIO_S16 = AUDIO_S16LSB
|
25
|
+
AUDIO_S32LSB = 0x8020
|
26
|
+
AUDIO_S32MSB = 0x9020
|
27
|
+
AUDIO_S32 = AUDIO_S32LSB
|
28
|
+
AUDIO_F32LSB = 0x8120
|
29
|
+
AUDIO_F32MSB = 0x9120
|
30
|
+
AUDIO_F32 = AUDIO_F32LSB
|
31
|
+
AUDIO_U16SYS = AUDIO_U16LSB
|
32
|
+
AUDIO_S16SYS = AUDIO_S16LSB
|
33
|
+
AUDIO_S32SYS = AUDIO_S32LSB
|
34
|
+
AUDIO_F32SYS = AUDIO_F32LSB
|
35
|
+
AUDIO_ALLOW_FREQUENCY_CHANGE = 0x00000001
|
36
|
+
AUDIO_ALLOW_FORMAT_CHANGE = 0x00000002
|
37
|
+
AUDIO_ALLOW_CHANNELS_CHANGE = 0x00000004
|
38
|
+
AUDIO_ALLOW_SAMPLES_CHANGE = 0x00000008
|
39
|
+
AUDIO_ALLOW_ANY_CHANGE = (AUDIO_ALLOW_FREQUENCY_CHANGE | AUDIO_ALLOW_FORMAT_CHANGE | AUDIO_ALLOW_CHANNELS_CHANGE | AUDIO_ALLOW_SAMPLES_CHANGE)
|
40
|
+
AUDIOCVT_MAX_FILTERS = 9
|
41
|
+
MIX_MAXVOLUME = 128
|
42
|
+
|
43
|
+
# Enum
|
44
|
+
|
45
|
+
AUDIO_STOPPED = 0
|
46
|
+
AUDIO_PLAYING = 1
|
47
|
+
AUDIO_PAUSED = 2
|
48
|
+
|
49
|
+
# Typedef
|
50
|
+
|
51
|
+
typedef :ushort, :SDL_AudioFormat
|
52
|
+
callback :SDL_AudioCallback, [:pointer, :pointer, :int], :void
|
53
|
+
callback :SDL_AudioFilter, [:pointer, :ushort], :void
|
54
|
+
typedef :uint, :SDL_AudioDeviceID
|
55
|
+
typedef :int, :SDL_AudioStatus
|
56
|
+
|
57
|
+
# Struct
|
58
|
+
|
59
|
+
class AudioSpec < FFI::Struct
|
60
|
+
layout(
|
61
|
+
:freq, :int,
|
62
|
+
:format, :ushort,
|
63
|
+
:channels, :uchar,
|
64
|
+
:silence, :uchar,
|
65
|
+
:samples, :ushort,
|
66
|
+
:padding, :ushort,
|
67
|
+
:size, :uint,
|
68
|
+
:callback, :pointer,
|
69
|
+
:userdata, :pointer,
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
class AudioCVT < FFI::Struct
|
74
|
+
layout(
|
75
|
+
:needed, :int,
|
76
|
+
:src_format, :ushort,
|
77
|
+
:dst_format, :ushort,
|
78
|
+
:rate_incr, :double,
|
79
|
+
:buf, :pointer,
|
80
|
+
:len, :int,
|
81
|
+
:len_cvt, :int,
|
82
|
+
:len_mult, :int,
|
83
|
+
:len_ratio, :double,
|
84
|
+
:filters, [:pointer, 10],
|
85
|
+
:filter_index, :int,
|
86
|
+
)
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
# Function
|
91
|
+
|
92
|
+
def self.setup_audio_symbols(output_error = false)
|
93
|
+
symbols = [
|
94
|
+
:SDL_GetNumAudioDrivers,
|
95
|
+
:SDL_GetAudioDriver,
|
96
|
+
:SDL_AudioInit,
|
97
|
+
:SDL_AudioQuit,
|
98
|
+
:SDL_GetCurrentAudioDriver,
|
99
|
+
:SDL_OpenAudio,
|
100
|
+
:SDL_GetNumAudioDevices,
|
101
|
+
:SDL_GetAudioDeviceName,
|
102
|
+
:SDL_GetAudioDeviceSpec,
|
103
|
+
:SDL_OpenAudioDevice,
|
104
|
+
:SDL_GetAudioStatus,
|
105
|
+
:SDL_GetAudioDeviceStatus,
|
106
|
+
:SDL_PauseAudio,
|
107
|
+
:SDL_PauseAudioDevice,
|
108
|
+
:SDL_LoadWAV_RW,
|
109
|
+
:SDL_FreeWAV,
|
110
|
+
:SDL_BuildAudioCVT,
|
111
|
+
:SDL_ConvertAudio,
|
112
|
+
:SDL_NewAudioStream,
|
113
|
+
:SDL_AudioStreamPut,
|
114
|
+
:SDL_AudioStreamGet,
|
115
|
+
:SDL_AudioStreamAvailable,
|
116
|
+
:SDL_AudioStreamFlush,
|
117
|
+
:SDL_AudioStreamClear,
|
118
|
+
:SDL_FreeAudioStream,
|
119
|
+
:SDL_MixAudio,
|
120
|
+
:SDL_MixAudioFormat,
|
121
|
+
:SDL_QueueAudio,
|
122
|
+
:SDL_DequeueAudio,
|
123
|
+
:SDL_GetQueuedAudioSize,
|
124
|
+
:SDL_ClearQueuedAudio,
|
125
|
+
:SDL_LockAudio,
|
126
|
+
:SDL_LockAudioDevice,
|
127
|
+
:SDL_UnlockAudio,
|
128
|
+
:SDL_UnlockAudioDevice,
|
129
|
+
:SDL_CloseAudio,
|
130
|
+
:SDL_CloseAudioDevice,
|
131
|
+
]
|
132
|
+
apis = {
|
133
|
+
:SDL_GetNumAudioDrivers => :GetNumAudioDrivers,
|
134
|
+
:SDL_GetAudioDriver => :GetAudioDriver,
|
135
|
+
:SDL_AudioInit => :AudioInit,
|
136
|
+
:SDL_AudioQuit => :AudioQuit,
|
137
|
+
:SDL_GetCurrentAudioDriver => :GetCurrentAudioDriver,
|
138
|
+
:SDL_OpenAudio => :OpenAudio,
|
139
|
+
:SDL_GetNumAudioDevices => :GetNumAudioDevices,
|
140
|
+
:SDL_GetAudioDeviceName => :GetAudioDeviceName,
|
141
|
+
:SDL_GetAudioDeviceSpec => :GetAudioDeviceSpec,
|
142
|
+
:SDL_OpenAudioDevice => :OpenAudioDevice,
|
143
|
+
:SDL_GetAudioStatus => :GetAudioStatus,
|
144
|
+
:SDL_GetAudioDeviceStatus => :GetAudioDeviceStatus,
|
145
|
+
:SDL_PauseAudio => :PauseAudio,
|
146
|
+
:SDL_PauseAudioDevice => :PauseAudioDevice,
|
147
|
+
:SDL_LoadWAV_RW => :LoadWAV_RW,
|
148
|
+
:SDL_FreeWAV => :FreeWAV,
|
149
|
+
:SDL_BuildAudioCVT => :BuildAudioCVT,
|
150
|
+
:SDL_ConvertAudio => :ConvertAudio,
|
151
|
+
:SDL_NewAudioStream => :NewAudioStream,
|
152
|
+
:SDL_AudioStreamPut => :AudioStreamPut,
|
153
|
+
:SDL_AudioStreamGet => :AudioStreamGet,
|
154
|
+
:SDL_AudioStreamAvailable => :AudioStreamAvailable,
|
155
|
+
:SDL_AudioStreamFlush => :AudioStreamFlush,
|
156
|
+
:SDL_AudioStreamClear => :AudioStreamClear,
|
157
|
+
:SDL_FreeAudioStream => :FreeAudioStream,
|
158
|
+
:SDL_MixAudio => :MixAudio,
|
159
|
+
:SDL_MixAudioFormat => :MixAudioFormat,
|
160
|
+
:SDL_QueueAudio => :QueueAudio,
|
161
|
+
:SDL_DequeueAudio => :DequeueAudio,
|
162
|
+
:SDL_GetQueuedAudioSize => :GetQueuedAudioSize,
|
163
|
+
:SDL_ClearQueuedAudio => :ClearQueuedAudio,
|
164
|
+
:SDL_LockAudio => :LockAudio,
|
165
|
+
:SDL_LockAudioDevice => :LockAudioDevice,
|
166
|
+
:SDL_UnlockAudio => :UnlockAudio,
|
167
|
+
:SDL_UnlockAudioDevice => :UnlockAudioDevice,
|
168
|
+
:SDL_CloseAudio => :CloseAudio,
|
169
|
+
:SDL_CloseAudioDevice => :CloseAudioDevice,
|
170
|
+
}
|
171
|
+
args = {
|
172
|
+
:SDL_GetNumAudioDrivers => [],
|
173
|
+
:SDL_GetAudioDriver => [:int],
|
174
|
+
:SDL_AudioInit => [:pointer],
|
175
|
+
:SDL_AudioQuit => [],
|
176
|
+
:SDL_GetCurrentAudioDriver => [],
|
177
|
+
:SDL_OpenAudio => [:pointer, :pointer],
|
178
|
+
:SDL_GetNumAudioDevices => [:int],
|
179
|
+
:SDL_GetAudioDeviceName => [:int, :int],
|
180
|
+
:SDL_GetAudioDeviceSpec => [:int, :int, :pointer],
|
181
|
+
:SDL_OpenAudioDevice => [:pointer, :int, :pointer, :pointer, :int],
|
182
|
+
:SDL_GetAudioStatus => [],
|
183
|
+
:SDL_GetAudioDeviceStatus => [:uint],
|
184
|
+
:SDL_PauseAudio => [:int],
|
185
|
+
:SDL_PauseAudioDevice => [:uint, :int],
|
186
|
+
:SDL_LoadWAV_RW => [:pointer, :int, :pointer, :pointer, :pointer],
|
187
|
+
:SDL_FreeWAV => [:pointer],
|
188
|
+
:SDL_BuildAudioCVT => [:pointer, :ushort, :uchar, :int, :ushort, :uchar, :int],
|
189
|
+
:SDL_ConvertAudio => [:pointer],
|
190
|
+
:SDL_NewAudioStream => [:ushort, :uchar, :int, :ushort, :uchar, :int],
|
191
|
+
:SDL_AudioStreamPut => [:pointer, :pointer, :int],
|
192
|
+
:SDL_AudioStreamGet => [:pointer, :pointer, :int],
|
193
|
+
:SDL_AudioStreamAvailable => [:pointer],
|
194
|
+
:SDL_AudioStreamFlush => [:pointer],
|
195
|
+
:SDL_AudioStreamClear => [:pointer],
|
196
|
+
:SDL_FreeAudioStream => [:pointer],
|
197
|
+
:SDL_MixAudio => [:pointer, :pointer, :uint, :int],
|
198
|
+
:SDL_MixAudioFormat => [:pointer, :pointer, :ushort, :uint, :int],
|
199
|
+
:SDL_QueueAudio => [:uint, :pointer, :uint],
|
200
|
+
:SDL_DequeueAudio => [:uint, :pointer, :uint],
|
201
|
+
:SDL_GetQueuedAudioSize => [:uint],
|
202
|
+
:SDL_ClearQueuedAudio => [:uint],
|
203
|
+
:SDL_LockAudio => [],
|
204
|
+
:SDL_LockAudioDevice => [:uint],
|
205
|
+
:SDL_UnlockAudio => [],
|
206
|
+
:SDL_UnlockAudioDevice => [:uint],
|
207
|
+
:SDL_CloseAudio => [],
|
208
|
+
:SDL_CloseAudioDevice => [:uint],
|
209
|
+
}
|
210
|
+
retvals = {
|
211
|
+
:SDL_GetNumAudioDrivers => :int,
|
212
|
+
:SDL_GetAudioDriver => :pointer,
|
213
|
+
:SDL_AudioInit => :int,
|
214
|
+
:SDL_AudioQuit => :void,
|
215
|
+
:SDL_GetCurrentAudioDriver => :pointer,
|
216
|
+
:SDL_OpenAudio => :int,
|
217
|
+
:SDL_GetNumAudioDevices => :int,
|
218
|
+
:SDL_GetAudioDeviceName => :pointer,
|
219
|
+
:SDL_GetAudioDeviceSpec => :int,
|
220
|
+
:SDL_OpenAudioDevice => :uint,
|
221
|
+
:SDL_GetAudioStatus => :int,
|
222
|
+
:SDL_GetAudioDeviceStatus => :int,
|
223
|
+
:SDL_PauseAudio => :void,
|
224
|
+
:SDL_PauseAudioDevice => :void,
|
225
|
+
:SDL_LoadWAV_RW => :pointer,
|
226
|
+
:SDL_FreeWAV => :void,
|
227
|
+
:SDL_BuildAudioCVT => :int,
|
228
|
+
:SDL_ConvertAudio => :int,
|
229
|
+
:SDL_NewAudioStream => :pointer,
|
230
|
+
:SDL_AudioStreamPut => :int,
|
231
|
+
:SDL_AudioStreamGet => :int,
|
232
|
+
:SDL_AudioStreamAvailable => :int,
|
233
|
+
:SDL_AudioStreamFlush => :int,
|
234
|
+
:SDL_AudioStreamClear => :void,
|
235
|
+
:SDL_FreeAudioStream => :void,
|
236
|
+
:SDL_MixAudio => :void,
|
237
|
+
:SDL_MixAudioFormat => :void,
|
238
|
+
:SDL_QueueAudio => :int,
|
239
|
+
:SDL_DequeueAudio => :uint,
|
240
|
+
:SDL_GetQueuedAudioSize => :uint,
|
241
|
+
:SDL_ClearQueuedAudio => :void,
|
242
|
+
:SDL_LockAudio => :void,
|
243
|
+
:SDL_LockAudioDevice => :void,
|
244
|
+
:SDL_UnlockAudio => :void,
|
245
|
+
:SDL_UnlockAudioDevice => :void,
|
246
|
+
:SDL_CloseAudio => :void,
|
247
|
+
:SDL_CloseAudioDevice => :void,
|
248
|
+
}
|
249
|
+
symbols.each do |sym|
|
250
|
+
begin
|
251
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
252
|
+
rescue FFI::NotFoundError => error
|
253
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
259
|
+
|
260
|
+
# TODO : def SDL_LoadWAV
|
261
|
+
|
data/lib/sdl2_blendmode.rb
CHANGED
@@ -1,72 +1,72 @@
|
|
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
|
-
BLENDMODE_NONE = 0
|
17
|
-
BLENDMODE_BLEND = 1
|
18
|
-
BLENDMODE_ADD = 2
|
19
|
-
BLENDMODE_MOD = 4
|
20
|
-
BLENDMODE_MUL = 8
|
21
|
-
BLENDMODE_INVALID = 2147483647
|
22
|
-
BLENDOPERATION_ADD = 1
|
23
|
-
BLENDOPERATION_SUBTRACT = 2
|
24
|
-
BLENDOPERATION_REV_SUBTRACT = 3
|
25
|
-
BLENDOPERATION_MINIMUM = 4
|
26
|
-
BLENDOPERATION_MAXIMUM = 5
|
27
|
-
BLENDFACTOR_ZERO = 1
|
28
|
-
BLENDFACTOR_ONE = 2
|
29
|
-
BLENDFACTOR_SRC_COLOR = 3
|
30
|
-
BLENDFACTOR_ONE_MINUS_SRC_COLOR = 4
|
31
|
-
BLENDFACTOR_SRC_ALPHA = 5
|
32
|
-
BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 6
|
33
|
-
BLENDFACTOR_DST_COLOR = 7
|
34
|
-
BLENDFACTOR_ONE_MINUS_DST_COLOR = 8
|
35
|
-
BLENDFACTOR_DST_ALPHA = 9
|
36
|
-
BLENDFACTOR_ONE_MINUS_DST_ALPHA = 10
|
37
|
-
|
38
|
-
# Typedef
|
39
|
-
|
40
|
-
typedef :int, :SDL_BlendMode
|
41
|
-
typedef :int, :SDL_BlendOperation
|
42
|
-
typedef :int, :SDL_BlendFactor
|
43
|
-
|
44
|
-
# Struct
|
45
|
-
|
46
|
-
|
47
|
-
# Function
|
48
|
-
|
49
|
-
def self.setup_blendmode_symbols(output_error = false)
|
50
|
-
symbols = [
|
51
|
-
:SDL_ComposeCustomBlendMode,
|
52
|
-
]
|
53
|
-
apis = {
|
54
|
-
:SDL_ComposeCustomBlendMode => :ComposeCustomBlendMode,
|
55
|
-
}
|
56
|
-
args = {
|
57
|
-
:SDL_ComposeCustomBlendMode => [:int, :int, :int, :int, :int, :int],
|
58
|
-
}
|
59
|
-
retvals = {
|
60
|
-
:SDL_ComposeCustomBlendMode => :int,
|
61
|
-
}
|
62
|
-
symbols.each do |sym|
|
63
|
-
begin
|
64
|
-
attach_function apis[sym], sym, args[sym], retvals[sym]
|
65
|
-
rescue FFI::NotFoundError => error
|
66
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
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
|
+
BLENDMODE_NONE = 0
|
17
|
+
BLENDMODE_BLEND = 1
|
18
|
+
BLENDMODE_ADD = 2
|
19
|
+
BLENDMODE_MOD = 4
|
20
|
+
BLENDMODE_MUL = 8
|
21
|
+
BLENDMODE_INVALID = 2147483647
|
22
|
+
BLENDOPERATION_ADD = 1
|
23
|
+
BLENDOPERATION_SUBTRACT = 2
|
24
|
+
BLENDOPERATION_REV_SUBTRACT = 3
|
25
|
+
BLENDOPERATION_MINIMUM = 4
|
26
|
+
BLENDOPERATION_MAXIMUM = 5
|
27
|
+
BLENDFACTOR_ZERO = 1
|
28
|
+
BLENDFACTOR_ONE = 2
|
29
|
+
BLENDFACTOR_SRC_COLOR = 3
|
30
|
+
BLENDFACTOR_ONE_MINUS_SRC_COLOR = 4
|
31
|
+
BLENDFACTOR_SRC_ALPHA = 5
|
32
|
+
BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 6
|
33
|
+
BLENDFACTOR_DST_COLOR = 7
|
34
|
+
BLENDFACTOR_ONE_MINUS_DST_COLOR = 8
|
35
|
+
BLENDFACTOR_DST_ALPHA = 9
|
36
|
+
BLENDFACTOR_ONE_MINUS_DST_ALPHA = 10
|
37
|
+
|
38
|
+
# Typedef
|
39
|
+
|
40
|
+
typedef :int, :SDL_BlendMode
|
41
|
+
typedef :int, :SDL_BlendOperation
|
42
|
+
typedef :int, :SDL_BlendFactor
|
43
|
+
|
44
|
+
# Struct
|
45
|
+
|
46
|
+
|
47
|
+
# Function
|
48
|
+
|
49
|
+
def self.setup_blendmode_symbols(output_error = false)
|
50
|
+
symbols = [
|
51
|
+
:SDL_ComposeCustomBlendMode,
|
52
|
+
]
|
53
|
+
apis = {
|
54
|
+
:SDL_ComposeCustomBlendMode => :ComposeCustomBlendMode,
|
55
|
+
}
|
56
|
+
args = {
|
57
|
+
:SDL_ComposeCustomBlendMode => [:int, :int, :int, :int, :int, :int],
|
58
|
+
}
|
59
|
+
retvals = {
|
60
|
+
:SDL_ComposeCustomBlendMode => :int,
|
61
|
+
}
|
62
|
+
symbols.each do |sym|
|
63
|
+
begin
|
64
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
65
|
+
rescue FFI::NotFoundError => error
|
66
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|