RetroDECK/tools/configurator/main.gd

38 lines
1.1 KiB
GDScript

extends Control
func _ready():
var children = findElements(self, "Control")
for n: Control in children: #iterate the children to grab focus on mouse hov
if (n.focus_mode == FOCUS_ALL):
n.mouse_entered.connect(_on_control_mouse_entered.bind(n))
#Translation tests
$Background/MarginContainer/TabContainer/TK_SYSTEM/ScrollContainer/VBoxContainer/game_control_container/GridContainer/cheats.text = tr("TK_CHEATS") + " " + tr("TK_SOON")
func _input(event):
if event.is_action_pressed("quit"):
_exit()
func findElements(node: Node, className: String, result: Array = []) -> Array:
if node.is_class(className):
result.push_back(node)
for child in node.get_children():
result = findElements(child, className, result)
return result
func _on_control_mouse_entered(control: Node):
control.grab_focus()
func _on_quickresume_advanced_pressed():
var popup = load("res://components/popup.tscn").instantiate() as Control
popup.set_content("res://popup_content_test.tscn")
$Background.add_child(popup)
func _on_exit_button_pressed():
_exit()
func _exit():
get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
get_tree().quit()