Skip to content

Commit

Permalink
Upgrade to Bevy 0.14 (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
djeedai authored Jul 8, 2024
1 parent 2357672 commit ef7090c
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 110 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_tweening"
version = "0.10.0"
version = "0.11.0"
authors = ["François Mockers <[email protected]>", "Jerome Humbert <[email protected]>"]
edition = "2021"
description = "Tweening animation plugin for the Bevy game engine"
Expand All @@ -25,10 +25,10 @@ bevy_text = ["bevy/bevy_text", "bevy/bevy_render", "bevy/bevy_sprite"]

[dependencies]
interpolation = "0.3"
bevy = { version = "0.13", default-features = false }
bevy = { version = "0.14", default-features = false }

[dev-dependencies]
bevy-inspector-egui = "0.23"
bevy-inspector-egui = "0.25"

[[example]]
name = "menu"
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ criterion = { version = "0.5", features = ["html_reports"] }
bevy_tweening = { path = "../" }

[dependencies.bevy]
version = "0.13"
version = "0.14"
default-features = false
features = ["bevy_render", "bevy_sprite", "bevy_text", "bevy_ui"]

Expand Down
10 changes: 7 additions & 3 deletions benchmarks/benches/lens.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#[macro_use]
extern crate criterion;

use bevy::{ecs::component::Tick, prelude::*};
use bevy::{
color::palettes::css::{BLUE, RED},
ecs::component::Tick,
prelude::*,
};
use bevy_tweening::{lens::*, ComponentTarget};
use criterion::{black_box, Criterion};

fn text_color_lens(c: &mut Criterion) {
let mut lens = TextColorLens {
start: Color::RED,
end: Color::BLUE,
start: RED.into(),
end: BLUE.into(),
section: 0,
};
let mut text = Text::from_section(
Expand Down
9 changes: 6 additions & 3 deletions examples/colormaterial_color.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
use bevy::{
color::palettes::css::*,
prelude::*,
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
};
use bevy_tweening::{lens::*, *};
use std::time::Duration;

mod utils;

fn main() {
App::default()
.add_plugins(DefaultPlugins.set(WindowPlugin {
Expand All @@ -16,7 +19,7 @@ fn main() {
}),
..default()
}))
.add_systems(Update, bevy::window::close_on_esc)
.add_systems(Update, utils::close_on_esc)
.add_plugins(TweeningPlugin)
.add_systems(Startup, setup)
.run();
Expand Down Expand Up @@ -81,8 +84,8 @@ fn setup(
*ease_function,
Duration::from_secs(1),
ColorMaterialColorLens {
start: Color::RED,
end: Color::BLUE,
start: RED.into(),
end: BLUE.into(),
},
)
.with_repeat_count(RepeatCount::Infinite)
Expand Down
14 changes: 8 additions & 6 deletions examples/menu.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use bevy::prelude::*;
use bevy::{color::palettes::css::*, prelude::*};
use bevy_inspector_egui::quick::WorldInspectorPlugin;
use bevy_tweening::{lens::*, *};
use std::time::Duration;

const NORMAL_COLOR: Color = Color::rgba(162. / 255., 226. / 255., 95. / 255., 1.);
const HOVER_COLOR: Color = Color::AZURE;
const CLICK_COLOR: Color = Color::ALICE_BLUE;
const TEXT_COLOR: Color = Color::rgba(83. / 255., 163. / 255., 130. / 255., 1.);
mod utils;

const NORMAL_COLOR: Color = Color::srgba(162. / 255., 226. / 255., 95. / 255., 1.);
const HOVER_COLOR: Color = Color::Srgba(AZURE);
const CLICK_COLOR: Color = Color::Srgba(ALICE_BLUE);
const TEXT_COLOR: Color = Color::srgba(83. / 255., 163. / 255., 130. / 255., 1.);
const INIT_TRANSITION_DONE: u64 = 1;

/// The menu in this example has two set of animations:
Expand All @@ -31,7 +33,7 @@ fn main() {
}),
..default()
}))
.add_systems(Update, bevy::window::close_on_esc)
.add_systems(Update, utils::close_on_esc)
.add_systems(Update, interaction)
.add_systems(Update, enable_interaction_after_initial_animation)
.add_plugins(TweeningPlugin)
Expand Down
16 changes: 8 additions & 8 deletions examples/sequence.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use bevy::{color::palettes::css::*, prelude::*};
use bevy_tweening::{lens::*, *};
use std::time::Duration;

use bevy::prelude::*;

use bevy_tweening::{lens::*, *};
mod utils;

fn main() {
App::default()
Expand All @@ -15,7 +15,7 @@ fn main() {
}),
..default()
}))
.add_systems(Update, bevy::window::close_on_esc)
.add_systems(Update, utils::close_on_esc)
.add_plugins(TweeningPlugin)
.add_systems(Startup, setup)
.add_systems(Update, update_text)
Expand All @@ -41,12 +41,12 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
let text_style_red = TextStyle {
font: font.clone(),
font_size: 50.0,
color: Color::RED,
color: RED.into(),
};
let text_style_blue = TextStyle {
font,
font_size: 50.0,
color: Color::BLUE,
color: BLUE.into(),
};

let justify = JustifyText::Center;
Expand Down Expand Up @@ -142,7 +142,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn((
SpriteBundle {
sprite: Sprite {
color: Color::RED,
color: RED.into(),
custom_size: Some(Vec2::new(size, size)),
..default()
},
Expand Down Expand Up @@ -189,7 +189,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn((
SpriteBundle {
sprite: Sprite {
color: Color::BLUE,
color: BLUE.into(),
custom_size: Some(Vec2::new(size * 3., size)),
..default()
},
Expand Down
10 changes: 6 additions & 4 deletions examples/sprite_color.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bevy::prelude::*;
use bevy::{color::palettes::css::*, prelude::*};
use bevy_tweening::{lens::*, *};

mod utils;

fn main() {
App::default()
.add_plugins(DefaultPlugins.set(WindowPlugin {
Expand All @@ -12,7 +14,7 @@ fn main() {
}),
..default()
}))
.add_systems(Update, bevy::window::close_on_esc)
.add_systems(Update, utils::close_on_esc)
.add_plugins(TweeningPlugin)
.add_systems(Startup, setup)
.run();
Expand Down Expand Up @@ -65,8 +67,8 @@ fn setup(mut commands: Commands) {
*ease_function,
std::time::Duration::from_secs(1),
SpriteColorLens {
start: Color::RED,
end: Color::BLUE,
start: RED.into(),
end: BLUE.into(),
},
)
.with_repeat_count(RepeatCount::Infinite)
Expand Down
10 changes: 6 additions & 4 deletions examples/text_color.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use bevy::prelude::*;
use bevy::{color::palettes::css::*, prelude::*};
use bevy_tweening::{lens::*, *};

mod utils;

const WIDTH: f32 = 1200.;
const HEIGHT: f32 = 600.;

Expand All @@ -15,7 +17,7 @@ fn main() {
}),
..default()
}))
.add_systems(Update, bevy::window::close_on_esc)
.add_systems(Update, utils::close_on_esc)
.add_plugins(TweeningPlugin)
.add_systems(Startup, setup)
.run();
Expand Down Expand Up @@ -72,8 +74,8 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
*ease_function,
std::time::Duration::from_secs(1),
TextColorLens {
start: Color::RED,
end: Color::BLUE,
start: RED.into(),
end: BLUE.into(),
section: 0,
},
)
Expand Down
8 changes: 5 additions & 3 deletions examples/transform_rotation.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use bevy::prelude::*;
use bevy::{color::palettes::css::*, prelude::*};
use bevy_inspector_egui::{prelude::*, quick::ResourceInspectorPlugin};

use bevy_tweening::{lens::*, *};

mod utils;

fn main() {
App::default()
.add_plugins(DefaultPlugins.set(WindowPlugin {
Expand All @@ -15,7 +17,7 @@ fn main() {
..default()
}))
.init_resource::<Options>()
.add_systems(Update, bevy::window::close_on_esc)
.add_systems(Update, utils::close_on_esc)
.add_plugins(TweeningPlugin)
.add_plugins(ResourceInspectorPlugin::<Options>::new())
.add_systems(Startup, setup)
Expand Down Expand Up @@ -98,7 +100,7 @@ fn setup(mut commands: Commands) {
parent.spawn((
SpriteBundle {
sprite: Sprite {
color: Color::RED,
color: RED.into(),
custom_size: Some(Vec2::new(size, size * 0.5)),
..default()
},
Expand Down
8 changes: 5 additions & 3 deletions examples/transform_translation.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use bevy::prelude::*;
use bevy::{color::palettes::css::*, prelude::*};
use bevy_inspector_egui::{prelude::*, quick::ResourceInspectorPlugin};

use bevy_tweening::{lens::*, *};

mod utils;

fn main() {
App::default()
.add_plugins(DefaultPlugins.set(WindowPlugin {
Expand All @@ -15,7 +17,7 @@ fn main() {
..default()
}))
.init_resource::<Options>()
.add_systems(Update, bevy::window::close_on_esc)
.add_systems(Update, utils::close_on_esc)
.add_plugins(TweeningPlugin)
.add_plugins(ResourceInspectorPlugin::<Options>::default())
.add_systems(Startup, setup)
Expand Down Expand Up @@ -91,7 +93,7 @@ fn setup(mut commands: Commands) {
commands.spawn((
SpriteBundle {
sprite: Sprite {
color: Color::RED,
color: RED.into(),
custom_size: Some(Vec2::new(size, size)),
..default()
},
Expand Down
8 changes: 5 additions & 3 deletions examples/ui_position.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use bevy::prelude::*;
use bevy::{color::palettes::css::*, prelude::*};
use bevy_inspector_egui::{prelude::*, quick::ResourceInspectorPlugin};

use bevy_tweening::{lens::*, *};

mod utils;

fn main() {
App::default()
.add_plugins(DefaultPlugins.set(WindowPlugin {
Expand All @@ -15,7 +17,7 @@ fn main() {
..default()
}))
.init_resource::<Options>()
.add_systems(Update, bevy::window::close_on_esc)
.add_systems(Update, utils::close_on_esc)
.add_plugins(TweeningPlugin)
.add_plugins(ResourceInspectorPlugin::<Options>::new())
.add_systems(Startup, setup)
Expand Down Expand Up @@ -114,7 +116,7 @@ fn setup(mut commands: Commands) {
justify_content: JustifyContent::Center,
..default()
},
background_color: BackgroundColor(Color::RED),
background_color: BackgroundColor(RED.into()),
..default()
},
Animator::new(tween),
Expand Down
9 changes: 9 additions & 0 deletions examples/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![allow(unused)]

use bevy::prelude::*;

pub fn close_on_esc(mut ev_app_exit: EventWriter<AppExit>, input: Res<ButtonInput<KeyCode>>) {
if input.just_pressed(KeyCode::Escape) {
ev_app_exit.send(AppExit::Success);
}
}
Loading

0 comments on commit ef7090c

Please sign in to comment.