Load ScreenReader as a global, removing the need to instantiate one per scene.

This commit is contained in:
Nolan Darilek 2020-04-12 13:56:54 -05:00
parent a88b30e7d1
commit 7a2e9d53c5
3 changed files with 6 additions and 7 deletions

View File

@ -6,6 +6,7 @@ This starter project sets up [Godot](https://godotengine.org) with the [accessib
* Linux via Speech Dispatcher * Linux via Speech Dispatcher
* Windows via Tolk, including SAPI support for anyone not using a screen reader (not yet tested but code is written) * Windows via Tolk, including SAPI support for anyone not using a screen reader (not yet tested but code is written)
* Android
## Usage ## 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. * 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. * 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. * A Main scene with a script is created, and set as the launch scene.
## Accessibility tips ## 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 ## Testing
@ -51,4 +53,4 @@ $ cd ..
$ git commit godot-accessibility -m "Update accessibility plugin." $ 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.

View File

@ -19,6 +19,7 @@ run/main_scene="res://scenes/Main.tscn"
[autoload] [autoload]
ScreenReader="*res://addons/godot-accessibility/ScreenReader.gd"
TTS="*res://addons/godot-tts/TTS.gd" TTS="*res://addons/godot-tts/TTS.gd"
[editor_plugins] [editor_plugins]

View File

@ -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://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"] [node name="Main" type="Node"]
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="ScreenReader" type="Node" parent="."]
script = ExtResource( 2 )