diff --git a/example/2d_tutorial/project.godot b/example/2d_tutorial/project.godot
index c0b963a..159d947 100644
--- a/example/2d_tutorial/project.godot
+++ b/example/2d_tutorial/project.godot
@@ -12,7 +12,7 @@ config_version=5
config/name="simple"
run/main_scene="res://main.tscn"
-config/features=PackedStringArray("4.3", "Forward Plus")
+config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="res://icon.svg"
[display]
@@ -25,21 +25,21 @@ window/stretch/mode="canvas_items"
move_right={
"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-3,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
move_left={
"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-3,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
move_up={
"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-3,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
move_down={
"deadzone": 0.5,
-"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-3,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
diff --git a/example/2d_tutorial/src/lib/player.dart b/example/2d_tutorial/src/lib/player.dart
index e6e9cfa..77e2ec2 100644
--- a/example/2d_tutorial/src/lib/player.dart
+++ b/example/2d_tutorial/src/lib/player.dart
@@ -71,6 +71,7 @@ class Player extends Area2D {
setPosition(position);
}
+ @GodotRpc()
void start(Vector2 pos) {
setPosition(pos);
show();
diff --git a/example/2d_tutorial/src/pubspec.lock b/example/2d_tutorial/src/pubspec.lock
index 56ff2cd..5525ee5 100644
--- a/example/2d_tutorial/src/pubspec.lock
+++ b/example/2d_tutorial/src/pubspec.lock
@@ -199,14 +199,14 @@ packages:
path: "../../../src/dart/godot_dart"
relative: true
source: path
- version: "0.3.0"
+ version: "0.6.2"
godot_dart_build:
dependency: "direct dev"
description:
path: "../../../src/dart/godot_dart_build"
relative: true
source: path
- version: "0.2.0"
+ version: "0.4.0"
graphs:
dependency: transitive
description:
@@ -480,4 +480,4 @@ packages:
source: hosted
version: "3.1.2"
sdks:
- dart: ">=3.5.0-259.0.dev <4.0.0"
+ dart: ">=3.5.0 <4.0.0"
diff --git a/example/networking-demo/.editorconfig b/example/networking-demo/.editorconfig
new file mode 100644
index 0000000..f28239b
--- /dev/null
+++ b/example/networking-demo/.editorconfig
@@ -0,0 +1,4 @@
+root = true
+
+[*]
+charset = utf-8
diff --git a/example/networking-demo/.gitattributes b/example/networking-demo/.gitattributes
new file mode 100644
index 0000000..8ad74f7
--- /dev/null
+++ b/example/networking-demo/.gitattributes
@@ -0,0 +1,2 @@
+# Normalize EOL for all files that Git considers text files.
+* text=auto eol=lf
diff --git a/example/networking-demo/.gitignore b/example/networking-demo/.gitignore
new file mode 100644
index 0000000..28fc9dc
--- /dev/null
+++ b/example/networking-demo/.gitignore
@@ -0,0 +1,10 @@
+# Godot 4+ specific ignores
+.godot/
+/android/
+
+# Ignore built libraries
+*.dll
+*.lib
+*.dylib
+*.pdb
+*.exp
diff --git a/example/networking-demo/godot_dart.gdextension b/example/networking-demo/godot_dart.gdextension
new file mode 100644
index 0000000..85f9df9
--- /dev/null
+++ b/example/networking-demo/godot_dart.gdextension
@@ -0,0 +1,15 @@
+[configuration]
+
+entry_symbol = "godot_dart_init"
+compatibility_minimum = 4.2
+
+[icons]
+
+DartScript = "res://logo_dart.svg"
+
+[libraries]
+
+windows.x86_64 = "godot_dart.dll"
+linux.x86_64 = "libgodot_dart.so"
+macos.arm64 = "libgodot_dart.dylib"
+
diff --git a/example/networking-demo/icon.svg b/example/networking-demo/icon.svg
new file mode 100644
index 0000000..9d8b7fa
--- /dev/null
+++ b/example/networking-demo/icon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/example/networking-demo/icon.svg.import b/example/networking-demo/icon.svg.import
new file mode 100644
index 0000000..337fcda
--- /dev/null
+++ b/example/networking-demo/icon.svg.import
@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://b0g1bchdfioi2"
+path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://icon.svg"
+dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/example/networking-demo/logo_dart.svg b/example/networking-demo/logo_dart.svg
new file mode 100644
index 0000000..b9ddcdf
--- /dev/null
+++ b/example/networking-demo/logo_dart.svg
@@ -0,0 +1,23 @@
+
+
+
diff --git a/example/networking-demo/logo_dart.svg.import b/example/networking-demo/logo_dart.svg.import
new file mode 100644
index 0000000..8953542
--- /dev/null
+++ b/example/networking-demo/logo_dart.svg.import
@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://bvvbwm6rscs1r"
+path="res://.godot/imported/logo_dart.svg-7d78e4990ae1b9cb0a988a5863e5eb62.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://logo_dart.svg"
+dest_files=["res://.godot/imported/logo_dart.svg-7d78e4990ae1b9cb0a988a5863e5eb62.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/example/networking-demo/project.godot b/example/networking-demo/project.godot
new file mode 100644
index 0000000..74582ba
--- /dev/null
+++ b/example/networking-demo/project.godot
@@ -0,0 +1,16 @@
+; Engine configuration file.
+; It's best edited using the editor UI and not directly,
+; since the parameters that go here are not all obvious.
+;
+; Format:
+; [section] ; section goes between []
+; param=value ; assign values to parameters
+
+config_version=5
+
+[application]
+
+config/name="Networking Demo"
+run/main_scene="res://world.tscn"
+config/features=PackedStringArray("4.4", "Forward Plus")
+config/icon="res://icon.svg"
diff --git a/example/networking-demo/src/.gitignore b/example/networking-demo/src/.gitignore
new file mode 100644
index 0000000..fbef684
--- /dev/null
+++ b/example/networking-demo/src/.gitignore
@@ -0,0 +1,9 @@
+# Files and directories created by pub.
+.dart_tool/
+.packages
+
+# Conventional directory for build output.
+build/
+
+# Don't check in generated files
+*.g.dart
\ No newline at end of file
diff --git a/example/networking-demo/src/analysis_options.yaml b/example/networking-demo/src/analysis_options.yaml
new file mode 100644
index 0000000..afd4b53
--- /dev/null
+++ b/example/networking-demo/src/analysis_options.yaml
@@ -0,0 +1,16 @@
+include: package:lints/recommended.yaml
+
+# Uncomment the following section to specify additional rules.
+
+analyzer:
+ exclude:
+ - lib/src/gdextension_bindings.dart
+ language:
+ strict-casts: true
+ strict-raw-types: true
+
+linter:
+ rules:
+ prefer_single_quotes: true
+ prefer_relative_imports: true
+ unawaited_futures: true
\ No newline at end of file
diff --git a/example/networking-demo/src/lib/world.dart b/example/networking-demo/src/lib/world.dart
new file mode 100644
index 0000000..cb64735
--- /dev/null
+++ b/example/networking-demo/src/lib/world.dart
@@ -0,0 +1,68 @@
+import 'package:godot_dart/godot_dart.dart';
+
+part 'world.g.dart';
+
+@GodotScript()
+class World extends Node2D {
+ static TypeInfo get sTypeInfo => _$WorldTypeInfo();
+ @override
+ TypeInfo get typeInfo => sTypeInfo;
+
+ World() : super();
+
+ World.withNonNullOwner(super.owner) : super.withNonNullOwner();
+
+ static const port = 12912;
+
+ final enetPeer = ENetMultiplayerPeer();
+ late TextEdit _messages;
+ late LineEdit _userNameBox;
+ late LineEdit _line;
+
+ String username = 'Unknown';
+
+ @override
+ void vReady() {
+ _line = getNodeT('Line')!;
+ _messages = getNodeT('Messages')!;
+ _userNameBox = getNodeT('Username')!;
+ }
+
+ @GodotExport()
+ void onHostPressed() {
+ enetPeer.createServer(port);
+
+ getMultiplayer()!.setMultiplayerPeer(enetPeer);
+ _joined();
+ }
+
+ @GodotExport()
+ void onJoinPressed() {
+ enetPeer.createClient('127.0.0.1', port);
+ getMultiplayer()!.setMultiplayerPeer(enetPeer);
+ _joined();
+ }
+
+ @GodotRpc(mode: MultiplayerAPIRPCMode.rpcModeAnyPeer, callLocal: true)
+ void messageRpc(String username, String data) {
+ final newText = _messages.getText() + '$username: $data\n';
+ _messages.setText(newText);
+ }
+
+ @GodotExport()
+ void onSendPressed() {
+ final line = _line.getText();
+ _line.setText('');
+ $rpc.messageRpc(username, line);
+ }
+
+ void _joined() {
+ username = _userNameBox.getText();
+ if (username.isEmpty) {
+ username = 'Unknown';
+ }
+ getNodeT