Skip to content

Commit b38cb09

Browse files
committed
Merge pull request godotengine#114316 from Nintorch/sdl-joypad-ios-visionos
Add support for SDL3 joystick input driver for iOS
2 parents e8c8098 + 129effb commit b38cb09

14 files changed

Lines changed: 306 additions & 747 deletions

File tree

doc/classes/Input.xml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<description>
4545
Clears the calibration information for the specified joypad's motion sensors, if it has any and if they were calibrated.
4646
See [method start_joy_motion_sensors_calibration] for an example on how to use joypad motion sensors and calibration in your games.
47-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
47+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
4848
</description>
4949
</method>
5050
<method name="flush_buffered_events">
@@ -128,7 +128,7 @@
128128
+Y ... -Y: bottom ... top;
129129
+Z ... -Z: farther ... closer.
130130
The gravity part value is measured as a vector with length of [code]9.8[/code] away from the center of the Earth, which is a negative Y value.
131-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
131+
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS. On iOS, joypad accelerometer sensor reading is not supported due to OS limitations.
132132
</description>
133133
</method>
134134
<method name="get_joy_axis" qualifiers="const">
@@ -149,7 +149,7 @@
149149
+Y ... -Y: bottom ... top;
150150
+Z ... -Z: farther ... closer.
151151
The gravity part value is measured as a vector with length of [code]9.8[/code] away from the center of the Earth, which is a negative Y value.
152-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
152+
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS. On iOS, joypad accelerometer sensor reading is not supported due to OS limitations.
153153
</description>
154154
</method>
155155
<method name="get_joy_guid" qualifiers="const">
@@ -171,23 +171,23 @@
171171
Y: Angular speed around the Y axis (yaw);
172172
Z: Angular speed around the Z axis (roll).
173173
See [method start_joy_motion_sensors_calibration] for an example on how to use joypad gyroscope and gyroscope calibration in your games.
174-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
174+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
175175
</description>
176176
</method>
177177
<method name="get_joy_info" qualifiers="const">
178178
<return type="Dictionary" />
179179
<param index="0" name="device" type="int" />
180180
<description>
181181
Returns a dictionary with extra platform-specific information about the device, e.g. the raw gamepad name from the OS or the Steam Input index.
182-
On Windows, Linux, and macOS, the dictionary contains the following fields:
182+
On Windows, Linux, macOS, and iOS, the dictionary contains the following fields:
183183
[code]raw_name[/code]: The name of the controller as it came from the OS, before getting renamed by the controller database.
184184
[code]vendor_id[/code]: The USB vendor ID of the device.
185185
[code]product_id[/code]: The USB product ID of the device.
186186
[code]serial_number[/code]: The serial number of the device. This key won't be present if the serial number is unavailable.
187-
[code]steam_input_index[/code]: The Steam Input gamepad index, if the device is not a Steam Input device this key won't be present.
188-
On Windows, the dictionary can have an additional field:
189-
[code]xinput_index[/code]: The index of the controller in the XInput system. This key won't be present for devices not handled by XInput.
190-
[b]Note:[/b] The returned dictionary is always empty on Android, iOS, visionOS, and Web.
187+
The dictionary can also include the following fields under selected platforms:
188+
[code]steam_input_index[/code]: The Steam Input gamepad index (Windows, Linux, and macOS only). If the device is not a Steam Input device this key won't be present.
189+
[code]xinput_index[/code]: The index of the controller in the XInput system (Windows only). This key won't be present for devices not handled by XInput.
190+
[b]Note:[/b] The returned dictionary is always empty on Android and Web.
191191
</description>
192192
</method>
193193
<method name="get_joy_motion_sensors_calibration" qualifiers="const" experimental="">
@@ -198,15 +198,15 @@
198198
The dictionary contains the following fields:
199199
[code]gyroscope_offset[/code]: average offset in gyroscope values from [constant Vector2.ZERO] in rad/s.
200200
See [method start_joy_motion_sensors_calibration] for an example on how to use joypad motion sensors and calibration in your games.
201-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
201+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
202202
</description>
203203
</method>
204204
<method name="get_joy_motion_sensors_rate" qualifiers="const" experimental="">
205205
<return type="float" />
206206
<param index="0" name="device" type="int" />
207207
<description>
208208
Returns the joypad's motion sensor rate in Hz, if the joypad has motion sensors and they're currently enabled. See also [method set_joy_motion_sensors_enabled].
209-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
209+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
210210
</description>
211211
</method>
212212
<method name="get_joy_name">
@@ -274,15 +274,16 @@
274274
<param index="0" name="device" type="int" />
275275
<description>
276276
Returns [code]true[/code] if the joypad has an LED light that can change colors and/or brightness. See also [method set_joy_light].
277-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
277+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
278278
</description>
279279
</method>
280280
<method name="has_joy_motion_sensors" qualifiers="const" experimental="">
281281
<return type="bool" />
282282
<param index="0" name="device" type="int" />
283283
<description>
284284
Returns [code]true[/code] if the joypad has motion sensors (accelerometer and gyroscope).
285-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
285+
[b]Note:[/b] On iOS, joypad accelerometer sensor reading is not supported due to OS limitations.
286+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
286287
</description>
287288
</method>
288289
<method name="is_action_just_pressed" qualifiers="const">
@@ -371,7 +372,7 @@
371372
<description>
372373
Returns [code]true[/code] if the joypad's motion sensors have been calibrated.
373374
See [method start_joy_motion_sensors_calibration] for an example on how to use joypad motion sensors and calibration in your games.
374-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
375+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
375376
</description>
376377
</method>
377378
<method name="is_joy_motion_sensors_calibrating" qualifiers="const" experimental="">
@@ -380,7 +381,7 @@
380381
<description>
381382
Returns [code]true[/code] if the joypad's motion sensors are currently being calibrated.
382383
See [method start_joy_motion_sensors_calibration] for an example on how to use joypad motion sensors and calibration in your games.
383-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
384+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
384385
</description>
385386
</method>
386387
<method name="is_joy_motion_sensors_enabled" qualifiers="const" experimental="">
@@ -389,7 +390,7 @@
389390
<description>
390391
Returns [code]true[/code] if the requested joypad has motion sensors (accelerometer and gyroscope) and they are currently enabled. See also [method set_joy_motion_sensors_enabled] and [method has_joy_motion_sensors].
391392
See [method start_joy_motion_sensors_calibration] for an example on how to use joypad motion sensors and calibration in your games.
392-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
393+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
393394
</description>
394395
</method>
395396
<method name="is_key_label_pressed" qualifiers="const">
@@ -508,7 +509,7 @@
508509
<description>
509510
Sets the joypad's LED light, if available, to the specified color. See also [method has_joy_light].
510511
[b]Note:[/b] There is no way to get the color of the light from a joypad. If you need to know the assigned color, store it separately.
511-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
512+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
512513
</description>
513514
</method>
514515
<method name="set_joy_motion_sensors_calibration" experimental="">
@@ -518,7 +519,7 @@
518519
<description>
519520
Sets the specified joypad's calibration information. See also [method get_joy_motion_sensors_calibration].
520521
See [method start_joy_motion_sensors_calibration] for an example on how to use joypad motion sensors and calibration in your games.
521-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
522+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
522523
</description>
523524
</method>
524525
<method name="set_joy_motion_sensors_enabled" experimental="">
@@ -529,7 +530,7 @@
529530
Enables or disables the motion sensors (accelerometer and gyroscope), if available, on the specified joypad.
530531
See [method start_joy_motion_sensors_calibration] for an example on how to use joypad motion sensors and calibration in your games.
531532
It's recommended to disable the motion sensors when they're no longer being used, because otherwise it might drain the controller battery faster.
532-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
533+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
533534
</description>
534535
</method>
535536
<method name="set_magnetometer">
@@ -654,7 +655,7 @@
654655
[/csharp]
655656
[/codeblocks]
656657
[b]Note:[/b] Accelerometer sensor doesn't usually require calibration.
657-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
658+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
658659
</description>
659660
</method>
660661
<method name="start_joy_vibration">
@@ -675,7 +676,7 @@
675676
<description>
676677
Stops the calibration process of the specified joypad's motion sensors.
677678
See [method start_joy_motion_sensors_calibration] for an example on how to use joypad motion sensors and calibration in your games.
678-
[b]Note:[/b] This feature is only supported on Windows, Linux, and macOS.
679+
[b]Note:[/b] This feature is only supported on Windows, Linux, macOS, and iOS.
679680
</description>
680681
</method>
681682
<method name="stop_joy_vibration">

drivers/SCsub

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ if env["metal"]:
6161
SConscript("metal/SCsub")
6262

6363
# Input drivers
64-
if env["sdl"] and env["platform"] in ["linuxbsd", "macos", "windows"]:
65-
# TODO: Evaluate support for Android, iOS, and Web.
64+
if env["sdl"] and env["platform"] in ["linuxbsd", "macos", "windows", "ios", "visionos"]:
65+
# TODO: Evaluate support for Android and Web.
6666
SConscript("sdl/SCsub")
6767

6868
# Core dependencies

drivers/apple/joypad_apple.h

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)