mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-11-21 11:35:56 +00:00
Refactor to support running both in the editor and in game UIs.
Here I add a `ScreenReader` `Node` which, when added to the `SceneTree`, should read the contents of any supported `Control`. I also do a bit of cleanup on filenames, as well as breaking the editor plugin support into its own class.
This commit is contained in:
parent
8f9a0cd4d7
commit
981606ab21
12
Plugin.gd
Normal file
12
Plugin.gd
Normal file
|
@ -0,0 +1,12 @@
|
|||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
var ScreenReader = preload("ScreenReader.gd")
|
||||
|
||||
var screen_reader
|
||||
|
||||
func _enter_tree():
|
||||
screen_reader = ScreenReader.new()
|
||||
get_tree().root.call_deferred("add_child", screen_reader)
|
||||
call_deferred("connect", "scene_changed", screen_reader, "set_initial_scene_focus")
|
||||
call_deferred("connect", "main_screen_changed", screen_reader, "set_initial_screen_focus")
|
|
@ -1,7 +1,6 @@
|
|||
tool
|
||||
extends EditorPlugin
|
||||
extends Node
|
||||
|
||||
var Accessible = preload("accessible.gd")
|
||||
var Accessible = preload("Accessible.gd")
|
||||
|
||||
var TTS = preload("../godot-tts/TTS.gd")
|
||||
|
||||
|
@ -49,14 +48,3 @@ func set_initial_scene_focus(scene):
|
|||
func _enter_tree():
|
||||
tts = TTS.new()
|
||||
get_tree().connect("node_added", self, "augment_tree")
|
||||
connect("scene_changed", self, "set_initial_scene_focus")
|
||||
connect("main_screen_changed", self, "set_initial_screen_focus")
|
||||
|
||||
func _exit_tree():
|
||||
# Clean-up of the plugin goes here
|
||||
pass
|
||||
|
||||
func _notification(what):
|
||||
# print("Notified: %s" % what)
|
||||
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
|
||||
print("User requested the project to quit")
|
|
@ -4,4 +4,4 @@ name="Accessibility"
|
|||
description="An accessibility layer for Godot."
|
||||
author="Nolan Darilek"
|
||||
version="0.1.0"
|
||||
script="accessibility.gd"
|
||||
script="Plugin.gd"
|
||||
|
|
Loading…
Reference in New Issue
Block a user