Bind only joypad button 0 for ui_accept confirm
Simplify the confirm binding to just the standard button 0 (Xbox-style "A" / bottom face button) instead of also covering the Nintendo-layout right-hand position. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MXBNaEBmrYDSMcv4NgUWtV
This commit is contained in:
@@ -30,16 +30,13 @@ func _ready() -> void:
|
|||||||
## Godot's built-in ui_accept (menu/button confirm) ships with zero joypad bindings —
|
## Godot's built-in ui_accept (menu/button confirm) ships with zero joypad bindings —
|
||||||
## checked directly: only Enter/Kp Enter/Space. ui_left/right/up/down, by contrast, do
|
## checked directly: only Enter/Kp Enter/Space. ui_left/right/up/down, by contrast, do
|
||||||
## default to the D-pad and stick, which is why gamepad focus navigation on a menu works out
|
## default to the D-pad and stick, which is why gamepad focus navigation on a menu works out
|
||||||
## of the box while "confirming" the focused button does nothing. Bind both the Xbox-style
|
## of the box while "confirming" the focused button does nothing. Bind joypad button 0 (the
|
||||||
## bottom face button (A, index 0) and the right-hand one (B, index 1 — physically labelled
|
## bottom face button in Xbox-style position mapping) as the confirm button.
|
||||||
## "A" on a Nintendo-layout pad, since SDL/browser gamepad mapping normalizes to Xbox
|
|
||||||
## *position*, not the printed label) so either the common "confirm" button works.
|
|
||||||
func _ensure_gamepad_confirm_binding() -> void:
|
func _ensure_gamepad_confirm_binding() -> void:
|
||||||
for button_index in [JOY_BUTTON_A, JOY_BUTTON_B]:
|
var alt := InputEventJoypadButton.new()
|
||||||
var alt := InputEventJoypadButton.new()
|
alt.button_index = JOY_BUTTON_A
|
||||||
alt.button_index = button_index
|
if not InputMap.action_has_event(&"ui_accept", alt):
|
||||||
if not InputMap.action_has_event(&"ui_accept", alt):
|
InputMap.action_add_event(&"ui_accept", alt)
|
||||||
InputMap.action_add_event(&"ui_accept", alt)
|
|
||||||
|
|
||||||
|
|
||||||
# ── Web fullscreen + landscape lock ─────────────────────────────────────────────
|
# ── Web fullscreen + landscape lock ─────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user