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_haptic.rb
CHANGED
@@ -1,269 +1,269 @@
|
|
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_HAPTIC_CONSTANT = (1 << 0)
|
14
|
-
SDL_HAPTIC_SINE = (1 << 1)
|
15
|
-
SDL_HAPTIC_LEFTRIGHT = (1 << 2)
|
16
|
-
SDL_HAPTIC_TRIANGLE = (1 << 3)
|
17
|
-
SDL_HAPTIC_SAWTOOTHUP = (1 << 4)
|
18
|
-
SDL_HAPTIC_SAWTOOTHDOWN = (1 << 5)
|
19
|
-
SDL_HAPTIC_RAMP = (1 << 6)
|
20
|
-
SDL_HAPTIC_SPRING = (1 << 7)
|
21
|
-
SDL_HAPTIC_DAMPER = (1 << 8)
|
22
|
-
SDL_HAPTIC_INERTIA = (1 << 9)
|
23
|
-
SDL_HAPTIC_FRICTION = (1 << 10)
|
24
|
-
SDL_HAPTIC_CUSTOM = (1 << 11)
|
25
|
-
SDL_HAPTIC_GAIN = (1 << 12)
|
26
|
-
SDL_HAPTIC_AUTOCENTER = (1 << 13)
|
27
|
-
SDL_HAPTIC_STATUS = (1 << 14)
|
28
|
-
SDL_HAPTIC_PAUSE = (1 << 15)
|
29
|
-
SDL_HAPTIC_POLAR = 0
|
30
|
-
SDL_HAPTIC_CARTESIAN = 1
|
31
|
-
SDL_HAPTIC_SPHERICAL = 2
|
32
|
-
SDL_HAPTIC_STEERING_AXIS = 3
|
33
|
-
SDL_HAPTIC_INFINITY = 4294967295
|
34
|
-
|
35
|
-
# Enum
|
36
|
-
|
37
|
-
|
38
|
-
# Typedef
|
39
|
-
|
40
|
-
|
41
|
-
# Struct
|
42
|
-
|
43
|
-
class SDL_HapticDirection < FFI::Struct
|
44
|
-
layout(
|
45
|
-
:type, :uchar,
|
46
|
-
:dir, [:int, 3],
|
47
|
-
)
|
48
|
-
end
|
49
|
-
|
50
|
-
class SDL_HapticConstant < FFI::Struct
|
51
|
-
layout(
|
52
|
-
:type, :ushort,
|
53
|
-
:direction, SDL_HapticDirection,
|
54
|
-
:length, :uint,
|
55
|
-
:delay, :ushort,
|
56
|
-
:button, :ushort,
|
57
|
-
:interval, :ushort,
|
58
|
-
:level, :short,
|
59
|
-
:attack_length, :ushort,
|
60
|
-
:attack_level, :ushort,
|
61
|
-
:fade_length, :ushort,
|
62
|
-
:fade_level, :ushort,
|
63
|
-
)
|
64
|
-
end
|
65
|
-
|
66
|
-
class SDL_HapticPeriodic < FFI::Struct
|
67
|
-
layout(
|
68
|
-
:type, :ushort,
|
69
|
-
:direction, SDL_HapticDirection,
|
70
|
-
:length, :uint,
|
71
|
-
:delay, :ushort,
|
72
|
-
:button, :ushort,
|
73
|
-
:interval, :ushort,
|
74
|
-
:period, :ushort,
|
75
|
-
:magnitude, :short,
|
76
|
-
:offset, :short,
|
77
|
-
:phase, :ushort,
|
78
|
-
:attack_length, :ushort,
|
79
|
-
:attack_level, :ushort,
|
80
|
-
:fade_length, :ushort,
|
81
|
-
:fade_level, :ushort,
|
82
|
-
)
|
83
|
-
end
|
84
|
-
|
85
|
-
class SDL_HapticCondition < FFI::Struct
|
86
|
-
layout(
|
87
|
-
:type, :ushort,
|
88
|
-
:direction, SDL_HapticDirection,
|
89
|
-
:length, :uint,
|
90
|
-
:delay, :ushort,
|
91
|
-
:button, :ushort,
|
92
|
-
:interval, :ushort,
|
93
|
-
:right_sat, [:ushort, 3],
|
94
|
-
:left_sat, [:ushort, 3],
|
95
|
-
:right_coeff, [:short, 3],
|
96
|
-
:left_coeff, [:short, 3],
|
97
|
-
:deadband, [:ushort, 3],
|
98
|
-
:center, [:short, 3],
|
99
|
-
)
|
100
|
-
end
|
101
|
-
|
102
|
-
class SDL_HapticRamp < FFI::Struct
|
103
|
-
layout(
|
104
|
-
:type, :ushort,
|
105
|
-
:direction, SDL_HapticDirection,
|
106
|
-
:length, :uint,
|
107
|
-
:delay, :ushort,
|
108
|
-
:button, :ushort,
|
109
|
-
:interval, :ushort,
|
110
|
-
:start, :short,
|
111
|
-
:end, :short,
|
112
|
-
:attack_length, :ushort,
|
113
|
-
:attack_level, :ushort,
|
114
|
-
:fade_length, :ushort,
|
115
|
-
:fade_level, :ushort,
|
116
|
-
)
|
117
|
-
end
|
118
|
-
|
119
|
-
class SDL_HapticLeftRight < FFI::Struct
|
120
|
-
layout(
|
121
|
-
:type, :ushort,
|
122
|
-
:length, :uint,
|
123
|
-
:large_magnitude, :ushort,
|
124
|
-
:small_magnitude, :ushort,
|
125
|
-
)
|
126
|
-
end
|
127
|
-
|
128
|
-
class SDL_HapticCustom < FFI::Struct
|
129
|
-
layout(
|
130
|
-
:type, :ushort,
|
131
|
-
:direction, SDL_HapticDirection,
|
132
|
-
:length, :uint,
|
133
|
-
:delay, :ushort,
|
134
|
-
:button, :ushort,
|
135
|
-
:interval, :ushort,
|
136
|
-
:channels, :uchar,
|
137
|
-
:period, :ushort,
|
138
|
-
:samples, :ushort,
|
139
|
-
:data, :pointer,
|
140
|
-
:attack_length, :ushort,
|
141
|
-
:attack_level, :ushort,
|
142
|
-
:fade_length, :ushort,
|
143
|
-
:fade_level, :ushort,
|
144
|
-
)
|
145
|
-
end
|
146
|
-
|
147
|
-
class SDL_HapticEffect < FFI::Union
|
148
|
-
layout(
|
149
|
-
:type, :ushort,
|
150
|
-
:constant, SDL_HapticConstant,
|
151
|
-
:periodic, SDL_HapticPeriodic,
|
152
|
-
:condition, SDL_HapticCondition,
|
153
|
-
:ramp, SDL_HapticRamp,
|
154
|
-
:leftright, SDL_HapticLeftRight,
|
155
|
-
:custom, SDL_HapticCustom,
|
156
|
-
)
|
157
|
-
end
|
158
|
-
|
159
|
-
|
160
|
-
# Function
|
161
|
-
|
162
|
-
def self.setup_haptic_symbols()
|
163
|
-
symbols = [
|
164
|
-
:SDL_NumHaptics,
|
165
|
-
:SDL_HapticName,
|
166
|
-
:SDL_HapticOpen,
|
167
|
-
:SDL_HapticOpened,
|
168
|
-
:SDL_HapticIndex,
|
169
|
-
:SDL_MouseIsHaptic,
|
170
|
-
:SDL_HapticOpenFromMouse,
|
171
|
-
:SDL_JoystickIsHaptic,
|
172
|
-
:SDL_HapticOpenFromJoystick,
|
173
|
-
:SDL_HapticClose,
|
174
|
-
:SDL_HapticNumEffects,
|
175
|
-
:SDL_HapticNumEffectsPlaying,
|
176
|
-
:SDL_HapticQuery,
|
177
|
-
:SDL_HapticNumAxes,
|
178
|
-
:SDL_HapticEffectSupported,
|
179
|
-
:SDL_HapticNewEffect,
|
180
|
-
:SDL_HapticUpdateEffect,
|
181
|
-
:SDL_HapticRunEffect,
|
182
|
-
:SDL_HapticStopEffect,
|
183
|
-
:SDL_HapticDestroyEffect,
|
184
|
-
:SDL_HapticGetEffectStatus,
|
185
|
-
:SDL_HapticSetGain,
|
186
|
-
:SDL_HapticSetAutocenter,
|
187
|
-
:SDL_HapticPause,
|
188
|
-
:SDL_HapticUnpause,
|
189
|
-
:SDL_HapticStopAll,
|
190
|
-
:SDL_HapticRumbleSupported,
|
191
|
-
:SDL_HapticRumbleInit,
|
192
|
-
:SDL_HapticRumblePlay,
|
193
|
-
:SDL_HapticRumbleStop,
|
194
|
-
]
|
195
|
-
args = {
|
196
|
-
:SDL_NumHaptics => [],
|
197
|
-
:SDL_HapticName => [:int],
|
198
|
-
:SDL_HapticOpen => [:int],
|
199
|
-
:SDL_HapticOpened => [:int],
|
200
|
-
:SDL_HapticIndex => [:pointer],
|
201
|
-
:SDL_MouseIsHaptic => [],
|
202
|
-
:SDL_HapticOpenFromMouse => [],
|
203
|
-
:SDL_JoystickIsHaptic => [:pointer],
|
204
|
-
:SDL_HapticOpenFromJoystick => [:pointer],
|
205
|
-
:SDL_HapticClose => [:pointer],
|
206
|
-
:SDL_HapticNumEffects => [:pointer],
|
207
|
-
:SDL_HapticNumEffectsPlaying => [:pointer],
|
208
|
-
:SDL_HapticQuery => [:pointer],
|
209
|
-
:SDL_HapticNumAxes => [:pointer],
|
210
|
-
:SDL_HapticEffectSupported => [:pointer, :pointer],
|
211
|
-
:SDL_HapticNewEffect => [:pointer, :pointer],
|
212
|
-
:SDL_HapticUpdateEffect => [:pointer, :int, :pointer],
|
213
|
-
:SDL_HapticRunEffect => [:pointer, :int, :uint],
|
214
|
-
:SDL_HapticStopEffect => [:pointer, :int],
|
215
|
-
:SDL_HapticDestroyEffect => [:pointer, :int],
|
216
|
-
:SDL_HapticGetEffectStatus => [:pointer, :int],
|
217
|
-
:SDL_HapticSetGain => [:pointer, :int],
|
218
|
-
:SDL_HapticSetAutocenter => [:pointer, :int],
|
219
|
-
:SDL_HapticPause => [:pointer],
|
220
|
-
:SDL_HapticUnpause => [:pointer],
|
221
|
-
:SDL_HapticStopAll => [:pointer],
|
222
|
-
:SDL_HapticRumbleSupported => [:pointer],
|
223
|
-
:SDL_HapticRumbleInit => [:pointer],
|
224
|
-
:SDL_HapticRumblePlay => [:pointer, :float, :uint],
|
225
|
-
:SDL_HapticRumbleStop => [:pointer],
|
226
|
-
}
|
227
|
-
retvals = {
|
228
|
-
:SDL_NumHaptics => :int,
|
229
|
-
:SDL_HapticName => :pointer,
|
230
|
-
:SDL_HapticOpen => :pointer,
|
231
|
-
:SDL_HapticOpened => :int,
|
232
|
-
:SDL_HapticIndex => :int,
|
233
|
-
:SDL_MouseIsHaptic => :int,
|
234
|
-
:SDL_HapticOpenFromMouse => :pointer,
|
235
|
-
:SDL_JoystickIsHaptic => :int,
|
236
|
-
:SDL_HapticOpenFromJoystick => :pointer,
|
237
|
-
:SDL_HapticClose => :void,
|
238
|
-
:SDL_HapticNumEffects => :int,
|
239
|
-
:SDL_HapticNumEffectsPlaying => :int,
|
240
|
-
:SDL_HapticQuery => :uint,
|
241
|
-
:SDL_HapticNumAxes => :int,
|
242
|
-
:SDL_HapticEffectSupported => :int,
|
243
|
-
:SDL_HapticNewEffect => :int,
|
244
|
-
:SDL_HapticUpdateEffect => :int,
|
245
|
-
:SDL_HapticRunEffect => :int,
|
246
|
-
:SDL_HapticStopEffect => :int,
|
247
|
-
:SDL_HapticDestroyEffect => :void,
|
248
|
-
:SDL_HapticGetEffectStatus => :int,
|
249
|
-
:SDL_HapticSetGain => :int,
|
250
|
-
:SDL_HapticSetAutocenter => :int,
|
251
|
-
:SDL_HapticPause => :int,
|
252
|
-
:SDL_HapticUnpause => :int,
|
253
|
-
:SDL_HapticStopAll => :int,
|
254
|
-
:SDL_HapticRumbleSupported => :int,
|
255
|
-
:SDL_HapticRumbleInit => :int,
|
256
|
-
:SDL_HapticRumblePlay => :int,
|
257
|
-
:SDL_HapticRumbleStop => :int,
|
258
|
-
}
|
259
|
-
symbols.each do |sym|
|
260
|
-
begin
|
261
|
-
attach_function sym, args[sym], retvals[sym]
|
262
|
-
rescue FFI::NotFoundError => error
|
263
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
264
|
-
end
|
265
|
-
end
|
266
|
-
end
|
267
|
-
|
268
|
-
end
|
269
|
-
|
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_HAPTIC_CONSTANT = (1 << 0)
|
14
|
+
SDL_HAPTIC_SINE = (1 << 1)
|
15
|
+
SDL_HAPTIC_LEFTRIGHT = (1 << 2)
|
16
|
+
SDL_HAPTIC_TRIANGLE = (1 << 3)
|
17
|
+
SDL_HAPTIC_SAWTOOTHUP = (1 << 4)
|
18
|
+
SDL_HAPTIC_SAWTOOTHDOWN = (1 << 5)
|
19
|
+
SDL_HAPTIC_RAMP = (1 << 6)
|
20
|
+
SDL_HAPTIC_SPRING = (1 << 7)
|
21
|
+
SDL_HAPTIC_DAMPER = (1 << 8)
|
22
|
+
SDL_HAPTIC_INERTIA = (1 << 9)
|
23
|
+
SDL_HAPTIC_FRICTION = (1 << 10)
|
24
|
+
SDL_HAPTIC_CUSTOM = (1 << 11)
|
25
|
+
SDL_HAPTIC_GAIN = (1 << 12)
|
26
|
+
SDL_HAPTIC_AUTOCENTER = (1 << 13)
|
27
|
+
SDL_HAPTIC_STATUS = (1 << 14)
|
28
|
+
SDL_HAPTIC_PAUSE = (1 << 15)
|
29
|
+
SDL_HAPTIC_POLAR = 0
|
30
|
+
SDL_HAPTIC_CARTESIAN = 1
|
31
|
+
SDL_HAPTIC_SPHERICAL = 2
|
32
|
+
SDL_HAPTIC_STEERING_AXIS = 3
|
33
|
+
SDL_HAPTIC_INFINITY = 4294967295
|
34
|
+
|
35
|
+
# Enum
|
36
|
+
|
37
|
+
|
38
|
+
# Typedef
|
39
|
+
|
40
|
+
|
41
|
+
# Struct
|
42
|
+
|
43
|
+
class SDL_HapticDirection < FFI::Struct
|
44
|
+
layout(
|
45
|
+
:type, :uchar,
|
46
|
+
:dir, [:int, 3],
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
class SDL_HapticConstant < FFI::Struct
|
51
|
+
layout(
|
52
|
+
:type, :ushort,
|
53
|
+
:direction, SDL_HapticDirection,
|
54
|
+
:length, :uint,
|
55
|
+
:delay, :ushort,
|
56
|
+
:button, :ushort,
|
57
|
+
:interval, :ushort,
|
58
|
+
:level, :short,
|
59
|
+
:attack_length, :ushort,
|
60
|
+
:attack_level, :ushort,
|
61
|
+
:fade_length, :ushort,
|
62
|
+
:fade_level, :ushort,
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
class SDL_HapticPeriodic < FFI::Struct
|
67
|
+
layout(
|
68
|
+
:type, :ushort,
|
69
|
+
:direction, SDL_HapticDirection,
|
70
|
+
:length, :uint,
|
71
|
+
:delay, :ushort,
|
72
|
+
:button, :ushort,
|
73
|
+
:interval, :ushort,
|
74
|
+
:period, :ushort,
|
75
|
+
:magnitude, :short,
|
76
|
+
:offset, :short,
|
77
|
+
:phase, :ushort,
|
78
|
+
:attack_length, :ushort,
|
79
|
+
:attack_level, :ushort,
|
80
|
+
:fade_length, :ushort,
|
81
|
+
:fade_level, :ushort,
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
85
|
+
class SDL_HapticCondition < FFI::Struct
|
86
|
+
layout(
|
87
|
+
:type, :ushort,
|
88
|
+
:direction, SDL_HapticDirection,
|
89
|
+
:length, :uint,
|
90
|
+
:delay, :ushort,
|
91
|
+
:button, :ushort,
|
92
|
+
:interval, :ushort,
|
93
|
+
:right_sat, [:ushort, 3],
|
94
|
+
:left_sat, [:ushort, 3],
|
95
|
+
:right_coeff, [:short, 3],
|
96
|
+
:left_coeff, [:short, 3],
|
97
|
+
:deadband, [:ushort, 3],
|
98
|
+
:center, [:short, 3],
|
99
|
+
)
|
100
|
+
end
|
101
|
+
|
102
|
+
class SDL_HapticRamp < FFI::Struct
|
103
|
+
layout(
|
104
|
+
:type, :ushort,
|
105
|
+
:direction, SDL_HapticDirection,
|
106
|
+
:length, :uint,
|
107
|
+
:delay, :ushort,
|
108
|
+
:button, :ushort,
|
109
|
+
:interval, :ushort,
|
110
|
+
:start, :short,
|
111
|
+
:end, :short,
|
112
|
+
:attack_length, :ushort,
|
113
|
+
:attack_level, :ushort,
|
114
|
+
:fade_length, :ushort,
|
115
|
+
:fade_level, :ushort,
|
116
|
+
)
|
117
|
+
end
|
118
|
+
|
119
|
+
class SDL_HapticLeftRight < FFI::Struct
|
120
|
+
layout(
|
121
|
+
:type, :ushort,
|
122
|
+
:length, :uint,
|
123
|
+
:large_magnitude, :ushort,
|
124
|
+
:small_magnitude, :ushort,
|
125
|
+
)
|
126
|
+
end
|
127
|
+
|
128
|
+
class SDL_HapticCustom < FFI::Struct
|
129
|
+
layout(
|
130
|
+
:type, :ushort,
|
131
|
+
:direction, SDL_HapticDirection,
|
132
|
+
:length, :uint,
|
133
|
+
:delay, :ushort,
|
134
|
+
:button, :ushort,
|
135
|
+
:interval, :ushort,
|
136
|
+
:channels, :uchar,
|
137
|
+
:period, :ushort,
|
138
|
+
:samples, :ushort,
|
139
|
+
:data, :pointer,
|
140
|
+
:attack_length, :ushort,
|
141
|
+
:attack_level, :ushort,
|
142
|
+
:fade_length, :ushort,
|
143
|
+
:fade_level, :ushort,
|
144
|
+
)
|
145
|
+
end
|
146
|
+
|
147
|
+
class SDL_HapticEffect < FFI::Union
|
148
|
+
layout(
|
149
|
+
:type, :ushort,
|
150
|
+
:constant, SDL_HapticConstant,
|
151
|
+
:periodic, SDL_HapticPeriodic,
|
152
|
+
:condition, SDL_HapticCondition,
|
153
|
+
:ramp, SDL_HapticRamp,
|
154
|
+
:leftright, SDL_HapticLeftRight,
|
155
|
+
:custom, SDL_HapticCustom,
|
156
|
+
)
|
157
|
+
end
|
158
|
+
|
159
|
+
|
160
|
+
# Function
|
161
|
+
|
162
|
+
def self.setup_haptic_symbols()
|
163
|
+
symbols = [
|
164
|
+
:SDL_NumHaptics,
|
165
|
+
:SDL_HapticName,
|
166
|
+
:SDL_HapticOpen,
|
167
|
+
:SDL_HapticOpened,
|
168
|
+
:SDL_HapticIndex,
|
169
|
+
:SDL_MouseIsHaptic,
|
170
|
+
:SDL_HapticOpenFromMouse,
|
171
|
+
:SDL_JoystickIsHaptic,
|
172
|
+
:SDL_HapticOpenFromJoystick,
|
173
|
+
:SDL_HapticClose,
|
174
|
+
:SDL_HapticNumEffects,
|
175
|
+
:SDL_HapticNumEffectsPlaying,
|
176
|
+
:SDL_HapticQuery,
|
177
|
+
:SDL_HapticNumAxes,
|
178
|
+
:SDL_HapticEffectSupported,
|
179
|
+
:SDL_HapticNewEffect,
|
180
|
+
:SDL_HapticUpdateEffect,
|
181
|
+
:SDL_HapticRunEffect,
|
182
|
+
:SDL_HapticStopEffect,
|
183
|
+
:SDL_HapticDestroyEffect,
|
184
|
+
:SDL_HapticGetEffectStatus,
|
185
|
+
:SDL_HapticSetGain,
|
186
|
+
:SDL_HapticSetAutocenter,
|
187
|
+
:SDL_HapticPause,
|
188
|
+
:SDL_HapticUnpause,
|
189
|
+
:SDL_HapticStopAll,
|
190
|
+
:SDL_HapticRumbleSupported,
|
191
|
+
:SDL_HapticRumbleInit,
|
192
|
+
:SDL_HapticRumblePlay,
|
193
|
+
:SDL_HapticRumbleStop,
|
194
|
+
]
|
195
|
+
args = {
|
196
|
+
:SDL_NumHaptics => [],
|
197
|
+
:SDL_HapticName => [:int],
|
198
|
+
:SDL_HapticOpen => [:int],
|
199
|
+
:SDL_HapticOpened => [:int],
|
200
|
+
:SDL_HapticIndex => [:pointer],
|
201
|
+
:SDL_MouseIsHaptic => [],
|
202
|
+
:SDL_HapticOpenFromMouse => [],
|
203
|
+
:SDL_JoystickIsHaptic => [:pointer],
|
204
|
+
:SDL_HapticOpenFromJoystick => [:pointer],
|
205
|
+
:SDL_HapticClose => [:pointer],
|
206
|
+
:SDL_HapticNumEffects => [:pointer],
|
207
|
+
:SDL_HapticNumEffectsPlaying => [:pointer],
|
208
|
+
:SDL_HapticQuery => [:pointer],
|
209
|
+
:SDL_HapticNumAxes => [:pointer],
|
210
|
+
:SDL_HapticEffectSupported => [:pointer, :pointer],
|
211
|
+
:SDL_HapticNewEffect => [:pointer, :pointer],
|
212
|
+
:SDL_HapticUpdateEffect => [:pointer, :int, :pointer],
|
213
|
+
:SDL_HapticRunEffect => [:pointer, :int, :uint],
|
214
|
+
:SDL_HapticStopEffect => [:pointer, :int],
|
215
|
+
:SDL_HapticDestroyEffect => [:pointer, :int],
|
216
|
+
:SDL_HapticGetEffectStatus => [:pointer, :int],
|
217
|
+
:SDL_HapticSetGain => [:pointer, :int],
|
218
|
+
:SDL_HapticSetAutocenter => [:pointer, :int],
|
219
|
+
:SDL_HapticPause => [:pointer],
|
220
|
+
:SDL_HapticUnpause => [:pointer],
|
221
|
+
:SDL_HapticStopAll => [:pointer],
|
222
|
+
:SDL_HapticRumbleSupported => [:pointer],
|
223
|
+
:SDL_HapticRumbleInit => [:pointer],
|
224
|
+
:SDL_HapticRumblePlay => [:pointer, :float, :uint],
|
225
|
+
:SDL_HapticRumbleStop => [:pointer],
|
226
|
+
}
|
227
|
+
retvals = {
|
228
|
+
:SDL_NumHaptics => :int,
|
229
|
+
:SDL_HapticName => :pointer,
|
230
|
+
:SDL_HapticOpen => :pointer,
|
231
|
+
:SDL_HapticOpened => :int,
|
232
|
+
:SDL_HapticIndex => :int,
|
233
|
+
:SDL_MouseIsHaptic => :int,
|
234
|
+
:SDL_HapticOpenFromMouse => :pointer,
|
235
|
+
:SDL_JoystickIsHaptic => :int,
|
236
|
+
:SDL_HapticOpenFromJoystick => :pointer,
|
237
|
+
:SDL_HapticClose => :void,
|
238
|
+
:SDL_HapticNumEffects => :int,
|
239
|
+
:SDL_HapticNumEffectsPlaying => :int,
|
240
|
+
:SDL_HapticQuery => :uint,
|
241
|
+
:SDL_HapticNumAxes => :int,
|
242
|
+
:SDL_HapticEffectSupported => :int,
|
243
|
+
:SDL_HapticNewEffect => :int,
|
244
|
+
:SDL_HapticUpdateEffect => :int,
|
245
|
+
:SDL_HapticRunEffect => :int,
|
246
|
+
:SDL_HapticStopEffect => :int,
|
247
|
+
:SDL_HapticDestroyEffect => :void,
|
248
|
+
:SDL_HapticGetEffectStatus => :int,
|
249
|
+
:SDL_HapticSetGain => :int,
|
250
|
+
:SDL_HapticSetAutocenter => :int,
|
251
|
+
:SDL_HapticPause => :int,
|
252
|
+
:SDL_HapticUnpause => :int,
|
253
|
+
:SDL_HapticStopAll => :int,
|
254
|
+
:SDL_HapticRumbleSupported => :int,
|
255
|
+
:SDL_HapticRumbleInit => :int,
|
256
|
+
:SDL_HapticRumblePlay => :int,
|
257
|
+
:SDL_HapticRumbleStop => :int,
|
258
|
+
}
|
259
|
+
symbols.each do |sym|
|
260
|
+
begin
|
261
|
+
attach_function sym, args[sym], retvals[sym]
|
262
|
+
rescue FFI::NotFoundError => error
|
263
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
end
|
269
|
+
|