godot-accessibility/addons/accessibility/accessible.gd

26 lines
654 B
GDScript3
Raw Normal View History

extends Object
var node
2018-05-28 21:45:13 +00:00
func focused():
print("Focus entered.", self.node)
2018-05-28 21:45:13 +00:00
func unfocused():
pass
func gui_input(event):
pass
func _init(node):
if node.is_in_group("accessible"):
return
node.add_to_group("accessible")
self.node = node
# 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")
self.node.connect("tree_exiting", self, "free")