From cda6b66fba37a174a425cc11f530b8349b4abfb8 Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Fri, 16 Feb 2024 14:01:47 -0700 Subject: [PATCH] Upgrade to Bevy 0.13 --- Cargo.toml | 4 ++-- examples/chain.rs | 2 +- examples/react_on_end.rs | 20 ++++++++++++-------- src/plugin.rs | 8 ++++---- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c342b86..d685a35 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,11 +17,11 @@ categories = ["game-development"] interpolation = "0.3" [dependencies.bevy] -version = "0.12" +version = "0.13" default-features = false [dev-dependencies.bevy] -version = "0.12" +version = "0.13" default-features = false features = ["bevy_render", "bevy_sprite", "bevy_ui"] diff --git a/examples/chain.rs b/examples/chain.rs index dfc59d7..5a89e9b 100644 --- a/examples/chain.rs +++ b/examples/chain.rs @@ -47,7 +47,7 @@ fn add_easing( mut commands: Commands, mut removed: RemovedComponents>, ) { - for entity in removed.iter() { + for entity in removed.read() { let transform0 = Transform::default(); let transform1 = Transform::from_translation(Vec3::new(500., 0., 0.)); let transform2 = Transform::from_translation(Vec3::new(500., 300., 0.)); diff --git a/examples/react_on_end.rs b/examples/react_on_end.rs index a47a55e..4ac9c92 100644 --- a/examples/react_on_end.rs +++ b/examples/react_on_end.rs @@ -14,11 +14,13 @@ fn main() -> Result<(), Box> { Ok(()) } -fn setup(mut commands: Commands, windows: Res) { +fn setup(mut commands: Commands, windows: Query<&Window>) { commands.spawn(Camera2dBundle::default()); - let width = windows.primary().width() / 2.0; - let height = windows.primary().height() / 2.0; + let window = windows.single(); + + let width = window.width() / 2.0; + let height = window.height() / 2.0; let x = rand::thread_rng().gen_range(-width..width); let y = rand::thread_rng().gen_range(-height..height); @@ -43,13 +45,15 @@ fn setup(mut commands: Commands, windows: Res) { fn add_new_easing( mut commands: Commands, - removed: RemovedComponents>, + mut removed: RemovedComponents>, transform: Query<&Transform>, - windows: Res, + windows: Query<&Window>, ) { - for entity in removed.iter() { - let width = windows.primary().width() / 2.0; - let height = windows.primary().height() / 2.0; + let window = windows.single(); + + for entity in removed.read() { + let width = window.width() / 2.0; + let height = window.height() / 2.0; let x = rand::thread_rng().gen_range(-width..width); let y = rand::thread_rng().gen_range(-height..height); diff --git a/src/plugin.rs b/src/plugin.rs index c34efeb..6f91b5d 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -56,9 +56,9 @@ pub fn ease_system( } else { if easing.timer.duration().as_secs_f32() != 0. { let progress = if easing.direction == EasingDirection::Forward { - easing.timer.percent() + easing.timer.fraction() } else { - easing.timer.percent_left() + easing.timer.fraction_remaining() }; let factor = progress.compute(easing.ease_function); if let Some(ref start) = easing.start { @@ -141,9 +141,9 @@ pub fn custom_ease_system( } else { if easing.timer.duration().as_secs_f32() != 0. { let progress = if easing.direction == EasingDirection::Forward { - easing.timer.percent() + easing.timer.fraction() } else { - easing.timer.percent_left() + easing.timer.fraction_remaining() }; let factor = progress.compute(easing.ease_function); if let Some(ref start) = easing.start {