summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-17 00:36:20 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-17 00:36:20 +0100
commit6061d1bfd83262ef2faa3287ace5df588b34e1df (patch)
treeccde2c8db3a1152049134a330d94b59dba0e76de
parent2824774d2980417cb36ebcd5ef283d2475bf76a0 (diff)
parentc71d0505290b386b6536987796e8c394ef5b8975 (diff)
Merge pull request #73462 from BZ1234567890/issue-73305
iOS: Implement missing JoyButton::BACK (Options), START (Menu), and GUIDE (Home)
-rw-r--r--platform/ios/joypad_ios.mm19
1 files changed, 19 insertions, 0 deletions
diff --git a/platform/ios/joypad_ios.mm b/platform/ios/joypad_ios.mm
index 057f439b81..9194b09ef6 100644
--- a/platform/ios/joypad_ios.mm
+++ b/platform/ios/joypad_ios.mm
@@ -305,6 +305,25 @@ void JoypadIOS::start_processing() {
float value = gamepad.rightTrigger.value;
Input::get_singleton()->joy_axis(joy_id, JoyAxis::TRIGGER_RIGHT, value);
}
+
+ if (@available(iOS 13, *)) {
+ // iOS uses 'buttonOptions' and 'buttonMenu' names for BACK and START joy buttons.
+ if (element == gamepad.buttonOptions) {
+ Input::get_singleton()->joy_button(joy_id, JoyButton::BACK,
+ gamepad.buttonOptions.isPressed);
+ } else if (element == gamepad.buttonMenu) {
+ Input::get_singleton()->joy_button(joy_id, JoyButton::START,
+ gamepad.buttonMenu.isPressed);
+ }
+ }
+
+ if (@available(iOS 14, *)) {
+ // iOS uses 'buttonHome' for the GUIDE joy button.
+ if (element == gamepad.buttonHome) {
+ Input::get_singleton()->joy_button(joy_id, JoyButton::GUIDE,
+ gamepad.buttonHome.isPressed);
+ }
+ }
};
} else if (controller.microGamepad != nil) {
// micro gamepads were added in OS 9 and feature just 2 buttons and a d-pad