sdl2-bindings 0.0.8 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +124 -92
  3. data/LICENSE.txt +1 -1
  4. data/README.md +77 -53
  5. data/lib/sdl2.rb +131 -172
  6. data/lib/sdl2_audio.rb +261 -222
  7. data/lib/sdl2_blendmode.rb +72 -69
  8. data/lib/sdl2_clipboard.rb +56 -51
  9. data/lib/sdl2_cpuinfo.rb +129 -106
  10. data/lib/sdl2_error.rb +71 -64
  11. data/lib/sdl2_events.rb +564 -533
  12. data/lib/sdl2_filesystem.rb +52 -48
  13. data/lib/sdl2_framerate.rb +74 -67
  14. data/lib/sdl2_gamecontroller.rb +329 -274
  15. data/lib/sdl2_gesture.rb +61 -55
  16. data/lib/sdl2_gfxPrimitives.rb +283 -222
  17. data/lib/sdl2_haptic.rb +301 -269
  18. data/lib/sdl2_hidapi.rb +139 -118
  19. data/lib/sdl2_hints.rb +221 -197
  20. data/lib/sdl2_image.rb +232 -185
  21. data/lib/sdl2_imageFilter.rb +164 -132
  22. data/lib/sdl2_joystick.rb +294 -239
  23. data/lib/sdl2_keyboard.rb +125 -99
  24. data/lib/sdl2_keycode.rb +307 -305
  25. data/lib/sdl2_log.rb +131 -115
  26. data/lib/sdl2_main.rb +74 -67
  27. data/lib/sdl2_messagebox.rb +102 -98
  28. data/lib/sdl2_misc.rb +48 -45
  29. data/lib/sdl2_mixer.rb +392 -317
  30. data/lib/sdl2_mouse.rb +136 -117
  31. data/lib/sdl2_pixels.rb +240 -224
  32. data/lib/sdl2_platform.rb +48 -45
  33. data/lib/sdl2_power.rb +54 -51
  34. data/lib/sdl2_rect.rb +145 -102
  35. data/lib/sdl2_render.rb +408 -322
  36. data/lib/sdl2_rotozoom.rb +76 -66
  37. data/lib/sdl2_rwops.rb +238 -208
  38. data/lib/sdl2_scancode.rb +289 -287
  39. data/lib/sdl2_sensor.rb +115 -97
  40. data/lib/sdl2_shape.rb +83 -77
  41. data/lib/sdl2_sound.rb +154 -0
  42. data/lib/sdl2_stdinc.rb +556 -439
  43. data/lib/sdl2_surface.rb +229 -188
  44. data/lib/sdl2_syswm.rb +160 -156
  45. data/lib/sdl2_timer.rb +74 -65
  46. data/lib/sdl2_touch.rb +86 -75
  47. data/lib/sdl2_ttf.rb +358 -202
  48. data/lib/sdl2_version.rb +67 -62
  49. data/lib/sdl2_video.rb +540 -446
  50. data/lib/sdl2_vulkan.rb +72 -64
  51. metadata +19 -4
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 SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
- SDL_AUDIO_MASK_BITSIZE = 0xFF
14
- SDL_AUDIO_MASK_DATATYPE = (1 << 8)
15
- SDL_AUDIO_MASK_ENDIAN = (1 << 12)
16
- SDL_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
- SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = 0x00000001
36
- SDL_AUDIO_ALLOW_FORMAT_CHANGE = 0x00000002
37
- SDL_AUDIO_ALLOW_CHANNELS_CHANGE = 0x00000004
38
- SDL_AUDIO_ALLOW_SAMPLES_CHANGE = 0x00000008
39
- SDL_AUDIO_ALLOW_ANY_CHANGE = (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_FORMAT_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE | SDL_AUDIO_ALLOW_SAMPLES_CHANGE)
40
- SDL_AUDIOCVT_MAX_FILTERS = 9
41
- SDL_MIX_MAXVOLUME = 128
42
-
43
- # Enum
44
-
45
- SDL_AUDIO_STOPPED = 0
46
- SDL_AUDIO_PLAYING = 1
47
- SDL_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 SDL_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 SDL_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()
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
- args = {
133
- :SDL_GetNumAudioDrivers => [],
134
- :SDL_GetAudioDriver => [:int],
135
- :SDL_AudioInit => [:pointer],
136
- :SDL_AudioQuit => [],
137
- :SDL_GetCurrentAudioDriver => [],
138
- :SDL_OpenAudio => [:pointer, :pointer],
139
- :SDL_GetNumAudioDevices => [:int],
140
- :SDL_GetAudioDeviceName => [:int, :int],
141
- :SDL_GetAudioDeviceSpec => [:int, :int, :pointer],
142
- :SDL_OpenAudioDevice => [:pointer, :int, :pointer, :pointer, :int],
143
- :SDL_GetAudioStatus => [],
144
- :SDL_GetAudioDeviceStatus => [:uint],
145
- :SDL_PauseAudio => [:int],
146
- :SDL_PauseAudioDevice => [:uint, :int],
147
- :SDL_LoadWAV_RW => [:pointer, :int, :pointer, :pointer, :pointer],
148
- :SDL_FreeWAV => [:pointer],
149
- :SDL_BuildAudioCVT => [:pointer, :ushort, :uchar, :int, :ushort, :uchar, :int],
150
- :SDL_ConvertAudio => [:pointer],
151
- :SDL_NewAudioStream => [:ushort, :uchar, :int, :ushort, :uchar, :int],
152
- :SDL_AudioStreamPut => [:pointer, :pointer, :int],
153
- :SDL_AudioStreamGet => [:pointer, :pointer, :int],
154
- :SDL_AudioStreamAvailable => [:pointer],
155
- :SDL_AudioStreamFlush => [:pointer],
156
- :SDL_AudioStreamClear => [:pointer],
157
- :SDL_FreeAudioStream => [:pointer],
158
- :SDL_MixAudio => [:pointer, :pointer, :uint, :int],
159
- :SDL_MixAudioFormat => [:pointer, :pointer, :ushort, :uint, :int],
160
- :SDL_QueueAudio => [:uint, :pointer, :uint],
161
- :SDL_DequeueAudio => [:uint, :pointer, :uint],
162
- :SDL_GetQueuedAudioSize => [:uint],
163
- :SDL_ClearQueuedAudio => [:uint],
164
- :SDL_LockAudio => [],
165
- :SDL_LockAudioDevice => [:uint],
166
- :SDL_UnlockAudio => [],
167
- :SDL_UnlockAudioDevice => [:uint],
168
- :SDL_CloseAudio => [],
169
- :SDL_CloseAudioDevice => [:uint],
170
- }
171
- retvals = {
172
- :SDL_GetNumAudioDrivers => :int,
173
- :SDL_GetAudioDriver => :pointer,
174
- :SDL_AudioInit => :int,
175
- :SDL_AudioQuit => :void,
176
- :SDL_GetCurrentAudioDriver => :pointer,
177
- :SDL_OpenAudio => :int,
178
- :SDL_GetNumAudioDevices => :int,
179
- :SDL_GetAudioDeviceName => :pointer,
180
- :SDL_GetAudioDeviceSpec => :int,
181
- :SDL_OpenAudioDevice => :uint,
182
- :SDL_GetAudioStatus => :int,
183
- :SDL_GetAudioDeviceStatus => :int,
184
- :SDL_PauseAudio => :void,
185
- :SDL_PauseAudioDevice => :void,
186
- :SDL_LoadWAV_RW => :pointer,
187
- :SDL_FreeWAV => :void,
188
- :SDL_BuildAudioCVT => :int,
189
- :SDL_ConvertAudio => :int,
190
- :SDL_NewAudioStream => :pointer,
191
- :SDL_AudioStreamPut => :int,
192
- :SDL_AudioStreamGet => :int,
193
- :SDL_AudioStreamAvailable => :int,
194
- :SDL_AudioStreamFlush => :int,
195
- :SDL_AudioStreamClear => :void,
196
- :SDL_FreeAudioStream => :void,
197
- :SDL_MixAudio => :void,
198
- :SDL_MixAudioFormat => :void,
199
- :SDL_QueueAudio => :int,
200
- :SDL_DequeueAudio => :uint,
201
- :SDL_GetQueuedAudioSize => :uint,
202
- :SDL_ClearQueuedAudio => :void,
203
- :SDL_LockAudio => :void,
204
- :SDL_LockAudioDevice => :void,
205
- :SDL_UnlockAudio => :void,
206
- :SDL_UnlockAudioDevice => :void,
207
- :SDL_CloseAudio => :void,
208
- :SDL_CloseAudioDevice => :void,
209
- }
210
- symbols.each do |sym|
211
- begin
212
- attach_function sym, args[sym], retvals[sym]
213
- rescue FFI::NotFoundError => error
214
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
215
- end
216
- end
217
- end
218
-
219
- end
220
-
221
- # TODO : def SDL_LoadWAV
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
+
@@ -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 SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
-
14
- # Enum
15
-
16
- SDL_BLENDMODE_NONE = 0
17
- SDL_BLENDMODE_BLEND = 1
18
- SDL_BLENDMODE_ADD = 2
19
- SDL_BLENDMODE_MOD = 4
20
- SDL_BLENDMODE_MUL = 8
21
- SDL_BLENDMODE_INVALID = 2147483647
22
- SDL_BLENDOPERATION_ADD = 1
23
- SDL_BLENDOPERATION_SUBTRACT = 2
24
- SDL_BLENDOPERATION_REV_SUBTRACT = 3
25
- SDL_BLENDOPERATION_MINIMUM = 4
26
- SDL_BLENDOPERATION_MAXIMUM = 5
27
- SDL_BLENDFACTOR_ZERO = 1
28
- SDL_BLENDFACTOR_ONE = 2
29
- SDL_BLENDFACTOR_SRC_COLOR = 3
30
- SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 4
31
- SDL_BLENDFACTOR_SRC_ALPHA = 5
32
- SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 6
33
- SDL_BLENDFACTOR_DST_COLOR = 7
34
- SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 8
35
- SDL_BLENDFACTOR_DST_ALPHA = 9
36
- SDL_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()
50
- symbols = [
51
- :SDL_ComposeCustomBlendMode,
52
- ]
53
- args = {
54
- :SDL_ComposeCustomBlendMode => [:int, :int, :int, :int, :int, :int],
55
- }
56
- retvals = {
57
- :SDL_ComposeCustomBlendMode => :int,
58
- }
59
- symbols.each do |sym|
60
- begin
61
- attach_function sym, args[sym], retvals[sym]
62
- rescue FFI::NotFoundError => error
63
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
64
- end
65
- end
66
- end
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
+