full gamepad support

This commit is contained in:
Rendo 2025-07-28 18:03:26 +05:00
commit a57d79e84a
21 changed files with 213 additions and 46 deletions

View file

@ -1,5 +1,24 @@
extends TabContainer
var stolen_focus : Control
func _ready() -> void:
get_viewport().gui_focus_changed.connect(on_focus_changed)
visibility_changed.connect(on_visibility_changed)
func _exit_tree() -> void:
get_viewport().gui_focus_changed.disconnect(on_focus_changed)
func _on_quit_button_pressed() -> void:
visible = false
$ChannelPlayer.call("Play")
func on_visibility_changed():
if visible:
await get_tree().process_frame
$plants/SeedpacketsContainer/GridContainer.get_child(0).grab_focus()
else:
stolen_focus.grab_focus()
func on_focus_changed(to : Control):
if visible: return
stolen_focus = to