diff --git a/Godottest/deckbuilder.gdextension b/Godottest/deckbuilder.gdextension new file mode 100644 index 0000000..e52ec3d --- /dev/null +++ b/Godottest/deckbuilder.gdextension @@ -0,0 +1,14 @@ +[configuration] +entry_symbol = "gdext_rust_init" +compatibility_minimum = 4.3 +reloadable = true + +[libraries] +linux.debug.x86_64 = "res://../deckbuilder/target/debug/libdeckbuilder.so" +linux.release.x86_64 = "res://../deckbuilder/target/release/libdeckbuilder.so" +windows.debug.x86_64 = "res://../deckbuilder/target/debug/deckbuilder.dll" +windows.release.x86_64 = "res://../deckbuilder/target/release/deckbuilder.dll" +macos.debug = "res://../deckbuilder/target/debug/libdeckbuilder.dylib" +macos.release = "res://../deckbuilder/target/release/libdeckbuilder.dylib" +macos.debug.arm64 = "res://../deckbuilder/target/debug/libdeckbuilder.dylib" +macos.release.arm64 = "res://../deckbuilder/target/release/libdeckbuilder.dylib" diff --git a/Godottest/project.godot b/Godottest/project.godot index 6f88b45..07353d7 100644 --- a/Godottest/project.godot +++ b/Godottest/project.godot @@ -12,7 +12,7 @@ config_version=5 config/name="videoproject" run/main_scene="res://res/node_2d.tscn" -config/features=PackedStringArray("4.3", "Forward Plus") +config/features=PackedStringArray("4.4", "Forward Plus") boot_splash/bg_color=Color(0, 0, 0, 1) boot_splash/show_image=false diff --git a/deckbuilder/src/lib.rs b/deckbuilder/src/lib.rs index e0f93aa..1167a8e 100644 --- a/deckbuilder/src/lib.rs +++ b/deckbuilder/src/lib.rs @@ -1,3 +1,37 @@ +use godot::prelude::*; + +// #![allow(unused)] +fn main() { + struct MyExtension; + + #[gdextension] + unsafe impl ExtensionLibrary for MyExtension {} +} + +use godot::classes::{INode, Node}; + +#[derive(GodotClass)] +#[class(base=Node)] +struct MyPlayer { + speed: f64, + angular_speed: f64, + + base: Base, +} + +#[godot_api] +impl INode for MyPlayer { + fn init(base: Base) -> Self { + godot_print!("Hello, worldd!"); // Prints to the Godot console + + Self { + speed: 400.0, + angular_speed: std::f64::consts::PI, + base, + } + } +} + pub mod tutorial; mod logger;