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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +83 -79
  3. data/LICENSE.txt +1 -1
  4. data/README.md +49 -49
  5. data/lib/sdl2.rb +170 -170
  6. data/lib/sdl2_audio.rb +219 -201
  7. data/lib/sdl2_blendmode.rb +69 -69
  8. data/lib/sdl2_clipboard.rb +51 -51
  9. data/lib/sdl2_cpuinfo.rb +106 -106
  10. data/lib/sdl2_error.rb +64 -64
  11. data/lib/sdl2_events.rb +530 -530
  12. data/lib/sdl2_filesystem.rb +48 -48
  13. data/lib/sdl2_framerate.rb +67 -67
  14. data/lib/sdl2_gamecontroller.rb +254 -254
  15. data/lib/sdl2_gesture.rb +55 -55
  16. data/lib/sdl2_gfxPrimitives.rb +222 -222
  17. data/lib/sdl2_haptic.rb +269 -269
  18. data/lib/sdl2_hints.rb +174 -174
  19. data/lib/sdl2_image.rb +185 -185
  20. data/lib/sdl2_imageFilter.rb +132 -132
  21. data/lib/sdl2_joystick.rb +230 -230
  22. data/lib/sdl2_keyboard.rb +99 -99
  23. data/lib/sdl2_keycode.rb +304 -304
  24. data/lib/sdl2_log.rb +115 -115
  25. data/lib/sdl2_main.rb +67 -67
  26. data/lib/sdl2_messagebox.rb +98 -98
  27. data/lib/sdl2_mixer.rb +317 -307
  28. data/lib/sdl2_mouse.rb +117 -117
  29. data/lib/sdl2_pixels.rb +224 -224
  30. data/lib/sdl2_platform.rb +45 -45
  31. data/lib/sdl2_power.rb +51 -51
  32. data/lib/sdl2_rect.rb +102 -102
  33. data/lib/sdl2_render.rb +290 -290
  34. data/lib/sdl2_rotozoom.rb +66 -66
  35. data/lib/sdl2_rwops.rb +208 -208
  36. data/lib/sdl2_scancode.rb +287 -287
  37. data/lib/sdl2_shape.rb +77 -77
  38. data/lib/sdl2_stdinc.rb +393 -393
  39. data/lib/sdl2_surface.rb +182 -182
  40. data/lib/sdl2_syswm.rb +154 -154
  41. data/lib/sdl2_timer.rb +62 -62
  42. data/lib/sdl2_touch.rb +73 -73
  43. data/lib/sdl2_ttf.rb +202 -190
  44. data/lib/sdl2_version.rb +62 -62
  45. data/lib/sdl2_video.rb +411 -411
  46. data/lib/sdl2_vulkan.rb +64 -64
  47. 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
- SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = 0x00000001
18
- SDL_AUDIO_ALLOW_FORMAT_CHANGE = 0x00000002
19
- SDL_AUDIO_ALLOW_CHANNELS_CHANGE = 0x00000004
20
- SDL_AUDIO_ALLOW_SAMPLES_CHANGE = 0x00000008
21
- 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)
22
- SDL_AUDIOCVT_MAX_FILTERS = 9
23
- SDL_MIX_MAXVOLUME = 128
24
-
25
- # Enum
26
-
27
- SDL_AUDIO_STOPPED = 0
28
- SDL_AUDIO_PLAYING = 1
29
- SDL_AUDIO_PAUSED = 2
30
-
31
- # Typedef
32
-
33
- typedef :ushort, :SDL_AudioFormat
34
- callback :SDL_AudioCallback, [:pointer, :pointer, :int], :void
35
- callback :SDL_AudioFilter, [:pointer, :ushort], :void
36
- typedef :uint, :SDL_AudioDeviceID
37
- typedef :int, :SDL_AudioStatus
38
-
39
- # Struct
40
-
41
- class SDL_AudioSpec < FFI::Struct
42
- layout(
43
- :freq, :int,
44
- :format, :ushort,
45
- :channels, :uchar,
46
- :silence, :uchar,
47
- :samples, :ushort,
48
- :padding, :ushort,
49
- :size, :uint,
50
- :callback, :pointer,
51
- :userdata, :pointer,
52
- )
53
- end
54
-
55
- class SDL_AudioCVT < FFI::Struct
56
- layout(
57
- :needed, :int,
58
- :src_format, :ushort,
59
- :dst_format, :ushort,
60
- :rate_incr, :double,
61
- :buf, :pointer,
62
- :len, :int,
63
- :len_cvt, :int,
64
- :len_mult, :int,
65
- :len_ratio, :double,
66
- :filters, [:pointer, 10],
67
- :filter_index, :int,
68
- )
69
- end
70
-
71
-
72
- # Function
73
-
74
- def self.setup_audio_symbols()
75
- symbols = [
76
- :SDL_GetNumAudioDrivers,
77
- :SDL_GetAudioDriver,
78
- :SDL_AudioInit,
79
- :SDL_AudioQuit,
80
- :SDL_GetCurrentAudioDriver,
81
- :SDL_OpenAudio,
82
- :SDL_GetNumAudioDevices,
83
- :SDL_GetAudioDeviceName,
84
- :SDL_OpenAudioDevice,
85
- :SDL_GetAudioStatus,
86
- :SDL_GetAudioDeviceStatus,
87
- :SDL_PauseAudio,
88
- :SDL_PauseAudioDevice,
89
- :SDL_LoadWAV_RW,
90
- :SDL_FreeWAV,
91
- :SDL_BuildAudioCVT,
92
- :SDL_ConvertAudio,
93
- :SDL_NewAudioStream,
94
- :SDL_AudioStreamPut,
95
- :SDL_AudioStreamGet,
96
- :SDL_AudioStreamAvailable,
97
- :SDL_AudioStreamFlush,
98
- :SDL_AudioStreamClear,
99
- :SDL_FreeAudioStream,
100
- :SDL_MixAudio,
101
- :SDL_MixAudioFormat,
102
- :SDL_QueueAudio,
103
- :SDL_DequeueAudio,
104
- :SDL_GetQueuedAudioSize,
105
- :SDL_ClearQueuedAudio,
106
- :SDL_LockAudio,
107
- :SDL_LockAudioDevice,
108
- :SDL_UnlockAudio,
109
- :SDL_UnlockAudioDevice,
110
- :SDL_CloseAudio,
111
- :SDL_CloseAudioDevice,
112
- ]
113
- args = {
114
- :SDL_GetNumAudioDrivers => [],
115
- :SDL_GetAudioDriver => [:int],
116
- :SDL_AudioInit => [:pointer],
117
- :SDL_AudioQuit => [],
118
- :SDL_GetCurrentAudioDriver => [],
119
- :SDL_OpenAudio => [:pointer, :pointer],
120
- :SDL_GetNumAudioDevices => [:int],
121
- :SDL_GetAudioDeviceName => [:int, :int],
122
- :SDL_OpenAudioDevice => [:pointer, :int, :pointer, :pointer, :int],
123
- :SDL_GetAudioStatus => [],
124
- :SDL_GetAudioDeviceStatus => [:uint],
125
- :SDL_PauseAudio => [:int],
126
- :SDL_PauseAudioDevice => [:uint, :int],
127
- :SDL_LoadWAV_RW => [:pointer, :int, :pointer, :pointer, :pointer],
128
- :SDL_FreeWAV => [:pointer],
129
- :SDL_BuildAudioCVT => [:pointer, :ushort, :uchar, :int, :ushort, :uchar, :int],
130
- :SDL_ConvertAudio => [:pointer],
131
- :SDL_NewAudioStream => [:ushort, :uchar, :int, :ushort, :uchar, :int],
132
- :SDL_AudioStreamPut => [:pointer, :pointer, :int],
133
- :SDL_AudioStreamGet => [:pointer, :pointer, :int],
134
- :SDL_AudioStreamAvailable => [:pointer],
135
- :SDL_AudioStreamFlush => [:pointer],
136
- :SDL_AudioStreamClear => [:pointer],
137
- :SDL_FreeAudioStream => [:pointer],
138
- :SDL_MixAudio => [:pointer, :pointer, :uint, :int],
139
- :SDL_MixAudioFormat => [:pointer, :pointer, :ushort, :uint, :int],
140
- :SDL_QueueAudio => [:uint, :pointer, :uint],
141
- :SDL_DequeueAudio => [:uint, :pointer, :uint],
142
- :SDL_GetQueuedAudioSize => [:uint],
143
- :SDL_ClearQueuedAudio => [:uint],
144
- :SDL_LockAudio => [],
145
- :SDL_LockAudioDevice => [:uint],
146
- :SDL_UnlockAudio => [],
147
- :SDL_UnlockAudioDevice => [:uint],
148
- :SDL_CloseAudio => [],
149
- :SDL_CloseAudioDevice => [:uint],
150
- }
151
- retvals = {
152
- :SDL_GetNumAudioDrivers => :int,
153
- :SDL_GetAudioDriver => :pointer,
154
- :SDL_AudioInit => :int,
155
- :SDL_AudioQuit => :void,
156
- :SDL_GetCurrentAudioDriver => :pointer,
157
- :SDL_OpenAudio => :int,
158
- :SDL_GetNumAudioDevices => :int,
159
- :SDL_GetAudioDeviceName => :pointer,
160
- :SDL_OpenAudioDevice => :uint,
161
- :SDL_GetAudioStatus => :int,
162
- :SDL_GetAudioDeviceStatus => :int,
163
- :SDL_PauseAudio => :void,
164
- :SDL_PauseAudioDevice => :void,
165
- :SDL_LoadWAV_RW => :pointer,
166
- :SDL_FreeWAV => :void,
167
- :SDL_BuildAudioCVT => :int,
168
- :SDL_ConvertAudio => :int,
169
- :SDL_NewAudioStream => :pointer,
170
- :SDL_AudioStreamPut => :int,
171
- :SDL_AudioStreamGet => :int,
172
- :SDL_AudioStreamAvailable => :int,
173
- :SDL_AudioStreamFlush => :int,
174
- :SDL_AudioStreamClear => :void,
175
- :SDL_FreeAudioStream => :void,
176
- :SDL_MixAudio => :void,
177
- :SDL_MixAudioFormat => :void,
178
- :SDL_QueueAudio => :int,
179
- :SDL_DequeueAudio => :uint,
180
- :SDL_GetQueuedAudioSize => :uint,
181
- :SDL_ClearQueuedAudio => :void,
182
- :SDL_LockAudio => :void,
183
- :SDL_LockAudioDevice => :void,
184
- :SDL_UnlockAudio => :void,
185
- :SDL_UnlockAudioDevice => :void,
186
- :SDL_CloseAudio => :void,
187
- :SDL_CloseAudioDevice => :void,
188
- }
189
- symbols.each do |sym|
190
- begin
191
- attach_function sym, args[sym], retvals[sym]
192
- rescue FFI::NotFoundError => error
193
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
194
- end
195
- end
196
- end
197
-
198
- end
199
-
200
- # TODO : def SDL_LoadWAV
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
+
@@ -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
+