Skip to content

Commit

Permalink
Upgrade to Bevy 0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
rparrett authored and mockersf committed Feb 18, 2024
1 parent 8b8ebb7 commit cda6b66
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion examples/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn add_easing(
mut commands: Commands,
mut removed: RemovedComponents<EasingChainComponent<Transform>>,
) {
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.));
Expand Down
20 changes: 12 additions & 8 deletions examples/react_on_end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}

fn setup(mut commands: Commands, windows: Res<Windows>) {
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);

Expand All @@ -43,13 +45,15 @@ fn setup(mut commands: Commands, windows: Res<Windows>) {

fn add_new_easing(
mut commands: Commands,
removed: RemovedComponents<EasingComponent<Transform>>,
mut removed: RemovedComponents<EasingComponent<Transform>>,
transform: Query<&Transform>,
windows: Res<Windows>,
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);

Expand Down
8 changes: 4 additions & 4 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ pub fn ease_system<T: Ease + Component>(
} 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 {
Expand Down Expand Up @@ -141,9 +141,9 @@ pub fn custom_ease_system<T: CustomComponentEase + Component>(
} 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 {
Expand Down

0 comments on commit cda6b66

Please sign in to comment.