From 0e83927a0ba18c55d9aa7c64912bdfac77610b33 Mon Sep 17 00:00:00 2001 From: Sofia Date: Wed, 15 Jul 2026 18:25:12 +0300 Subject: [PATCH] Perform initialization --- godot/QuakeBall.gdextension | 14 +++ godot/QuakeBall.gdextension.uid | 1 + rust/Cargo.lock | 152 +++++++++++++++++++++++++++++++- rust/Cargo.toml | 7 +- rust/src/lib.rs | 16 +--- 5 files changed, 176 insertions(+), 14 deletions(-) create mode 100644 godot/QuakeBall.gdextension create mode 100644 godot/QuakeBall.gdextension.uid diff --git a/godot/QuakeBall.gdextension b/godot/QuakeBall.gdextension new file mode 100644 index 0000000..6812bbe --- /dev/null +++ b/godot/QuakeBall.gdextension @@ -0,0 +1,14 @@ +[configuration] +entry_symbol = "gdext_rust_init" +compatibility_minimum = 4.1 +reloadable = true + +[libraries] +linux.debug.x86_64 = "res://../rust/target/debug/libquakeball.so" +linux.release.x86_64 = "res://../rust/target/release/libquakeball.so" +windows.debug.x86_64 = "res://../rust/target/debug/quakeball.dll" +windows.release.x86_64 = "res://../rust/target/release/quakeball.dll" +macos.debug = "res://../rust/target/debug/libquakeball.dylib" +macos.release = "res://../rust/target/release/libquakeball.dylib" +macos.debug.arm64 = "res://../rust/target/debug/libquakeball.dylib" +macos.release.arm64 = "res://../rust/target/release/libquakeball.dylib" \ No newline at end of file diff --git a/godot/QuakeBall.gdextension.uid b/godot/QuakeBall.gdextension.uid new file mode 100644 index 0000000..ee50ae3 --- /dev/null +++ b/godot/QuakeBall.gdextension.uid @@ -0,0 +1 @@ +uid://70kg718l85bx diff --git a/rust/Cargo.lock b/rust/Cargo.lock index a3a2955..0a07979 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -3,5 +3,155 @@ version = 4 [[package]] -name = "quakeball-rust" +name = "gdextension-api" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3489a9e7463353467db3cfe3eb12de31c9b6200e4f928bde4959bf5db5b31d2f" + +[[package]] +name = "glam" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f70749695b063ecbf6b62949ccccde2e733ec3ecbbd71d467dca4e5c6c97cca0" + +[[package]] +name = "godot" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4452effbae3a093b187f82149b6b0025667cde9993b22769a012d5bac9e8f39f" +dependencies = [ + "godot-core", + "godot-macros", +] + +[[package]] +name = "godot-bindings" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773860a42753be6f8bdc40fe8e0ee169164a83605ab7d6dc0c9b746892cd85ed" +dependencies = [ + "gdextension-api", +] + +[[package]] +name = "godot-cell" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18d30809e2d52da0402ad4c6f1d77b9d35832481c9527bc24a63412bc05252d" + +[[package]] +name = "godot-codegen" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85875076fc06a8ad5a452e494274f233da060764208caf2beac2cde4c9df15b5" +dependencies = [ + "godot-bindings", + "heck", + "nanoserde", + "proc-macro2", + "quote", +] + +[[package]] +name = "godot-core" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d22572dbf40e5cf4bf36c05da54f9d46dd1ff0944b6e6c7ee412c16386fe88" +dependencies = [ + "glam", + "godot-bindings", + "godot-cell", + "godot-codegen", + "godot-ffi", +] + +[[package]] +name = "godot-ffi" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854633981e4f54c84d240d76ac71a816c738890774291f7d430a0adb29db9bd2" +dependencies = [ + "godot-bindings", + "godot-codegen", + "libc", +] + +[[package]] +name = "godot-macros" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37dc9ce1b970e798df827dcccfe68d5985804f93b5fbab156e507999272965f0" +dependencies = [ + "godot-bindings", + "proc-macro2", + "quote", + "venial", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "nanoserde" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a36fb3a748a4c9736ed7aeb5f2dfc99665247f1ce306abbddb2bf0ba2ac530a4" +dependencies = [ + "nanoserde-derive", +] + +[[package]] +name = "nanoserde-derive" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a846cbc04412cf509efcd8f3694b114fc700a035fb5a37f21517f9fb019f1ebc" + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quakeball" version = "0.1.0" +dependencies = [ + "godot", +] + +[[package]] +name = "quote" +version = "1.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "venial" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a42528baceab6c7784446df2a10f4185078c39bf73dc614f154353f1a6b1229" +dependencies = [ + "proc-macro2", + "quote", +] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 3fc04f3..bf479e6 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,11 @@ [package] -name = "quakeball-rust" +name = "quakeball" version = "0.1.0" edition = "2024" +[lib] +crate-type = ["cdylib"] # Compile this crate to a dynamic C library. + [dependencies] +godot = "0.5.4" + diff --git a/rust/src/lib.rs b/rust/src/lib.rs index b93cf3f..3aa7156 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1,14 +1,6 @@ -pub fn add(left: u64, right: u64) -> u64 { - left + right -} +use godot::prelude::*; -#[cfg(test)] -mod tests { - use super::*; +struct MyExtension; - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} +#[gdextension] +unsafe impl ExtensionLibrary for MyExtension {}