From 7a2e9d53c5d38f68a41912b9629a207feaf07c8d Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Sun, 12 Apr 2020 13:56:54 -0500 Subject: [PATCH] Load `ScreenReader` as a global, removing the need to instantiate one per scene. --- README.md | 6 ++++-- project.godot | 1 + scenes/Main.tscn | 6 +----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 30dd6f2..b67400b 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ This starter project sets up [Godot](https://godotengine.org) with the [accessib * Linux via Speech Dispatcher * Windows via Tolk, including SAPI support for anyone not using a screen reader (not yet tested but code is written) + * Android ## Usage @@ -30,11 +31,12 @@ from within this repository and start building your game! * The accessibility plugin is automatically loaded, eliminating the need to use the inaccessible editor to enable it. * TTS is loaded in a global script which is available in every node. Run `TTS.speak("Text to speak", interrupt)` from anywhere in your code to speak something. See _scenes/Main.gd_ as an example. + * `ScreenReader` is also loaded as a global node, making in-game user interfaces automatically accessible. * A Main scene with a script is created, and set as the launch scene. ## Accessibility tips - * Navigate to Editor -> Editor Settings -> External Editor, check the box, and enter a path to an accessible text editor. The embedded Godot script editor is not currently accessible, and may not be for a long time or at all. + * Navigate to Editor -> Editor Settings -> External Editor, check the box, and enter a path to an accessible text editor. The embedded Godot script editor is not currently accessible, and may not be for a long time or at all. VSCode is a good option. ## Testing @@ -51,4 +53,4 @@ $ cd .. $ git commit godot-accessibility -m "Update accessibility plugin." ``` -or something similar. Likewise, you'll also likely want to upgrade the godot-tts plugin from time to time. +or something similar. Likewise, you'll also likely want to upgrade the godot-tts plugin from time to time, and check this starter for current suggested best practices. diff --git a/project.godot b/project.godot index 38dfdcd..a4d25f3 100644 --- a/project.godot +++ b/project.godot @@ -19,6 +19,7 @@ run/main_scene="res://scenes/Main.tscn" [autoload] +ScreenReader="*res://addons/godot-accessibility/ScreenReader.gd" TTS="*res://addons/godot-tts/TTS.gd" [editor_plugins] diff --git a/scenes/Main.tscn b/scenes/Main.tscn index d3b6a27..0fc71d5 100644 --- a/scenes/Main.tscn +++ b/scenes/Main.tscn @@ -1,10 +1,6 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=2 format=2] [ext_resource path="res://scenes/Main.gd" type="Script" id=1] -[ext_resource path="res://addons/godot-accessibility/ScreenReader.gd" type="Script" id=2] [node name="Main" type="Node"] script = ExtResource( 1 ) - -[node name="ScreenReader" type="Node" parent="."] -script = ExtResource( 2 )