sdl2-bindings 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +83 -79
- data/LICENSE.txt +1 -1
- data/README.md +49 -49
- data/lib/sdl2.rb +170 -170
- data/lib/sdl2_audio.rb +219 -201
- data/lib/sdl2_blendmode.rb +69 -69
- data/lib/sdl2_clipboard.rb +51 -51
- data/lib/sdl2_cpuinfo.rb +106 -106
- data/lib/sdl2_error.rb +64 -64
- data/lib/sdl2_events.rb +530 -530
- data/lib/sdl2_filesystem.rb +48 -48
- data/lib/sdl2_framerate.rb +67 -67
- data/lib/sdl2_gamecontroller.rb +254 -254
- data/lib/sdl2_gesture.rb +55 -55
- data/lib/sdl2_gfxPrimitives.rb +222 -222
- data/lib/sdl2_haptic.rb +269 -269
- data/lib/sdl2_hints.rb +174 -174
- data/lib/sdl2_image.rb +185 -185
- data/lib/sdl2_imageFilter.rb +132 -132
- data/lib/sdl2_joystick.rb +230 -230
- data/lib/sdl2_keyboard.rb +99 -99
- data/lib/sdl2_keycode.rb +304 -304
- data/lib/sdl2_log.rb +115 -115
- data/lib/sdl2_main.rb +67 -67
- data/lib/sdl2_messagebox.rb +98 -98
- data/lib/sdl2_mixer.rb +317 -307
- data/lib/sdl2_mouse.rb +117 -117
- data/lib/sdl2_pixels.rb +224 -224
- data/lib/sdl2_platform.rb +45 -45
- data/lib/sdl2_power.rb +51 -51
- data/lib/sdl2_rect.rb +102 -102
- data/lib/sdl2_render.rb +290 -290
- data/lib/sdl2_rotozoom.rb +66 -66
- data/lib/sdl2_rwops.rb +208 -208
- data/lib/sdl2_scancode.rb +287 -287
- data/lib/sdl2_shape.rb +77 -77
- data/lib/sdl2_stdinc.rb +393 -393
- data/lib/sdl2_surface.rb +182 -182
- data/lib/sdl2_syswm.rb +154 -154
- data/lib/sdl2_timer.rb +62 -62
- data/lib/sdl2_touch.rb +73 -73
- data/lib/sdl2_ttf.rb +202 -190
- data/lib/sdl2_version.rb +62 -62
- data/lib/sdl2_video.rb +411 -411
- data/lib/sdl2_vulkan.rb +64 -64
- metadata +6 -6
data/lib/sdl2_audio.rb
CHANGED
@@ -1,201 +1,219 @@
|
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
64
|
-
:
|
65
|
-
:
|
66
|
-
:
|
67
|
-
:
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
:
|
77
|
-
:
|
78
|
-
:
|
79
|
-
:
|
80
|
-
:
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
85
|
-
:
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
:
|
95
|
-
:
|
96
|
-
:
|
97
|
-
:
|
98
|
-
:
|
99
|
-
:
|
100
|
-
:
|
101
|
-
:
|
102
|
-
:
|
103
|
-
:
|
104
|
-
:
|
105
|
-
:
|
106
|
-
:
|
107
|
-
:
|
108
|
-
:
|
109
|
-
:
|
110
|
-
:
|
111
|
-
:
|
112
|
-
|
113
|
-
|
114
|
-
:
|
115
|
-
:
|
116
|
-
:
|
117
|
-
:
|
118
|
-
:
|
119
|
-
:
|
120
|
-
:
|
121
|
-
:
|
122
|
-
:
|
123
|
-
:
|
124
|
-
:
|
125
|
-
:
|
126
|
-
:
|
127
|
-
:
|
128
|
-
:
|
129
|
-
:
|
130
|
-
|
131
|
-
|
132
|
-
:
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:
|
138
|
-
:
|
139
|
-
:
|
140
|
-
:
|
141
|
-
:
|
142
|
-
:
|
143
|
-
:
|
144
|
-
:
|
145
|
-
:
|
146
|
-
:
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
150
|
-
|
151
|
-
|
152
|
-
:
|
153
|
-
:
|
154
|
-
:
|
155
|
-
:
|
156
|
-
:
|
157
|
-
:
|
158
|
-
:
|
159
|
-
:
|
160
|
-
:
|
161
|
-
:
|
162
|
-
:
|
163
|
-
:
|
164
|
-
:
|
165
|
-
:
|
166
|
-
:
|
167
|
-
:
|
168
|
-
|
169
|
-
|
170
|
-
:
|
171
|
-
:
|
172
|
-
:
|
173
|
-
:
|
174
|
-
:
|
175
|
-
:
|
176
|
-
:
|
177
|
-
:
|
178
|
-
:
|
179
|
-
:
|
180
|
-
:
|
181
|
-
:
|
182
|
-
:
|
183
|
-
:
|
184
|
-
:
|
185
|
-
:
|
186
|
-
:
|
187
|
-
:
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
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_OpenAudioDevice,
|
103
|
+
:SDL_GetAudioStatus,
|
104
|
+
:SDL_GetAudioDeviceStatus,
|
105
|
+
:SDL_PauseAudio,
|
106
|
+
:SDL_PauseAudioDevice,
|
107
|
+
:SDL_LoadWAV_RW,
|
108
|
+
:SDL_FreeWAV,
|
109
|
+
:SDL_BuildAudioCVT,
|
110
|
+
:SDL_ConvertAudio,
|
111
|
+
:SDL_NewAudioStream,
|
112
|
+
:SDL_AudioStreamPut,
|
113
|
+
:SDL_AudioStreamGet,
|
114
|
+
:SDL_AudioStreamAvailable,
|
115
|
+
:SDL_AudioStreamFlush,
|
116
|
+
:SDL_AudioStreamClear,
|
117
|
+
:SDL_FreeAudioStream,
|
118
|
+
:SDL_MixAudio,
|
119
|
+
:SDL_MixAudioFormat,
|
120
|
+
:SDL_QueueAudio,
|
121
|
+
:SDL_DequeueAudio,
|
122
|
+
:SDL_GetQueuedAudioSize,
|
123
|
+
:SDL_ClearQueuedAudio,
|
124
|
+
:SDL_LockAudio,
|
125
|
+
:SDL_LockAudioDevice,
|
126
|
+
:SDL_UnlockAudio,
|
127
|
+
:SDL_UnlockAudioDevice,
|
128
|
+
:SDL_CloseAudio,
|
129
|
+
:SDL_CloseAudioDevice,
|
130
|
+
]
|
131
|
+
args = {
|
132
|
+
:SDL_GetNumAudioDrivers => [],
|
133
|
+
:SDL_GetAudioDriver => [:int],
|
134
|
+
:SDL_AudioInit => [:pointer],
|
135
|
+
:SDL_AudioQuit => [],
|
136
|
+
:SDL_GetCurrentAudioDriver => [],
|
137
|
+
:SDL_OpenAudio => [:pointer, :pointer],
|
138
|
+
:SDL_GetNumAudioDevices => [:int],
|
139
|
+
:SDL_GetAudioDeviceName => [:int, :int],
|
140
|
+
:SDL_OpenAudioDevice => [:pointer, :int, :pointer, :pointer, :int],
|
141
|
+
:SDL_GetAudioStatus => [],
|
142
|
+
:SDL_GetAudioDeviceStatus => [:uint],
|
143
|
+
:SDL_PauseAudio => [:int],
|
144
|
+
:SDL_PauseAudioDevice => [:uint, :int],
|
145
|
+
:SDL_LoadWAV_RW => [:pointer, :int, :pointer, :pointer, :pointer],
|
146
|
+
:SDL_FreeWAV => [:pointer],
|
147
|
+
:SDL_BuildAudioCVT => [:pointer, :ushort, :uchar, :int, :ushort, :uchar, :int],
|
148
|
+
:SDL_ConvertAudio => [:pointer],
|
149
|
+
:SDL_NewAudioStream => [:ushort, :uchar, :int, :ushort, :uchar, :int],
|
150
|
+
:SDL_AudioStreamPut => [:pointer, :pointer, :int],
|
151
|
+
:SDL_AudioStreamGet => [:pointer, :pointer, :int],
|
152
|
+
:SDL_AudioStreamAvailable => [:pointer],
|
153
|
+
:SDL_AudioStreamFlush => [:pointer],
|
154
|
+
:SDL_AudioStreamClear => [:pointer],
|
155
|
+
:SDL_FreeAudioStream => [:pointer],
|
156
|
+
:SDL_MixAudio => [:pointer, :pointer, :uint, :int],
|
157
|
+
:SDL_MixAudioFormat => [:pointer, :pointer, :ushort, :uint, :int],
|
158
|
+
:SDL_QueueAudio => [:uint, :pointer, :uint],
|
159
|
+
:SDL_DequeueAudio => [:uint, :pointer, :uint],
|
160
|
+
:SDL_GetQueuedAudioSize => [:uint],
|
161
|
+
:SDL_ClearQueuedAudio => [:uint],
|
162
|
+
:SDL_LockAudio => [],
|
163
|
+
:SDL_LockAudioDevice => [:uint],
|
164
|
+
:SDL_UnlockAudio => [],
|
165
|
+
:SDL_UnlockAudioDevice => [:uint],
|
166
|
+
:SDL_CloseAudio => [],
|
167
|
+
:SDL_CloseAudioDevice => [:uint],
|
168
|
+
}
|
169
|
+
retvals = {
|
170
|
+
:SDL_GetNumAudioDrivers => :int,
|
171
|
+
:SDL_GetAudioDriver => :pointer,
|
172
|
+
:SDL_AudioInit => :int,
|
173
|
+
:SDL_AudioQuit => :void,
|
174
|
+
:SDL_GetCurrentAudioDriver => :pointer,
|
175
|
+
:SDL_OpenAudio => :int,
|
176
|
+
:SDL_GetNumAudioDevices => :int,
|
177
|
+
:SDL_GetAudioDeviceName => :pointer,
|
178
|
+
:SDL_OpenAudioDevice => :uint,
|
179
|
+
:SDL_GetAudioStatus => :int,
|
180
|
+
:SDL_GetAudioDeviceStatus => :int,
|
181
|
+
:SDL_PauseAudio => :void,
|
182
|
+
:SDL_PauseAudioDevice => :void,
|
183
|
+
:SDL_LoadWAV_RW => :pointer,
|
184
|
+
:SDL_FreeWAV => :void,
|
185
|
+
:SDL_BuildAudioCVT => :int,
|
186
|
+
:SDL_ConvertAudio => :int,
|
187
|
+
:SDL_NewAudioStream => :pointer,
|
188
|
+
:SDL_AudioStreamPut => :int,
|
189
|
+
:SDL_AudioStreamGet => :int,
|
190
|
+
:SDL_AudioStreamAvailable => :int,
|
191
|
+
:SDL_AudioStreamFlush => :int,
|
192
|
+
:SDL_AudioStreamClear => :void,
|
193
|
+
:SDL_FreeAudioStream => :void,
|
194
|
+
:SDL_MixAudio => :void,
|
195
|
+
:SDL_MixAudioFormat => :void,
|
196
|
+
:SDL_QueueAudio => :int,
|
197
|
+
:SDL_DequeueAudio => :uint,
|
198
|
+
:SDL_GetQueuedAudioSize => :uint,
|
199
|
+
:SDL_ClearQueuedAudio => :void,
|
200
|
+
:SDL_LockAudio => :void,
|
201
|
+
:SDL_LockAudioDevice => :void,
|
202
|
+
:SDL_UnlockAudio => :void,
|
203
|
+
:SDL_UnlockAudioDevice => :void,
|
204
|
+
:SDL_CloseAudio => :void,
|
205
|
+
:SDL_CloseAudioDevice => :void,
|
206
|
+
}
|
207
|
+
symbols.each do |sym|
|
208
|
+
begin
|
209
|
+
attach_function sym, args[sym], retvals[sym]
|
210
|
+
rescue FFI::NotFoundError => error
|
211
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
217
|
+
|
218
|
+
# TODO : def SDL_LoadWAV
|
219
|
+
|
data/lib/sdl2_blendmode.rb
CHANGED
@@ -1,69 +1,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 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 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
|
+
|