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