2023-09-23 16:24:55 +00:00
|
|
|
extends Control
|
|
|
|
|
|
|
|
func _ready():
|
2023-12-31 07:58:20 +00:00
|
|
|
var children = findElements(self, "Control")
|
2024-01-11 07:20:52 +00:00
|
|
|
for n: Control in children: #iterate the children to grab focus on mouse hov
|
|
|
|
if (n.focus_mode != FOCUS_NONE):
|
|
|
|
n.mouse_entered.connect(_on_control_mouse_entered.bind(n))
|
2023-12-21 10:29:46 +00:00
|
|
|
|
|
|
|
func _input(event):
|
|
|
|
if event.is_action_pressed("quit"):
|
|
|
|
get_tree().quit()
|
2023-12-31 07:58:20 +00:00
|
|
|
|
|
|
|
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()
|