Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dodge-the-creeps/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.

2 changes: 1 addition & 1 deletion net-pong/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
11 changes: 5 additions & 6 deletions net-pong/rust/src/ball.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -11,13 +11,13 @@ pub struct Ball {
direction: Vector2,
stopped: bool,
#[init(val = DEFAULT_SPEED)]
speed: f64,
speed: f32,
base: Base<Area2D>,
}

#[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;

Expand All @@ -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);
}

Expand All @@ -39,8 +39,7 @@ impl IArea2D for Ball {
}

let mut parent = self.base().get_parent().unwrap().cast::<Pong>();
// 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
Expand Down
4 changes: 2 additions & 2 deletions net-pong/rust/src/paddle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion squash-the-creeps/rust/src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl ICharacterBody3D for Player {
let mut pivot = self.base_mut().get_node_as::<Node3D>("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>("AnimationPlayer")
.set_speed_scale(4.0);
Expand Down
Loading