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_audio.rb
CHANGED
@@ -1,222 +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
|
10
|
-
extend FFI::Library
|
11
|
-
# Define/Macro
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
# Enum
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
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
|
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()
|
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
|
-
|
133
|
-
:SDL_GetNumAudioDrivers =>
|
134
|
-
:SDL_GetAudioDriver =>
|
135
|
-
:SDL_AudioInit =>
|
136
|
-
:SDL_AudioQuit =>
|
137
|
-
:SDL_GetCurrentAudioDriver =>
|
138
|
-
:SDL_OpenAudio =>
|
139
|
-
:SDL_GetNumAudioDevices =>
|
140
|
-
:SDL_GetAudioDeviceName =>
|
141
|
-
:SDL_GetAudioDeviceSpec =>
|
142
|
-
:SDL_OpenAudioDevice =>
|
143
|
-
:SDL_GetAudioStatus =>
|
144
|
-
:SDL_GetAudioDeviceStatus =>
|
145
|
-
:SDL_PauseAudio =>
|
146
|
-
:SDL_PauseAudioDevice =>
|
147
|
-
:SDL_LoadWAV_RW =>
|
148
|
-
:SDL_FreeWAV =>
|
149
|
-
:SDL_BuildAudioCVT =>
|
150
|
-
:SDL_ConvertAudio =>
|
151
|
-
:SDL_NewAudioStream =>
|
152
|
-
:SDL_AudioStreamPut =>
|
153
|
-
:SDL_AudioStreamGet =>
|
154
|
-
:SDL_AudioStreamAvailable =>
|
155
|
-
:SDL_AudioStreamFlush =>
|
156
|
-
:SDL_AudioStreamClear =>
|
157
|
-
:SDL_FreeAudioStream =>
|
158
|
-
:SDL_MixAudio =>
|
159
|
-
:SDL_MixAudioFormat =>
|
160
|
-
:SDL_QueueAudio =>
|
161
|
-
:SDL_DequeueAudio =>
|
162
|
-
:SDL_GetQueuedAudioSize =>
|
163
|
-
:SDL_ClearQueuedAudio =>
|
164
|
-
:SDL_LockAudio =>
|
165
|
-
:SDL_LockAudioDevice =>
|
166
|
-
:SDL_UnlockAudio =>
|
167
|
-
:SDL_UnlockAudioDevice =>
|
168
|
-
:SDL_CloseAudio =>
|
169
|
-
:SDL_CloseAudioDevice =>
|
170
|
-
}
|
171
|
-
|
172
|
-
:SDL_GetNumAudioDrivers =>
|
173
|
-
:SDL_GetAudioDriver => :
|
174
|
-
:SDL_AudioInit => :
|
175
|
-
:SDL_AudioQuit =>
|
176
|
-
:SDL_GetCurrentAudioDriver =>
|
177
|
-
:SDL_OpenAudio => :
|
178
|
-
:SDL_GetNumAudioDevices => :int,
|
179
|
-
:SDL_GetAudioDeviceName => :
|
180
|
-
:SDL_GetAudioDeviceSpec => :int,
|
181
|
-
:SDL_OpenAudioDevice => :
|
182
|
-
:SDL_GetAudioStatus =>
|
183
|
-
:SDL_GetAudioDeviceStatus => :
|
184
|
-
:SDL_PauseAudio => :
|
185
|
-
:SDL_PauseAudioDevice => :
|
186
|
-
:SDL_LoadWAV_RW => :pointer,
|
187
|
-
:SDL_FreeWAV => :
|
188
|
-
:SDL_BuildAudioCVT => :int,
|
189
|
-
:SDL_ConvertAudio => :
|
190
|
-
:SDL_NewAudioStream => :
|
191
|
-
:SDL_AudioStreamPut => :int,
|
192
|
-
:SDL_AudioStreamGet => :int,
|
193
|
-
:SDL_AudioStreamAvailable => :
|
194
|
-
:SDL_AudioStreamFlush => :
|
195
|
-
:SDL_AudioStreamClear => :
|
196
|
-
:SDL_FreeAudioStream => :
|
197
|
-
:SDL_MixAudio => :
|
198
|
-
:SDL_MixAudioFormat => :
|
199
|
-
:SDL_QueueAudio => :
|
200
|
-
:SDL_DequeueAudio => :uint,
|
201
|
-
:SDL_GetQueuedAudioSize => :uint,
|
202
|
-
:SDL_ClearQueuedAudio => :
|
203
|
-
:SDL_LockAudio =>
|
204
|
-
:SDL_LockAudioDevice => :
|
205
|
-
:SDL_UnlockAudio =>
|
206
|
-
:SDL_UnlockAudioDevice => :
|
207
|
-
:SDL_CloseAudio =>
|
208
|
-
:SDL_CloseAudioDevice => :
|
209
|
-
}
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
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,69 +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
|
10
|
-
extend FFI::Library
|
11
|
-
# Define/Macro
|
12
|
-
|
13
|
-
|
14
|
-
# Enum
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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()
|
50
|
-
symbols = [
|
51
|
-
:SDL_ComposeCustomBlendMode,
|
52
|
-
]
|
53
|
-
|
54
|
-
:SDL_ComposeCustomBlendMode =>
|
55
|
-
}
|
56
|
-
|
57
|
-
:SDL_ComposeCustomBlendMode => :int,
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
end
|
69
|
-
|
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
|
+
|