2018-05-28 16:48:02 +00:00
|
|
|
extends Object
|
|
|
|
|
|
|
|
var node
|
|
|
|
|
2018-05-28 21:45:13 +00:00
|
|
|
func focused():
|
2018-06-07 21:28:33 +00:00
|
|
|
print("Focus entered.", self.node)
|
2018-05-28 16:48:02 +00:00
|
|
|
|
2018-05-28 21:45:13 +00:00
|
|
|
func unfocused():
|
2018-06-07 21:28:33 +00:00
|
|
|
print("Unfocused", self.node)
|
2018-05-28 21:09:29 +00:00
|
|
|
|
2018-05-28 21:45:13 +00:00
|
|
|
func gui_input():
|
2018-05-28 16:48:02 +00:00
|
|
|
print("GUI input.")
|
|
|
|
|
|
|
|
func _init(node):
|
2018-06-07 21:18:36 +00:00
|
|
|
if node.is_in_group("accessible"):
|
|
|
|
return
|
|
|
|
node.add_to_group("accessible")
|
2018-06-07 21:28:33 +00:00
|
|
|
print(node.get_path())
|
2018-05-28 16:48:02 +00:00
|
|
|
self.node = node
|
2018-06-07 21:28:33 +00:00
|
|
|
self.node.set_focus_mode(Control.FOCUS_ALL)
|
2018-05-28 21:45:13 +00:00
|
|
|
self.node.connect("focus_entered", self, "focused")
|
|
|
|
self.node.connect("mouse_entered", self, "focused")
|
|
|
|
self.node.connect("focus_exited", self, "unfocused")
|
|
|
|
self.node.connect("mouse_exited", self, "unfocused")
|
|
|
|
self.node.connect("gui_input", self, "gui_input")
|
2018-05-28 16:48:02 +00:00
|
|
|
self.node.connect("tree_exiting", self, "free")
|