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_joystick.rb
CHANGED
@@ -1,294 +1,332 @@
|
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
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
|
-
|
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_guid'
|
9
|
+
|
10
|
+
module SDL
|
11
|
+
extend FFI::Library
|
12
|
+
# Define/Macro
|
13
|
+
|
14
|
+
IPHONE_MAX_GFORCE = 5.0
|
15
|
+
VIRTUAL_JOYSTICK_DESC_VERSION = 1
|
16
|
+
JOYSTICK_AXIS_MAX = 32767
|
17
|
+
JOYSTICK_AXIS_MIN = -32768
|
18
|
+
HAT_CENTERED = 0x00
|
19
|
+
HAT_UP = 0x01
|
20
|
+
HAT_RIGHT = 0x02
|
21
|
+
HAT_DOWN = 0x04
|
22
|
+
HAT_LEFT = 0x08
|
23
|
+
HAT_RIGHTUP = (HAT_RIGHT | HAT_UP)
|
24
|
+
HAT_RIGHTDOWN = (HAT_RIGHT | HAT_DOWN)
|
25
|
+
HAT_LEFTUP = (HAT_LEFT | HAT_UP)
|
26
|
+
HAT_LEFTDOWN = (HAT_LEFT | HAT_DOWN)
|
27
|
+
|
28
|
+
# Enum
|
29
|
+
|
30
|
+
JOYSTICK_TYPE_UNKNOWN = 0
|
31
|
+
JOYSTICK_TYPE_GAMECONTROLLER = 1
|
32
|
+
JOYSTICK_TYPE_WHEEL = 2
|
33
|
+
JOYSTICK_TYPE_ARCADE_STICK = 3
|
34
|
+
JOYSTICK_TYPE_FLIGHT_STICK = 4
|
35
|
+
JOYSTICK_TYPE_DANCE_PAD = 5
|
36
|
+
JOYSTICK_TYPE_GUITAR = 6
|
37
|
+
JOYSTICK_TYPE_DRUM_KIT = 7
|
38
|
+
JOYSTICK_TYPE_ARCADE_PAD = 8
|
39
|
+
JOYSTICK_TYPE_THROTTLE = 9
|
40
|
+
JOYSTICK_POWER_UNKNOWN = -1
|
41
|
+
JOYSTICK_POWER_EMPTY = 0
|
42
|
+
JOYSTICK_POWER_LOW = 1
|
43
|
+
JOYSTICK_POWER_MEDIUM = 2
|
44
|
+
JOYSTICK_POWER_FULL = 3
|
45
|
+
JOYSTICK_POWER_WIRED = 4
|
46
|
+
JOYSTICK_POWER_MAX = 5
|
47
|
+
|
48
|
+
# Typedef
|
49
|
+
|
50
|
+
|
51
|
+
JoystickGUID = SDL::GUID
|
52
|
+
|
53
|
+
typedef :int, :SDL_JoystickID
|
54
|
+
typedef :int, :SDL_JoystickType
|
55
|
+
typedef :int, :SDL_JoystickPowerLevel
|
56
|
+
|
57
|
+
# Struct
|
58
|
+
|
59
|
+
class VirtualJoystickDesc < FFI::Struct
|
60
|
+
layout(
|
61
|
+
:version, :ushort,
|
62
|
+
:type, :ushort,
|
63
|
+
:naxes, :ushort,
|
64
|
+
:nbuttons, :ushort,
|
65
|
+
:nhats, :ushort,
|
66
|
+
:vendor_id, :ushort,
|
67
|
+
:product_id, :ushort,
|
68
|
+
:padding, :ushort,
|
69
|
+
:button_mask, :uint,
|
70
|
+
:axis_mask, :uint,
|
71
|
+
:name, :pointer,
|
72
|
+
:userdata, :pointer,
|
73
|
+
:Update, :pointer,
|
74
|
+
:SetPlayerIndex, :pointer,
|
75
|
+
:Rumble, :pointer,
|
76
|
+
:RumbleTriggers, :pointer,
|
77
|
+
:SetLED, :pointer,
|
78
|
+
:SendEffect, :pointer,
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
# Function
|
84
|
+
|
85
|
+
def self.setup_joystick_symbols(output_error = false)
|
86
|
+
symbols = [
|
87
|
+
:SDL_LockJoysticks,
|
88
|
+
:SDL_UnlockJoysticks,
|
89
|
+
:SDL_NumJoysticks,
|
90
|
+
:SDL_JoystickNameForIndex,
|
91
|
+
:SDL_JoystickPathForIndex,
|
92
|
+
:SDL_JoystickGetDevicePlayerIndex,
|
93
|
+
:SDL_JoystickGetDeviceGUID,
|
94
|
+
:SDL_JoystickGetDeviceVendor,
|
95
|
+
:SDL_JoystickGetDeviceProduct,
|
96
|
+
:SDL_JoystickGetDeviceProductVersion,
|
97
|
+
:SDL_JoystickGetDeviceType,
|
98
|
+
:SDL_JoystickGetDeviceInstanceID,
|
99
|
+
:SDL_JoystickOpen,
|
100
|
+
:SDL_JoystickFromInstanceID,
|
101
|
+
:SDL_JoystickFromPlayerIndex,
|
102
|
+
:SDL_JoystickAttachVirtual,
|
103
|
+
:SDL_JoystickAttachVirtualEx,
|
104
|
+
:SDL_JoystickDetachVirtual,
|
105
|
+
:SDL_JoystickIsVirtual,
|
106
|
+
:SDL_JoystickSetVirtualAxis,
|
107
|
+
:SDL_JoystickSetVirtualButton,
|
108
|
+
:SDL_JoystickSetVirtualHat,
|
109
|
+
:SDL_JoystickName,
|
110
|
+
:SDL_JoystickPath,
|
111
|
+
:SDL_JoystickGetPlayerIndex,
|
112
|
+
:SDL_JoystickSetPlayerIndex,
|
113
|
+
:SDL_JoystickGetGUID,
|
114
|
+
:SDL_JoystickGetVendor,
|
115
|
+
:SDL_JoystickGetProduct,
|
116
|
+
:SDL_JoystickGetProductVersion,
|
117
|
+
:SDL_JoystickGetFirmwareVersion,
|
118
|
+
:SDL_JoystickGetSerial,
|
119
|
+
:SDL_JoystickGetType,
|
120
|
+
:SDL_JoystickGetGUIDString,
|
121
|
+
:SDL_JoystickGetGUIDFromString,
|
122
|
+
:SDL_JoystickGetAttached,
|
123
|
+
:SDL_JoystickInstanceID,
|
124
|
+
:SDL_JoystickNumAxes,
|
125
|
+
:SDL_JoystickNumBalls,
|
126
|
+
:SDL_JoystickNumHats,
|
127
|
+
:SDL_JoystickNumButtons,
|
128
|
+
:SDL_JoystickUpdate,
|
129
|
+
:SDL_JoystickEventState,
|
130
|
+
:SDL_JoystickGetAxis,
|
131
|
+
:SDL_JoystickGetAxisInitialState,
|
132
|
+
:SDL_JoystickGetHat,
|
133
|
+
:SDL_JoystickGetBall,
|
134
|
+
:SDL_JoystickGetButton,
|
135
|
+
:SDL_JoystickRumble,
|
136
|
+
:SDL_JoystickRumbleTriggers,
|
137
|
+
:SDL_JoystickHasLED,
|
138
|
+
:SDL_JoystickHasRumble,
|
139
|
+
:SDL_JoystickHasRumbleTriggers,
|
140
|
+
:SDL_JoystickSetLED,
|
141
|
+
:SDL_JoystickSendEffect,
|
142
|
+
:SDL_JoystickClose,
|
143
|
+
:SDL_JoystickCurrentPowerLevel,
|
144
|
+
]
|
145
|
+
apis = {
|
146
|
+
:SDL_LockJoysticks => :LockJoysticks,
|
147
|
+
:SDL_UnlockJoysticks => :UnlockJoysticks,
|
148
|
+
:SDL_NumJoysticks => :NumJoysticks,
|
149
|
+
:SDL_JoystickNameForIndex => :JoystickNameForIndex,
|
150
|
+
:SDL_JoystickPathForIndex => :JoystickPathForIndex,
|
151
|
+
:SDL_JoystickGetDevicePlayerIndex => :JoystickGetDevicePlayerIndex,
|
152
|
+
:SDL_JoystickGetDeviceGUID => :JoystickGetDeviceGUID,
|
153
|
+
:SDL_JoystickGetDeviceVendor => :JoystickGetDeviceVendor,
|
154
|
+
:SDL_JoystickGetDeviceProduct => :JoystickGetDeviceProduct,
|
155
|
+
:SDL_JoystickGetDeviceProductVersion => :JoystickGetDeviceProductVersion,
|
156
|
+
:SDL_JoystickGetDeviceType => :JoystickGetDeviceType,
|
157
|
+
:SDL_JoystickGetDeviceInstanceID => :JoystickGetDeviceInstanceID,
|
158
|
+
:SDL_JoystickOpen => :JoystickOpen,
|
159
|
+
:SDL_JoystickFromInstanceID => :JoystickFromInstanceID,
|
160
|
+
:SDL_JoystickFromPlayerIndex => :JoystickFromPlayerIndex,
|
161
|
+
:SDL_JoystickAttachVirtual => :JoystickAttachVirtual,
|
162
|
+
:SDL_JoystickAttachVirtualEx => :JoystickAttachVirtualEx,
|
163
|
+
:SDL_JoystickDetachVirtual => :JoystickDetachVirtual,
|
164
|
+
:SDL_JoystickIsVirtual => :JoystickIsVirtual,
|
165
|
+
:SDL_JoystickSetVirtualAxis => :JoystickSetVirtualAxis,
|
166
|
+
:SDL_JoystickSetVirtualButton => :JoystickSetVirtualButton,
|
167
|
+
:SDL_JoystickSetVirtualHat => :JoystickSetVirtualHat,
|
168
|
+
:SDL_JoystickName => :JoystickName,
|
169
|
+
:SDL_JoystickPath => :JoystickPath,
|
170
|
+
:SDL_JoystickGetPlayerIndex => :JoystickGetPlayerIndex,
|
171
|
+
:SDL_JoystickSetPlayerIndex => :JoystickSetPlayerIndex,
|
172
|
+
:SDL_JoystickGetGUID => :JoystickGetGUID,
|
173
|
+
:SDL_JoystickGetVendor => :JoystickGetVendor,
|
174
|
+
:SDL_JoystickGetProduct => :JoystickGetProduct,
|
175
|
+
:SDL_JoystickGetProductVersion => :JoystickGetProductVersion,
|
176
|
+
:SDL_JoystickGetFirmwareVersion => :JoystickGetFirmwareVersion,
|
177
|
+
:SDL_JoystickGetSerial => :JoystickGetSerial,
|
178
|
+
:SDL_JoystickGetType => :JoystickGetType,
|
179
|
+
:SDL_JoystickGetGUIDString => :JoystickGetGUIDString,
|
180
|
+
:SDL_JoystickGetGUIDFromString => :JoystickGetGUIDFromString,
|
181
|
+
:SDL_JoystickGetAttached => :JoystickGetAttached,
|
182
|
+
:SDL_JoystickInstanceID => :JoystickInstanceID,
|
183
|
+
:SDL_JoystickNumAxes => :JoystickNumAxes,
|
184
|
+
:SDL_JoystickNumBalls => :JoystickNumBalls,
|
185
|
+
:SDL_JoystickNumHats => :JoystickNumHats,
|
186
|
+
:SDL_JoystickNumButtons => :JoystickNumButtons,
|
187
|
+
:SDL_JoystickUpdate => :JoystickUpdate,
|
188
|
+
:SDL_JoystickEventState => :JoystickEventState,
|
189
|
+
:SDL_JoystickGetAxis => :JoystickGetAxis,
|
190
|
+
:SDL_JoystickGetAxisInitialState => :JoystickGetAxisInitialState,
|
191
|
+
:SDL_JoystickGetHat => :JoystickGetHat,
|
192
|
+
:SDL_JoystickGetBall => :JoystickGetBall,
|
193
|
+
:SDL_JoystickGetButton => :JoystickGetButton,
|
194
|
+
:SDL_JoystickRumble => :JoystickRumble,
|
195
|
+
:SDL_JoystickRumbleTriggers => :JoystickRumbleTriggers,
|
196
|
+
:SDL_JoystickHasLED => :JoystickHasLED,
|
197
|
+
:SDL_JoystickHasRumble => :JoystickHasRumble,
|
198
|
+
:SDL_JoystickHasRumbleTriggers => :JoystickHasRumbleTriggers,
|
199
|
+
:SDL_JoystickSetLED => :JoystickSetLED,
|
200
|
+
:SDL_JoystickSendEffect => :JoystickSendEffect,
|
201
|
+
:SDL_JoystickClose => :JoystickClose,
|
202
|
+
:SDL_JoystickCurrentPowerLevel => :JoystickCurrentPowerLevel,
|
203
|
+
}
|
204
|
+
args = {
|
205
|
+
:SDL_LockJoysticks => [],
|
206
|
+
:SDL_UnlockJoysticks => [],
|
207
|
+
:SDL_NumJoysticks => [],
|
208
|
+
:SDL_JoystickNameForIndex => [:int],
|
209
|
+
:SDL_JoystickPathForIndex => [:int],
|
210
|
+
:SDL_JoystickGetDevicePlayerIndex => [:int],
|
211
|
+
:SDL_JoystickGetDeviceGUID => [:int],
|
212
|
+
:SDL_JoystickGetDeviceVendor => [:int],
|
213
|
+
:SDL_JoystickGetDeviceProduct => [:int],
|
214
|
+
:SDL_JoystickGetDeviceProductVersion => [:int],
|
215
|
+
:SDL_JoystickGetDeviceType => [:int],
|
216
|
+
:SDL_JoystickGetDeviceInstanceID => [:int],
|
217
|
+
:SDL_JoystickOpen => [:int],
|
218
|
+
:SDL_JoystickFromInstanceID => [:int],
|
219
|
+
:SDL_JoystickFromPlayerIndex => [:int],
|
220
|
+
:SDL_JoystickAttachVirtual => [:int, :int, :int, :int],
|
221
|
+
:SDL_JoystickAttachVirtualEx => [:pointer],
|
222
|
+
:SDL_JoystickDetachVirtual => [:int],
|
223
|
+
:SDL_JoystickIsVirtual => [:int],
|
224
|
+
:SDL_JoystickSetVirtualAxis => [:pointer, :int, :short],
|
225
|
+
:SDL_JoystickSetVirtualButton => [:pointer, :int, :uchar],
|
226
|
+
:SDL_JoystickSetVirtualHat => [:pointer, :int, :uchar],
|
227
|
+
:SDL_JoystickName => [:pointer],
|
228
|
+
:SDL_JoystickPath => [:pointer],
|
229
|
+
:SDL_JoystickGetPlayerIndex => [:pointer],
|
230
|
+
:SDL_JoystickSetPlayerIndex => [:pointer, :int],
|
231
|
+
:SDL_JoystickGetGUID => [:pointer],
|
232
|
+
:SDL_JoystickGetVendor => [:pointer],
|
233
|
+
:SDL_JoystickGetProduct => [:pointer],
|
234
|
+
:SDL_JoystickGetProductVersion => [:pointer],
|
235
|
+
:SDL_JoystickGetFirmwareVersion => [:pointer],
|
236
|
+
:SDL_JoystickGetSerial => [:pointer],
|
237
|
+
:SDL_JoystickGetType => [:pointer],
|
238
|
+
:SDL_JoystickGetGUIDString => [JoystickGUID.by_value, :pointer, :int],
|
239
|
+
:SDL_JoystickGetGUIDFromString => [:pointer],
|
240
|
+
:SDL_JoystickGetAttached => [:pointer],
|
241
|
+
:SDL_JoystickInstanceID => [:pointer],
|
242
|
+
:SDL_JoystickNumAxes => [:pointer],
|
243
|
+
:SDL_JoystickNumBalls => [:pointer],
|
244
|
+
:SDL_JoystickNumHats => [:pointer],
|
245
|
+
:SDL_JoystickNumButtons => [:pointer],
|
246
|
+
:SDL_JoystickUpdate => [],
|
247
|
+
:SDL_JoystickEventState => [:int],
|
248
|
+
:SDL_JoystickGetAxis => [:pointer, :int],
|
249
|
+
:SDL_JoystickGetAxisInitialState => [:pointer, :int, :pointer],
|
250
|
+
:SDL_JoystickGetHat => [:pointer, :int],
|
251
|
+
:SDL_JoystickGetBall => [:pointer, :int, :pointer, :pointer],
|
252
|
+
:SDL_JoystickGetButton => [:pointer, :int],
|
253
|
+
:SDL_JoystickRumble => [:pointer, :ushort, :ushort, :uint],
|
254
|
+
:SDL_JoystickRumbleTriggers => [:pointer, :ushort, :ushort, :uint],
|
255
|
+
:SDL_JoystickHasLED => [:pointer],
|
256
|
+
:SDL_JoystickHasRumble => [:pointer],
|
257
|
+
:SDL_JoystickHasRumbleTriggers => [:pointer],
|
258
|
+
:SDL_JoystickSetLED => [:pointer, :uchar, :uchar, :uchar],
|
259
|
+
:SDL_JoystickSendEffect => [:pointer, :pointer, :int],
|
260
|
+
:SDL_JoystickClose => [:pointer],
|
261
|
+
:SDL_JoystickCurrentPowerLevel => [:pointer],
|
262
|
+
}
|
263
|
+
retvals = {
|
264
|
+
:SDL_LockJoysticks => :void,
|
265
|
+
:SDL_UnlockJoysticks => :void,
|
266
|
+
:SDL_NumJoysticks => :int,
|
267
|
+
:SDL_JoystickNameForIndex => :pointer,
|
268
|
+
:SDL_JoystickPathForIndex => :pointer,
|
269
|
+
:SDL_JoystickGetDevicePlayerIndex => :int,
|
270
|
+
:SDL_JoystickGetDeviceGUID => JoystickGUID.by_value,
|
271
|
+
:SDL_JoystickGetDeviceVendor => :ushort,
|
272
|
+
:SDL_JoystickGetDeviceProduct => :ushort,
|
273
|
+
:SDL_JoystickGetDeviceProductVersion => :ushort,
|
274
|
+
:SDL_JoystickGetDeviceType => :int,
|
275
|
+
:SDL_JoystickGetDeviceInstanceID => :int,
|
276
|
+
:SDL_JoystickOpen => :pointer,
|
277
|
+
:SDL_JoystickFromInstanceID => :pointer,
|
278
|
+
:SDL_JoystickFromPlayerIndex => :pointer,
|
279
|
+
:SDL_JoystickAttachVirtual => :int,
|
280
|
+
:SDL_JoystickAttachVirtualEx => :int,
|
281
|
+
:SDL_JoystickDetachVirtual => :int,
|
282
|
+
:SDL_JoystickIsVirtual => :int,
|
283
|
+
:SDL_JoystickSetVirtualAxis => :int,
|
284
|
+
:SDL_JoystickSetVirtualButton => :int,
|
285
|
+
:SDL_JoystickSetVirtualHat => :int,
|
286
|
+
:SDL_JoystickName => :pointer,
|
287
|
+
:SDL_JoystickPath => :pointer,
|
288
|
+
:SDL_JoystickGetPlayerIndex => :int,
|
289
|
+
:SDL_JoystickSetPlayerIndex => :void,
|
290
|
+
:SDL_JoystickGetGUID => JoystickGUID.by_value,
|
291
|
+
:SDL_JoystickGetVendor => :ushort,
|
292
|
+
:SDL_JoystickGetProduct => :ushort,
|
293
|
+
:SDL_JoystickGetProductVersion => :ushort,
|
294
|
+
:SDL_JoystickGetFirmwareVersion => :ushort,
|
295
|
+
:SDL_JoystickGetSerial => :pointer,
|
296
|
+
:SDL_JoystickGetType => :int,
|
297
|
+
:SDL_JoystickGetGUIDString => :void,
|
298
|
+
:SDL_JoystickGetGUIDFromString => JoystickGUID.by_value,
|
299
|
+
:SDL_JoystickGetAttached => :int,
|
300
|
+
:SDL_JoystickInstanceID => :int,
|
301
|
+
:SDL_JoystickNumAxes => :int,
|
302
|
+
:SDL_JoystickNumBalls => :int,
|
303
|
+
:SDL_JoystickNumHats => :int,
|
304
|
+
:SDL_JoystickNumButtons => :int,
|
305
|
+
:SDL_JoystickUpdate => :void,
|
306
|
+
:SDL_JoystickEventState => :int,
|
307
|
+
:SDL_JoystickGetAxis => :short,
|
308
|
+
:SDL_JoystickGetAxisInitialState => :int,
|
309
|
+
:SDL_JoystickGetHat => :uchar,
|
310
|
+
:SDL_JoystickGetBall => :int,
|
311
|
+
:SDL_JoystickGetButton => :uchar,
|
312
|
+
:SDL_JoystickRumble => :int,
|
313
|
+
:SDL_JoystickRumbleTriggers => :int,
|
314
|
+
:SDL_JoystickHasLED => :int,
|
315
|
+
:SDL_JoystickHasRumble => :int,
|
316
|
+
:SDL_JoystickHasRumbleTriggers => :int,
|
317
|
+
:SDL_JoystickSetLED => :int,
|
318
|
+
:SDL_JoystickSendEffect => :int,
|
319
|
+
:SDL_JoystickClose => :void,
|
320
|
+
:SDL_JoystickCurrentPowerLevel => :int,
|
321
|
+
}
|
322
|
+
symbols.each do |sym|
|
323
|
+
begin
|
324
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
325
|
+
rescue FFI::NotFoundError => error
|
326
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
end
|
332
|
+
|