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