full gamepad support
This commit is contained in:
parent
31ba172123
commit
a57d79e84a
21 changed files with 213 additions and 46 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue