sdl2-bindings 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +145 -134
- data/LICENSE.txt +0 -0
- data/README.md +108 -86
- data/lib/sdl2.rb +131 -131
- data/lib/sdl2_audio.rb +265 -261
- data/lib/sdl2_blendmode.rb +72 -72
- data/lib/sdl2_clipboard.rb +56 -56
- data/lib/sdl2_cpuinfo.rb +137 -129
- data/lib/sdl2_error.rb +71 -71
- data/lib/sdl2_events.rb +575 -564
- data/lib/sdl2_filesystem.rb +52 -52
- data/lib/sdl2_framerate.rb +74 -74
- data/lib/sdl2_gamecontroller.rb +345 -329
- data/lib/sdl2_gesture.rb +61 -61
- data/lib/sdl2_gfxPrimitives.rb +283 -283
- data/lib/sdl2_guid.rb +58 -0
- data/lib/sdl2_haptic.rb +301 -301
- data/lib/sdl2_hidapi.rb +139 -139
- data/lib/sdl2_hints.rb +240 -221
- data/lib/sdl2_image.rb +296 -296
- data/lib/sdl2_imageFilter.rb +164 -164
- data/lib/sdl2_joystick.rb +332 -294
- data/lib/sdl2_keyboard.rb +129 -125
- data/lib/sdl2_keycode.rb +311 -307
- data/lib/sdl2_log.rb +131 -131
- data/lib/sdl2_main.rb +74 -74
- data/lib/sdl2_messagebox.rb +102 -102
- data/lib/sdl2_misc.rb +48 -48
- data/lib/sdl2_mixer.rb +464 -464
- data/lib/sdl2_mouse.rb +136 -136
- data/lib/sdl2_pixels.rb +240 -240
- data/lib/sdl2_platform.rb +48 -48
- data/lib/sdl2_power.rb +54 -54
- data/lib/sdl2_rect.rb +145 -145
- data/lib/sdl2_render.rb +408 -408
- data/lib/sdl2_rotozoom.rb +76 -76
- data/lib/sdl2_rwops.rb +242 -242
- data/lib/sdl2_scancode.rb +293 -289
- data/lib/sdl2_sensor.rb +115 -115
- data/lib/sdl2_shape.rb +83 -83
- data/lib/sdl2_sound.rb +154 -154
- data/lib/sdl2_stdinc.rb +572 -548
- data/lib/sdl2_surface.rb +229 -229
- data/lib/sdl2_syswm.rb +160 -160
- data/lib/sdl2_timer.rb +74 -74
- data/lib/sdl2_touch.rb +86 -86
- data/lib/sdl2_ttf.rb +414 -414
- data/lib/sdl2_version.rb +67 -67
- data/lib/sdl2_video.rb +549 -540
- data/lib/sdl2_vulkan.rb +72 -72
- metadata +4 -3
data/lib/sdl2_gamecontroller.rb
CHANGED
@@ -1,329 +1,345 @@
|
|
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
|
-
require_relative 'sdl2_joystick'
|
9
|
-
|
10
|
-
module SDL
|
11
|
-
extend FFI::Library
|
12
|
-
# Define/Macro
|
13
|
-
|
14
|
-
|
15
|
-
# Enum
|
16
|
-
|
17
|
-
CONTROLLER_TYPE_UNKNOWN = 0
|
18
|
-
CONTROLLER_TYPE_XBOX360 = 1
|
19
|
-
CONTROLLER_TYPE_XBOXONE = 2
|
20
|
-
CONTROLLER_TYPE_PS3 = 3
|
21
|
-
CONTROLLER_TYPE_PS4 = 4
|
22
|
-
CONTROLLER_TYPE_NINTENDO_SWITCH_PRO = 5
|
23
|
-
CONTROLLER_TYPE_VIRTUAL = 6
|
24
|
-
CONTROLLER_TYPE_PS5 = 7
|
25
|
-
CONTROLLER_TYPE_AMAZON_LUNA = 8
|
26
|
-
CONTROLLER_TYPE_GOOGLE_STADIA = 9
|
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
|
-
:
|
202
|
-
:
|
203
|
-
:
|
204
|
-
:
|
205
|
-
:
|
206
|
-
:
|
207
|
-
:
|
208
|
-
|
209
|
-
|
210
|
-
:
|
211
|
-
:
|
212
|
-
:
|
213
|
-
:
|
214
|
-
:
|
215
|
-
:
|
216
|
-
:
|
217
|
-
:
|
218
|
-
|
219
|
-
|
220
|
-
:
|
221
|
-
:
|
222
|
-
:
|
223
|
-
:
|
224
|
-
:
|
225
|
-
:
|
226
|
-
:
|
227
|
-
:
|
228
|
-
:
|
229
|
-
:
|
230
|
-
:
|
231
|
-
:
|
232
|
-
:
|
233
|
-
:
|
234
|
-
:
|
235
|
-
:
|
236
|
-
:
|
237
|
-
:
|
238
|
-
:
|
239
|
-
:
|
240
|
-
:
|
241
|
-
:
|
242
|
-
:
|
243
|
-
:
|
244
|
-
:
|
245
|
-
:
|
246
|
-
:
|
247
|
-
:
|
248
|
-
:
|
249
|
-
:
|
250
|
-
:
|
251
|
-
:
|
252
|
-
:
|
253
|
-
:
|
254
|
-
:
|
255
|
-
:
|
256
|
-
:
|
257
|
-
:
|
258
|
-
:
|
259
|
-
:
|
260
|
-
:
|
261
|
-
:
|
262
|
-
:
|
263
|
-
|
264
|
-
|
265
|
-
:
|
266
|
-
:
|
267
|
-
:
|
268
|
-
:
|
269
|
-
:
|
270
|
-
:
|
271
|
-
:
|
272
|
-
:
|
273
|
-
:
|
274
|
-
:
|
275
|
-
:
|
276
|
-
|
277
|
-
|
278
|
-
:
|
279
|
-
:
|
280
|
-
:
|
281
|
-
:
|
282
|
-
:
|
283
|
-
:
|
284
|
-
:
|
285
|
-
:
|
286
|
-
:
|
287
|
-
:
|
288
|
-
:
|
289
|
-
:
|
290
|
-
:
|
291
|
-
:
|
292
|
-
:
|
293
|
-
:
|
294
|
-
:
|
295
|
-
:
|
296
|
-
:
|
297
|
-
:
|
298
|
-
:
|
299
|
-
:
|
300
|
-
:
|
301
|
-
:
|
302
|
-
:
|
303
|
-
:
|
304
|
-
:
|
305
|
-
:
|
306
|
-
:
|
307
|
-
:
|
308
|
-
:
|
309
|
-
:
|
310
|
-
:
|
311
|
-
:
|
312
|
-
:
|
313
|
-
:
|
314
|
-
:
|
315
|
-
:
|
316
|
-
:
|
317
|
-
:
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
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
|
+
require_relative 'sdl2_joystick'
|
9
|
+
|
10
|
+
module SDL
|
11
|
+
extend FFI::Library
|
12
|
+
# Define/Macro
|
13
|
+
|
14
|
+
|
15
|
+
# Enum
|
16
|
+
|
17
|
+
CONTROLLER_TYPE_UNKNOWN = 0
|
18
|
+
CONTROLLER_TYPE_XBOX360 = 1
|
19
|
+
CONTROLLER_TYPE_XBOXONE = 2
|
20
|
+
CONTROLLER_TYPE_PS3 = 3
|
21
|
+
CONTROLLER_TYPE_PS4 = 4
|
22
|
+
CONTROLLER_TYPE_NINTENDO_SWITCH_PRO = 5
|
23
|
+
CONTROLLER_TYPE_VIRTUAL = 6
|
24
|
+
CONTROLLER_TYPE_PS5 = 7
|
25
|
+
CONTROLLER_TYPE_AMAZON_LUNA = 8
|
26
|
+
CONTROLLER_TYPE_GOOGLE_STADIA = 9
|
27
|
+
CONTROLLER_TYPE_NVIDIA_SHIELD = 10
|
28
|
+
CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT = 11
|
29
|
+
CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT = 12
|
30
|
+
CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR = 13
|
31
|
+
CONTROLLER_BINDTYPE_NONE = 0
|
32
|
+
CONTROLLER_BINDTYPE_BUTTON = 1
|
33
|
+
CONTROLLER_BINDTYPE_AXIS = 2
|
34
|
+
CONTROLLER_BINDTYPE_HAT = 3
|
35
|
+
CONTROLLER_AXIS_INVALID = -1
|
36
|
+
CONTROLLER_AXIS_LEFTX = 0
|
37
|
+
CONTROLLER_AXIS_LEFTY = 1
|
38
|
+
CONTROLLER_AXIS_RIGHTX = 2
|
39
|
+
CONTROLLER_AXIS_RIGHTY = 3
|
40
|
+
CONTROLLER_AXIS_TRIGGERLEFT = 4
|
41
|
+
CONTROLLER_AXIS_TRIGGERRIGHT = 5
|
42
|
+
CONTROLLER_AXIS_MAX = 6
|
43
|
+
CONTROLLER_BUTTON_INVALID = -1
|
44
|
+
CONTROLLER_BUTTON_A = 0
|
45
|
+
CONTROLLER_BUTTON_B = 1
|
46
|
+
CONTROLLER_BUTTON_X = 2
|
47
|
+
CONTROLLER_BUTTON_Y = 3
|
48
|
+
CONTROLLER_BUTTON_BACK = 4
|
49
|
+
CONTROLLER_BUTTON_GUIDE = 5
|
50
|
+
CONTROLLER_BUTTON_START = 6
|
51
|
+
CONTROLLER_BUTTON_LEFTSTICK = 7
|
52
|
+
CONTROLLER_BUTTON_RIGHTSTICK = 8
|
53
|
+
CONTROLLER_BUTTON_LEFTSHOULDER = 9
|
54
|
+
CONTROLLER_BUTTON_RIGHTSHOULDER = 10
|
55
|
+
CONTROLLER_BUTTON_DPAD_UP = 11
|
56
|
+
CONTROLLER_BUTTON_DPAD_DOWN = 12
|
57
|
+
CONTROLLER_BUTTON_DPAD_LEFT = 13
|
58
|
+
CONTROLLER_BUTTON_DPAD_RIGHT = 14
|
59
|
+
CONTROLLER_BUTTON_MISC1 = 15
|
60
|
+
CONTROLLER_BUTTON_PADDLE1 = 16
|
61
|
+
CONTROLLER_BUTTON_PADDLE2 = 17
|
62
|
+
CONTROLLER_BUTTON_PADDLE3 = 18
|
63
|
+
CONTROLLER_BUTTON_PADDLE4 = 19
|
64
|
+
CONTROLLER_BUTTON_TOUCHPAD = 20
|
65
|
+
CONTROLLER_BUTTON_MAX = 21
|
66
|
+
|
67
|
+
# Typedef
|
68
|
+
|
69
|
+
|
70
|
+
class GameControllerButtonBind_value_hat < FFI::Struct
|
71
|
+
layout(
|
72
|
+
:hat, :int,
|
73
|
+
:hat_mask, :int,
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
class GameControllerButtonBind_value < FFI::Struct
|
78
|
+
layout(
|
79
|
+
:button, :int,
|
80
|
+
:axis, :int,
|
81
|
+
:hat, GameControllerButtonBind_value_hat,
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
85
|
+
class GameControllerButtonBind < FFI::Struct
|
86
|
+
layout(
|
87
|
+
:bindType, :int,
|
88
|
+
:value, GameControllerButtonBind_value,
|
89
|
+
)
|
90
|
+
end
|
91
|
+
|
92
|
+
typedef :int, :SDL_GameControllerType
|
93
|
+
typedef :int, :SDL_GameControllerBindType
|
94
|
+
typedef :int, :SDL_GameControllerAxis
|
95
|
+
typedef :int, :SDL_GameControllerButton
|
96
|
+
|
97
|
+
# Struct
|
98
|
+
|
99
|
+
|
100
|
+
# Function
|
101
|
+
|
102
|
+
def self.setup_gamecontroller_symbols(output_error = false)
|
103
|
+
symbols = [
|
104
|
+
:SDL_GameControllerAddMappingsFromRW,
|
105
|
+
:SDL_GameControllerAddMapping,
|
106
|
+
:SDL_GameControllerNumMappings,
|
107
|
+
:SDL_GameControllerMappingForIndex,
|
108
|
+
:SDL_GameControllerMappingForGUID,
|
109
|
+
:SDL_GameControllerMapping,
|
110
|
+
:SDL_IsGameController,
|
111
|
+
:SDL_GameControllerNameForIndex,
|
112
|
+
:SDL_GameControllerPathForIndex,
|
113
|
+
:SDL_GameControllerTypeForIndex,
|
114
|
+
:SDL_GameControllerMappingForDeviceIndex,
|
115
|
+
:SDL_GameControllerOpen,
|
116
|
+
:SDL_GameControllerFromInstanceID,
|
117
|
+
:SDL_GameControllerFromPlayerIndex,
|
118
|
+
:SDL_GameControllerName,
|
119
|
+
:SDL_GameControllerPath,
|
120
|
+
:SDL_GameControllerGetType,
|
121
|
+
:SDL_GameControllerGetPlayerIndex,
|
122
|
+
:SDL_GameControllerSetPlayerIndex,
|
123
|
+
:SDL_GameControllerGetVendor,
|
124
|
+
:SDL_GameControllerGetProduct,
|
125
|
+
:SDL_GameControllerGetProductVersion,
|
126
|
+
:SDL_GameControllerGetFirmwareVersion,
|
127
|
+
:SDL_GameControllerGetSerial,
|
128
|
+
:SDL_GameControllerGetAttached,
|
129
|
+
:SDL_GameControllerGetJoystick,
|
130
|
+
:SDL_GameControllerEventState,
|
131
|
+
:SDL_GameControllerUpdate,
|
132
|
+
:SDL_GameControllerGetAxisFromString,
|
133
|
+
:SDL_GameControllerGetStringForAxis,
|
134
|
+
:SDL_GameControllerGetBindForAxis,
|
135
|
+
:SDL_GameControllerHasAxis,
|
136
|
+
:SDL_GameControllerGetAxis,
|
137
|
+
:SDL_GameControllerGetButtonFromString,
|
138
|
+
:SDL_GameControllerGetStringForButton,
|
139
|
+
:SDL_GameControllerGetBindForButton,
|
140
|
+
:SDL_GameControllerHasButton,
|
141
|
+
:SDL_GameControllerGetButton,
|
142
|
+
:SDL_GameControllerGetNumTouchpads,
|
143
|
+
:SDL_GameControllerGetNumTouchpadFingers,
|
144
|
+
:SDL_GameControllerGetTouchpadFinger,
|
145
|
+
:SDL_GameControllerHasSensor,
|
146
|
+
:SDL_GameControllerSetSensorEnabled,
|
147
|
+
:SDL_GameControllerIsSensorEnabled,
|
148
|
+
:SDL_GameControllerGetSensorDataRate,
|
149
|
+
:SDL_GameControllerGetSensorData,
|
150
|
+
:SDL_GameControllerRumble,
|
151
|
+
:SDL_GameControllerRumbleTriggers,
|
152
|
+
:SDL_GameControllerHasLED,
|
153
|
+
:SDL_GameControllerHasRumble,
|
154
|
+
:SDL_GameControllerHasRumbleTriggers,
|
155
|
+
:SDL_GameControllerSetLED,
|
156
|
+
:SDL_GameControllerSendEffect,
|
157
|
+
:SDL_GameControllerClose,
|
158
|
+
:SDL_GameControllerGetAppleSFSymbolsNameForButton,
|
159
|
+
:SDL_GameControllerGetAppleSFSymbolsNameForAxis,
|
160
|
+
]
|
161
|
+
apis = {
|
162
|
+
:SDL_GameControllerAddMappingsFromRW => :GameControllerAddMappingsFromRW,
|
163
|
+
:SDL_GameControllerAddMapping => :GameControllerAddMapping,
|
164
|
+
:SDL_GameControllerNumMappings => :GameControllerNumMappings,
|
165
|
+
:SDL_GameControllerMappingForIndex => :GameControllerMappingForIndex,
|
166
|
+
:SDL_GameControllerMappingForGUID => :GameControllerMappingForGUID,
|
167
|
+
:SDL_GameControllerMapping => :GameControllerMapping,
|
168
|
+
:SDL_IsGameController => :IsGameController,
|
169
|
+
:SDL_GameControllerNameForIndex => :GameControllerNameForIndex,
|
170
|
+
:SDL_GameControllerPathForIndex => :GameControllerPathForIndex,
|
171
|
+
:SDL_GameControllerTypeForIndex => :GameControllerTypeForIndex,
|
172
|
+
:SDL_GameControllerMappingForDeviceIndex => :GameControllerMappingForDeviceIndex,
|
173
|
+
:SDL_GameControllerOpen => :GameControllerOpen,
|
174
|
+
:SDL_GameControllerFromInstanceID => :GameControllerFromInstanceID,
|
175
|
+
:SDL_GameControllerFromPlayerIndex => :GameControllerFromPlayerIndex,
|
176
|
+
:SDL_GameControllerName => :GameControllerName,
|
177
|
+
:SDL_GameControllerPath => :GameControllerPath,
|
178
|
+
:SDL_GameControllerGetType => :GameControllerGetType,
|
179
|
+
:SDL_GameControllerGetPlayerIndex => :GameControllerGetPlayerIndex,
|
180
|
+
:SDL_GameControllerSetPlayerIndex => :GameControllerSetPlayerIndex,
|
181
|
+
:SDL_GameControllerGetVendor => :GameControllerGetVendor,
|
182
|
+
:SDL_GameControllerGetProduct => :GameControllerGetProduct,
|
183
|
+
:SDL_GameControllerGetProductVersion => :GameControllerGetProductVersion,
|
184
|
+
:SDL_GameControllerGetFirmwareVersion => :GameControllerGetFirmwareVersion,
|
185
|
+
:SDL_GameControllerGetSerial => :GameControllerGetSerial,
|
186
|
+
:SDL_GameControllerGetAttached => :GameControllerGetAttached,
|
187
|
+
:SDL_GameControllerGetJoystick => :GameControllerGetJoystick,
|
188
|
+
:SDL_GameControllerEventState => :GameControllerEventState,
|
189
|
+
:SDL_GameControllerUpdate => :GameControllerUpdate,
|
190
|
+
:SDL_GameControllerGetAxisFromString => :GameControllerGetAxisFromString,
|
191
|
+
:SDL_GameControllerGetStringForAxis => :GameControllerGetStringForAxis,
|
192
|
+
:SDL_GameControllerGetBindForAxis => :GameControllerGetBindForAxis,
|
193
|
+
:SDL_GameControllerHasAxis => :GameControllerHasAxis,
|
194
|
+
:SDL_GameControllerGetAxis => :GameControllerGetAxis,
|
195
|
+
:SDL_GameControllerGetButtonFromString => :GameControllerGetButtonFromString,
|
196
|
+
:SDL_GameControllerGetStringForButton => :GameControllerGetStringForButton,
|
197
|
+
:SDL_GameControllerGetBindForButton => :GameControllerGetBindForButton,
|
198
|
+
:SDL_GameControllerHasButton => :GameControllerHasButton,
|
199
|
+
:SDL_GameControllerGetButton => :GameControllerGetButton,
|
200
|
+
:SDL_GameControllerGetNumTouchpads => :GameControllerGetNumTouchpads,
|
201
|
+
:SDL_GameControllerGetNumTouchpadFingers => :GameControllerGetNumTouchpadFingers,
|
202
|
+
:SDL_GameControllerGetTouchpadFinger => :GameControllerGetTouchpadFinger,
|
203
|
+
:SDL_GameControllerHasSensor => :GameControllerHasSensor,
|
204
|
+
:SDL_GameControllerSetSensorEnabled => :GameControllerSetSensorEnabled,
|
205
|
+
:SDL_GameControllerIsSensorEnabled => :GameControllerIsSensorEnabled,
|
206
|
+
:SDL_GameControllerGetSensorDataRate => :GameControllerGetSensorDataRate,
|
207
|
+
:SDL_GameControllerGetSensorData => :GameControllerGetSensorData,
|
208
|
+
:SDL_GameControllerRumble => :GameControllerRumble,
|
209
|
+
:SDL_GameControllerRumbleTriggers => :GameControllerRumbleTriggers,
|
210
|
+
:SDL_GameControllerHasLED => :GameControllerHasLED,
|
211
|
+
:SDL_GameControllerHasRumble => :GameControllerHasRumble,
|
212
|
+
:SDL_GameControllerHasRumbleTriggers => :GameControllerHasRumbleTriggers,
|
213
|
+
:SDL_GameControllerSetLED => :GameControllerSetLED,
|
214
|
+
:SDL_GameControllerSendEffect => :GameControllerSendEffect,
|
215
|
+
:SDL_GameControllerClose => :GameControllerClose,
|
216
|
+
:SDL_GameControllerGetAppleSFSymbolsNameForButton => :GameControllerGetAppleSFSymbolsNameForButton,
|
217
|
+
:SDL_GameControllerGetAppleSFSymbolsNameForAxis => :GameControllerGetAppleSFSymbolsNameForAxis,
|
218
|
+
}
|
219
|
+
args = {
|
220
|
+
:SDL_GameControllerAddMappingsFromRW => [:pointer, :int],
|
221
|
+
:SDL_GameControllerAddMapping => [:pointer],
|
222
|
+
:SDL_GameControllerNumMappings => [],
|
223
|
+
:SDL_GameControllerMappingForIndex => [:int],
|
224
|
+
:SDL_GameControllerMappingForGUID => [JoystickGUID.by_value],
|
225
|
+
:SDL_GameControllerMapping => [:pointer],
|
226
|
+
:SDL_IsGameController => [:int],
|
227
|
+
:SDL_GameControllerNameForIndex => [:int],
|
228
|
+
:SDL_GameControllerPathForIndex => [:int],
|
229
|
+
:SDL_GameControllerTypeForIndex => [:int],
|
230
|
+
:SDL_GameControllerMappingForDeviceIndex => [:int],
|
231
|
+
:SDL_GameControllerOpen => [:int],
|
232
|
+
:SDL_GameControllerFromInstanceID => [:int],
|
233
|
+
:SDL_GameControllerFromPlayerIndex => [:int],
|
234
|
+
:SDL_GameControllerName => [:pointer],
|
235
|
+
:SDL_GameControllerPath => [:pointer],
|
236
|
+
:SDL_GameControllerGetType => [:pointer],
|
237
|
+
:SDL_GameControllerGetPlayerIndex => [:pointer],
|
238
|
+
:SDL_GameControllerSetPlayerIndex => [:pointer, :int],
|
239
|
+
:SDL_GameControllerGetVendor => [:pointer],
|
240
|
+
:SDL_GameControllerGetProduct => [:pointer],
|
241
|
+
:SDL_GameControllerGetProductVersion => [:pointer],
|
242
|
+
:SDL_GameControllerGetFirmwareVersion => [:pointer],
|
243
|
+
:SDL_GameControllerGetSerial => [:pointer],
|
244
|
+
:SDL_GameControllerGetAttached => [:pointer],
|
245
|
+
:SDL_GameControllerGetJoystick => [:pointer],
|
246
|
+
:SDL_GameControllerEventState => [:int],
|
247
|
+
:SDL_GameControllerUpdate => [],
|
248
|
+
:SDL_GameControllerGetAxisFromString => [:pointer],
|
249
|
+
:SDL_GameControllerGetStringForAxis => [:int],
|
250
|
+
:SDL_GameControllerGetBindForAxis => [:pointer, :int],
|
251
|
+
:SDL_GameControllerHasAxis => [:pointer, :int],
|
252
|
+
:SDL_GameControllerGetAxis => [:pointer, :int],
|
253
|
+
:SDL_GameControllerGetButtonFromString => [:pointer],
|
254
|
+
:SDL_GameControllerGetStringForButton => [:int],
|
255
|
+
:SDL_GameControllerGetBindForButton => [:pointer, :int],
|
256
|
+
:SDL_GameControllerHasButton => [:pointer, :int],
|
257
|
+
:SDL_GameControllerGetButton => [:pointer, :int],
|
258
|
+
:SDL_GameControllerGetNumTouchpads => [:pointer],
|
259
|
+
:SDL_GameControllerGetNumTouchpadFingers => [:pointer, :int],
|
260
|
+
:SDL_GameControllerGetTouchpadFinger => [:pointer, :int, :int, :pointer, :pointer, :pointer, :pointer],
|
261
|
+
:SDL_GameControllerHasSensor => [:pointer, :int],
|
262
|
+
:SDL_GameControllerSetSensorEnabled => [:pointer, :int, :int],
|
263
|
+
:SDL_GameControllerIsSensorEnabled => [:pointer, :int],
|
264
|
+
:SDL_GameControllerGetSensorDataRate => [:pointer, :int],
|
265
|
+
:SDL_GameControllerGetSensorData => [:pointer, :int, :pointer, :int],
|
266
|
+
:SDL_GameControllerRumble => [:pointer, :ushort, :ushort, :uint],
|
267
|
+
:SDL_GameControllerRumbleTriggers => [:pointer, :ushort, :ushort, :uint],
|
268
|
+
:SDL_GameControllerHasLED => [:pointer],
|
269
|
+
:SDL_GameControllerHasRumble => [:pointer],
|
270
|
+
:SDL_GameControllerHasRumbleTriggers => [:pointer],
|
271
|
+
:SDL_GameControllerSetLED => [:pointer, :uchar, :uchar, :uchar],
|
272
|
+
:SDL_GameControllerSendEffect => [:pointer, :pointer, :int],
|
273
|
+
:SDL_GameControllerClose => [:pointer],
|
274
|
+
:SDL_GameControllerGetAppleSFSymbolsNameForButton => [:pointer, :int],
|
275
|
+
:SDL_GameControllerGetAppleSFSymbolsNameForAxis => [:pointer, :int],
|
276
|
+
}
|
277
|
+
retvals = {
|
278
|
+
:SDL_GameControllerAddMappingsFromRW => :int,
|
279
|
+
:SDL_GameControllerAddMapping => :int,
|
280
|
+
:SDL_GameControllerNumMappings => :int,
|
281
|
+
:SDL_GameControllerMappingForIndex => :pointer,
|
282
|
+
:SDL_GameControllerMappingForGUID => :pointer,
|
283
|
+
:SDL_GameControllerMapping => :pointer,
|
284
|
+
:SDL_IsGameController => :int,
|
285
|
+
:SDL_GameControllerNameForIndex => :pointer,
|
286
|
+
:SDL_GameControllerPathForIndex => :pointer,
|
287
|
+
:SDL_GameControllerTypeForIndex => :int,
|
288
|
+
:SDL_GameControllerMappingForDeviceIndex => :pointer,
|
289
|
+
:SDL_GameControllerOpen => :pointer,
|
290
|
+
:SDL_GameControllerFromInstanceID => :pointer,
|
291
|
+
:SDL_GameControllerFromPlayerIndex => :pointer,
|
292
|
+
:SDL_GameControllerName => :pointer,
|
293
|
+
:SDL_GameControllerPath => :pointer,
|
294
|
+
:SDL_GameControllerGetType => :int,
|
295
|
+
:SDL_GameControllerGetPlayerIndex => :int,
|
296
|
+
:SDL_GameControllerSetPlayerIndex => :void,
|
297
|
+
:SDL_GameControllerGetVendor => :ushort,
|
298
|
+
:SDL_GameControllerGetProduct => :ushort,
|
299
|
+
:SDL_GameControllerGetProductVersion => :ushort,
|
300
|
+
:SDL_GameControllerGetFirmwareVersion => :ushort,
|
301
|
+
:SDL_GameControllerGetSerial => :pointer,
|
302
|
+
:SDL_GameControllerGetAttached => :int,
|
303
|
+
:SDL_GameControllerGetJoystick => :pointer,
|
304
|
+
:SDL_GameControllerEventState => :int,
|
305
|
+
:SDL_GameControllerUpdate => :void,
|
306
|
+
:SDL_GameControllerGetAxisFromString => :int,
|
307
|
+
:SDL_GameControllerGetStringForAxis => :pointer,
|
308
|
+
:SDL_GameControllerGetBindForAxis => GameControllerButtonBind.by_value,
|
309
|
+
:SDL_GameControllerHasAxis => :int,
|
310
|
+
:SDL_GameControllerGetAxis => :short,
|
311
|
+
:SDL_GameControllerGetButtonFromString => :int,
|
312
|
+
:SDL_GameControllerGetStringForButton => :pointer,
|
313
|
+
:SDL_GameControllerGetBindForButton => GameControllerButtonBind.by_value,
|
314
|
+
:SDL_GameControllerHasButton => :int,
|
315
|
+
:SDL_GameControllerGetButton => :uchar,
|
316
|
+
:SDL_GameControllerGetNumTouchpads => :int,
|
317
|
+
:SDL_GameControllerGetNumTouchpadFingers => :int,
|
318
|
+
:SDL_GameControllerGetTouchpadFinger => :int,
|
319
|
+
:SDL_GameControllerHasSensor => :int,
|
320
|
+
:SDL_GameControllerSetSensorEnabled => :int,
|
321
|
+
:SDL_GameControllerIsSensorEnabled => :int,
|
322
|
+
:SDL_GameControllerGetSensorDataRate => :float,
|
323
|
+
:SDL_GameControllerGetSensorData => :int,
|
324
|
+
:SDL_GameControllerRumble => :int,
|
325
|
+
:SDL_GameControllerRumbleTriggers => :int,
|
326
|
+
:SDL_GameControllerHasLED => :int,
|
327
|
+
:SDL_GameControllerHasRumble => :int,
|
328
|
+
:SDL_GameControllerHasRumbleTriggers => :int,
|
329
|
+
:SDL_GameControllerSetLED => :int,
|
330
|
+
:SDL_GameControllerSendEffect => :int,
|
331
|
+
:SDL_GameControllerClose => :void,
|
332
|
+
:SDL_GameControllerGetAppleSFSymbolsNameForButton => :pointer,
|
333
|
+
:SDL_GameControllerGetAppleSFSymbolsNameForAxis => :pointer,
|
334
|
+
}
|
335
|
+
symbols.each do |sym|
|
336
|
+
begin
|
337
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
338
|
+
rescue FFI::NotFoundError => error
|
339
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
340
|
+
end
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
end
|
345
|
+
|