Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Bevy 0.13 #32

Merged
merged 1 commit into from
Feb 18, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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