Skip to content

Commit 5659696

Browse files
committed
chore: Update README and CHANGELOG
Ship 0.7.0 of godot_dart and 0.5.0 of godot_dart_build
1 parent 9907d28 commit 5659696

File tree

5 files changed

+64
-14
lines changed

5 files changed

+64
-14
lines changed

README.md

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ working, 🟨 - Partially working, ❌ - Not working)
1919
| ------- | :-----: | ---- |
2020
| Dart as a Godot Extension Language | 🟨 | |
2121
| Dart Debugging Extension || Attach to `http://127.0.0.1:5858` |
22-
| Dart Available as a Scripting Language | 🟨 | Very early implementation |
23-
| Hot Reload || Reloading from Godot will reload the Dart module. |
22+
| Dart Available as a Scripting Language | 🟨 | Mostly usable in personal testing |
23+
| Hot Reload || Hot Reload button now included. |
2424
| Simplified Binding using build_runner | 🟨 | Early implementation |
25-
| Dart native Variants || Needed for performance reasons |
25+
| Dart native Variants || Needed for performance reasons, Vector2 and Vector3 are done |
2626
| Memory efficiency / Leak prevention || All RefCounted objects appear to be working correclty. |
2727
| Godot Editor inspector integration || |
2828
| Godot Editor -> Dart LSP Integration || |
@@ -86,18 +86,23 @@ class SimpleScript extends Sprite2D {
8686
@GodotProperty()
8787
int speed = 400
8888
89-
// Any method that needs to be seen by a signal needs to be exported
90-
@GodotExport()
91-
void onSignal() {
92-
93-
}
94-
9589
// Overridden virtuals are added automatically via build_runner
9690
@override
9791
void vReady() {}
9892
9993
@override
10094
void vProcess(double delta) {}
95+
96+
// You can also export methods for RPC
97+
@GodotRpc(mode: MultiplayerAPIRPCMode.rpcModeAnyPeer, callLocal: true)
98+
void rpcMesssage(String message) {}
99+
100+
// Any method that needs to be seen by a signal needs to be exported
101+
@GodotExport()
102+
void onSignal() {
103+
// To call and RPC as an RPC you use the $rpc variable
104+
$rpc.rpcMessage('message');
105+
}
101106
}
102107
```
103108

@@ -192,14 +197,47 @@ So instead, Godot Dart prefixes all virtual methods with `v`.
192197

193198
### Indirectly Calling Godot Functions
194199

195-
The Dart API uses `lowerPascalCase` instead of `snake_case` in GDScript/C++. Where possible, fields and getters/setters have been converted to properties. In general, the Dart Godot API strives to be as idiomatic as is reasonably possible.
200+
The Dart API uses `lowerPascalCase` instead of `snake_case` in GDScript/C++. In general, the Dart Godot API
201+
strives to be as idiomatic as is reasonably possible.
196202

197-
However, Godot still thinks of these methods as being named in `snake_case`, so if you are calling them by their name (for example)
203+
However, Godot still thinks of these methods as being named in `snake_case`, so if you are calling them by their name
198204
when using `call`, `callDeferred`, `connect`, or `callGroup`, you need to use `snake_case` for the method name.
199205

200206
Basically, if you defined the method, use `lowerPascalCase`. If Godot defined the method, use `snake_case`. And if Godot defined
201207
the method and its virtual, use `_snake_case` instead of `vPascalCase` currently used in Dart.
202208

209+
### Lack of Properties
210+
211+
While Dart supports properties, I have specifically not converted Godot fields to Dart properties, and instead leave them
212+
with `getX` and `setX` methods.
213+
214+
This is to avoid [this issue](https://docs.godotengine.org/en/stable/tutorials/scripting/c_sharp/c_sharp_basics.html#common-pitfalls),
215+
which is common with this type of embedding. For example:
216+
217+
```dart
218+
// The `x` property on the vector is set, but the `position` is not changed because the position
219+
// setter is never called, therefore the change is never broadcast back to Godot
220+
position.x += 5
221+
```
222+
223+
The common workaround for this is to do this:
224+
225+
```dart
226+
final pos = position;
227+
pos.x = 5;
228+
position = pos;
229+
```
230+
231+
But in my opinion, this defeats the purpose of wrapping properties. Properties should mimic public member variables, and, when they
232+
can't, use methods instead.
233+
234+
# Performance
235+
236+
I have not measured the performance of this extension, partially because I know there is a lot of space for improvement in the
237+
embedding library itself, as well as in how the built in types are currently built.
238+
239+
Once I've performed an optimization pass on the library, I'll look into measuring its performance.
240+
203241
# More Info
204242

205243
This utilizes my custom built Dart shared library for embedding Dart, the source

src/dart/godot_dart/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.7.0
2+
3+
- Support parameters on Signals with `SignalArgument`
4+
- Fix using Dart defined scripts as GodotProperties.
5+
- Add support for RPC methods.
6+
17
## 0.6.2
28

39
- Fix a crash when using the indexed getter on `Array`

src/dart/godot_dart/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: godot_dart
22
description: Dart bindings for the Godot game engine
33
repository: https://github.com/fuzzybinary/godot_dart
4-
version: 0.6.2
4+
version: 0.7.0
55

66
environment:
77
sdk: '>=3.2.0 <4.0.0'

src/dart/godot_dart_build/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.5.0
2+
3+
- Support parameters on Signals with `SignalArgument`
4+
- Fix using Dart defined scripts as GodotProperties.
5+
- Add support for RPC methods.
6+
17
## 0.4.0
28

39
- Add correct default property hints to Node and Resource types.

src/dart/godot_dart_build/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: godot_dart_build
22
description: build_runner interface for simplifying binding to Godot
33
repository: https://github.com/fuzzybinary/godot_dart
4-
version: 0.4.0
4+
version: 0.5.0
55

66
environment:
77
sdk: '>=3.5.0 <4.0.0'
@@ -14,7 +14,7 @@ dependencies:
1414
build: ^2.0.0
1515
build_config: ^1.1.1
1616
source_gen: ^1.3.2
17-
godot_dart: '>=0.6.0<1.0.0'
17+
godot_dart: '>=0.7.0<1.0.0'
1818
code_builder: ^4.5.0
1919
dart_style: ^2.3.1
2020
glob: ^2.1.2

0 commit comments

Comments
 (0)