From d8d6b115085a0610ea7d621cc5a8639707a4b2d2 Mon Sep 17 00:00:00 2001 From: Richard Aasa Date: Thu, 10 Sep 2026 17:56:24 +0300 Subject: [PATCH] Let a gamepad drive the end-screen buttons (Play Again / Main Menu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nothing had focus by default when the outcome screen appeared, so a gamepad's ui_accept/ui_left/ui_right (bound to Godot's built-in ui_* actions) had no control to act on — same reason main_menu.gd grabs focus on its own default button per panel. Grab it on whichever button is visible (Play Again/Continue on a win, Retry on a loss); Godot's geometry-based focus neighbors then let ui_left/ui_right reach Main Menu from there. Verified headlessly: a synthetic ui_accept on the focused button reloads the run, same as a real gamepad A press would. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01MXBNaEBmrYDSMcv4NgUWtV --- ui/hud.gd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/hud.gd b/ui/hud.gd index db38780..ee010c5 100644 --- a/ui/hud.gd +++ b/ui/hud.gd @@ -590,6 +590,11 @@ func _present_outcome() -> void: _over_continue.text = "Play Again (Enter)" if _is_final_boss else "Continue (Enter)" _over_continue.visible = _result_win _over_again.visible = not _result_win + # Nothing has focus by default when this screen appears, so a gamepad's ui_accept/ui_left/ + # ui_right (bound to Godot's built-in ui_* actions) would have nothing to act on — grab it + # on the default button, same as main_menu.gd does for its own panels. Geometry-based focus + # neighbors (Godot's default) then let ui_left/ui_right reach Main Menu from here. + (_over_continue if _result_win else _over_again).grab_focus() var path := _THANKYOU_VIDEO if _is_final_boss else (_WIN_VIDEO if _result_win else _LOSS_VIDEO) if ResourceLoader.exists(path):