浏览代码

Merge pull request #73781 from BZ1234567890/issue-73305-b3x

[3.x] iOS: Implement missing gamepad.buttonOptions, buttonMenu, and buttonHome joy buttons
Rémi Verschelde 2 年之前
父节点
当前提交
8edd526c2c
共有 1 个文件被更改,包括 17 次插入0 次删除
  1. 17 0
      platform/iphone/joypad_iphone.mm

+ 17 - 0
platform/iphone/joypad_iphone.mm

@@ -309,6 +309,23 @@ void JoypadIPhone::start_processing() {
 				float value = gamepad.rightTrigger.value;
 				float value = gamepad.rightTrigger.value;
 				OSIPhone::get_singleton()->joy_axis(joy_id, JOY_ANALOG_R2, value);
 				OSIPhone::get_singleton()->joy_axis(joy_id, JOY_ANALOG_R2, value);
 			}
 			}
+
+			if (@available(iOS 13, *)) {
+				if (element == gamepad.buttonOptions) {
+					OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_10,
+							gamepad.buttonOptions.isPressed);
+				} else if (element == gamepad.buttonMenu) {
+					OSIPhone::get_singleton()->joy_button(joy_id, JOY_BUTTON_11,
+							gamepad.buttonMenu.isPressed);
+				}
+			}
+
+			if (@available(iOS 14, *)) {
+				if (element == gamepad.buttonHome) {
+					OSIPhone::get_singleton()->joy_button(joy_id, JOY_GUIDE,
+							gamepad.buttonHome.isPressed);
+				}
+			}
 		};
 		};
 	} else if (controller.microGamepad != nil) {
 	} else if (controller.microGamepad != nil) {
 		// micro gamepads were added in OS 9 and feature just 2 buttons and a d-pad
 		// micro gamepads were added in OS 9 and feature just 2 buttons and a d-pad