From 72648deff3a1c642a65d7f72fd03d6ef67c675b4 Mon Sep 17 00:00:00 2001 From: Yarvin Date: Mon, 8 Dec 2025 13:11:59 +0100 Subject: [PATCH] Update demo projects and macOS x86 (Intel) from CI - Update demo projects after recent changes in API (`Basis::looking_at`) - Make sure that all demos use same feature set, so they will behave consistently while sharing dependencies after being built in bulk (for example in the CI). - Remove runners for macOS x86 (Intel) architecture which are being phased out by GitHub. --- .github/workflows/ci.yml | 6 ------ dodge-the-creeps/rust/Cargo.toml | 2 +- net-pong/rust/Cargo.toml | 2 +- net-pong/rust/src/ball.rs | 11 +++++------ net-pong/rust/src/paddle.rs | 4 ++-- squash-the-creeps/rust/src/player.rs | 2 +- 6 files changed, 10 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7b931f..5d0ea24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -154,12 +154,6 @@ jobs: # macOS builds fail semi-randomly with an `libc++abi: Pure virtual function called!` error. # For now on run them with retry; resort to compiling only if it won't be enough (i.e. first time when it will fail three times in the row). # See: https://github.com/godot-rust/demo-projects/issues/12 - - name: macos-x86 - os: macos-13 - artifact-name: macos-x86-nightly - godot-binary: godot.macos.editor.dev.x86_64 - retry: true - - name: macos-arm os: macos-latest artifact-name: macos-arm-nightly diff --git a/dodge-the-creeps/rust/Cargo.toml b/dodge-the-creeps/rust/Cargo.toml index 6e127dd..9120dfe 100644 --- a/dodge-the-creeps/rust/Cargo.toml +++ b/dodge-the-creeps/rust/Cargo.toml @@ -11,6 +11,6 @@ crate-type = ["cdylib"] [dependencies] rand = "0.8" -godot = { git = "https://github.com/godot-rust/gdext.git" } +godot = { git = "https://github.com/godot-rust/gdext.git", features = ["register-docs"]} # For Wasm, feature "experimental-wasm" can be added, but this is already done in build-wasm.sh script. diff --git a/net-pong/rust/Cargo.toml b/net-pong/rust/Cargo.toml index 4225702..78adf8a 100644 --- a/net-pong/rust/Cargo.toml +++ b/net-pong/rust/Cargo.toml @@ -7,7 +7,7 @@ license = "MPL-2.0" publish = false [dependencies] -godot = {git = "https://github.com/godot-rust/gdext.git"} +godot = {git = "https://github.com/godot-rust/gdext.git", features = ["register-docs"]} [lib] crate-type = ["cdylib"] # Compile this crate to a dynamic C library. diff --git a/net-pong/rust/src/ball.rs b/net-pong/rust/src/ball.rs index 6872fa3..bb7408c 100644 --- a/net-pong/rust/src/ball.rs +++ b/net-pong/rust/src/ball.rs @@ -2,7 +2,7 @@ use crate::pong::Pong; use godot::classes::{Area2D, IArea2D}; use godot::prelude::*; -const DEFAULT_SPEED: f64 = 100.0; +const DEFAULT_SPEED: f32 = 100.0; #[derive(GodotClass)] #[class(init, base=Area2D)] @@ -11,13 +11,13 @@ pub struct Ball { direction: Vector2, stopped: bool, #[init(val = DEFAULT_SPEED)] - speed: f64, + speed: f32, base: Base, } #[godot_api] impl IArea2D for Ball { - fn process(&mut self, delta: f64) { + fn process(&mut self, delta: f32) { let screen_size = self.base().get_viewport_rect().size; self.speed += delta; @@ -26,7 +26,7 @@ impl IArea2D for Ball { // even if it's sightly out of sync between them, // so each player sees the motion as smooth and not jerky. let direction = self.direction; - let translation = direction * (self.speed * delta) as f32; + let translation = direction * self.speed * delta; self.base_mut().translate(translation); } @@ -39,8 +39,7 @@ impl IArea2D for Ball { } let mut parent = self.base().get_parent().unwrap().cast::(); - // Allows re-entrancy – required if a game stops and we need to reset our ball. - // this help fixes the double bind error + // Use base_mut() to allow for reentrancy – required if a game stops, and we need to reset our ball. let mut guard = self.base_mut(); if guard.is_multiplayer_authority() { // Only the master will decide when the ball is out on diff --git a/net-pong/rust/src/paddle.rs b/net-pong/rust/src/paddle.rs index b5f58d4..122202a 100644 --- a/net-pong/rust/src/paddle.rs +++ b/net-pong/rust/src/paddle.rs @@ -38,7 +38,7 @@ impl IArea2D for Paddle { }); } - fn process(&mut self, delta: f64) { + fn process(&mut self, delta: f32) { if self.base().is_multiplayer_authority() { let input = Input::singleton(); self.motion = input.get_axis("move_up", "move_down"); @@ -57,7 +57,7 @@ impl IArea2D for Paddle { self.you_label.hide(); } - let translation = Vector2::new(0.0, self.motion * delta as f32); + let translation = Vector2::new(0.0, self.motion * delta); self.base_mut().translate(translation); diff --git a/squash-the-creeps/rust/src/player.rs b/squash-the-creeps/rust/src/player.rs index 8d5cad4..c329551 100644 --- a/squash-the-creeps/rust/src/player.rs +++ b/squash-the-creeps/rust/src/player.rs @@ -55,7 +55,7 @@ impl ICharacterBody3D for Player { let mut pivot = self.base_mut().get_node_as::("Pivot"); // Setting the basis property will affect the rotation of the node. - pivot.set_basis(Basis::looking_at(-direction, Vector3::UP, true)); + pivot.set_basis(Basis::looking_at(-direction)); self.base() .get_node_as::("AnimationPlayer") .set_speed_scale(4.0);