@@ -72,10 +72,10 @@ part 'simple_script.g.dart';
7272class SimpleScript extends Sprite2D {
7373 // Return the type info that was generated...
7474 @pragma('vm:entry-point')
75- static TypeInfo get sTypeInfo => _$SimpleScriptTypeInfo();
75+ static final ExtensionTypeInfo<SimpleScript> sTypeInfo = _$SimpleScriptTypeInfo();
7676 // And provide an instance method to get the type info
7777 @override
78- TypeInfo get typeInfo => SimpleScript. sTypeInfo;
78+ ExtensionTypeInfo<SimpleScript> get typeInfo => sTypeInfo;
7979
8080 // Required constructor
8181 SimpleScript() : super();
@@ -124,8 +124,9 @@ void main() {
124124
125125### Signals
126126
127- You can add signals to your script with the ` GodotSignal ` property. This takes the signal name and a list
128- of arguments for the signal:
127+ You can add signals to your script with the ` GodotSignal ` property, and adding one of the ` SignalX ` objects
128+ provided by Godot Dart, depending on the number of arguments: ` Signal0 ` for a signal with zero arguments,
129+ ` Signal1 ` for a signal with 1, etc.
129130
130131``` dart
131132@GodotScript()
@@ -134,13 +135,13 @@ class Hud extends CanvasLayer {
134135
135136
136137 @GodotSignal('start_game')
137- late final Signal _startGame = Signal.fromObjectSignal (this, 'start_game');
138+ late final Signal0 _startGame = Signal0 (this, 'start_game');
138139}
139140```
140141
141- You can then emit signals with ` Signal .emit` .
142+ You can then emit signals with ` SignalX .emit` .
142143
143- Classes from Godot support type safe signal subscription for each or their signals . For example, if you
144+ These signals, and those provided in Godot, support type safe signal subscription. For example, if you
144145want to subscribe to the ` animation_added ` signal on ` AnimationLibrary ` , you can do so like so:
145146
146147``` dart
@@ -239,9 +240,9 @@ void main() {
239240
240241### Casting
241242
242- Early versions of Godot Dart required using ` .cast<T> ` to perform downcasting. This is no longer
243- necessary. Dart's built in ` is ` and ` as ` operators should now work to perform downcasting. ` cast<T> `
244- has also been removed and replaced with ` .as<T> ` , which is an implementation of ` as? ` or ` dynamic_cast ` .
243+ Dart's built in ` is ` and ` as ` operators should now work to perform downcasting. Godot Dart provides a convenience
244+ extension method ` .as<T> ` , which is an implementation of ` as? ` or ` dynamic_cast ` , and returns ` null ` if the
245+ object is not of the expected type .
245246
246247### Virtual functions
247248
0 commit comments