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

Update to Bevy 0.15 #70

Merged
merged 2 commits into from
Dec 15, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,20 @@ default = ["premade_pools"]
premade_pools = []

[dependencies]
bevy = { version = "0.14", default-features = false, features = [
bevy = { version = "0.15", default-features = false, features = [
"serialize",
"bevy_gilrs",
] }
serde = { version = "1.0", features = ["derive"] }
leafwing-input-manager = { version = "0.15", default-features = false }
leafwing-input-manager = { version = "0.16", default-features = false }

leafwing_abilities_macros = { path = "macros", version = "0.3" }
thiserror = "1.0.37"
derive_more = "0.99.17"

[dev-dependencies]
bevy = { version = "0.14", default-features = false, features = [
"bevy_asset",
"bevy_sprite",
"bevy_text",
"bevy_ui",
"bevy_render",
"bevy_core_pipeline",
"x11",
bevy = { version = "0.15", default-features = true, features = [
"default_font",
] }
# Needed to provide implementations for standard input devices
leafwing-input-manager = { version = "0.15", default-features = true }
leafwing-input-manager = { version = "0.16", default-features = true }
6 changes: 6 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes

## Version 0.10

## Dependencies (0.10)

- now support `bevy` 0.15 and `leafwing-input-manager` 0.16

## Version 0.9

## Dependencies (0.9)
Expand Down
34 changes: 11 additions & 23 deletions examples/cooldown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ struct Cookie;
#[derive(Bundle)]
struct CookieBundle {
cookie: Cookie,
button_bundle: ButtonBundle,
node: Node,
background_color: BackgroundColor,
abilities_bundle: AbilitiesBundle<CookieAbility>,
input_manager_bundle: InputManagerBundle<CookieAbility>,
}
Expand All @@ -87,15 +88,12 @@ impl CookieBundle {
fn new() -> CookieBundle {
CookieBundle {
cookie: Cookie,
button_bundle: ButtonBundle {
style: Style {
height: Val::Px(100.),
width: Val::Px(100.),
..Default::default()
},
background_color: BackgroundColor(Self::COOKIE_COLOR.into()),
..default()
node: Node {
height: Val::Px(100.),
width: Val::Px(100.),
..Default::default()
},
background_color: BackgroundColor(Self::COOKIE_COLOR.into()),
abilities_bundle: AbilitiesBundle {
cooldowns: CookieAbility::cooldowns(),
..default()
Expand All @@ -113,7 +111,7 @@ fn spawn_cookie(mut commands: Commands) {
}

fn spawn_camera(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
commands.spawn(Camera2d);
}

// We need a huge amount of space to be able to let you play this game for long enough ;)
Expand Down Expand Up @@ -185,20 +183,10 @@ fn reset_cookie_color(mut query: Query<&mut BackgroundColor, With<Cookie>>) {
struct ScoreText;

fn spawn_score_text(mut commands: Commands) {
commands
.spawn(TextBundle::from_section(
"Score: ",
TextStyle {
font_size: 50.,
color: Color::WHITE,
..Default::default()
},
))
.insert(ScoreText);
commands.spawn(Text::new("Score")).insert(ScoreText);
}

fn display_score(score: Res<Score>, mut query: Query<&mut Text, With<ScoreText>>) {
fn display_score(score: Res<Score>, mut text: Single<&mut Text, With<ScoreText>>) {
let score = score.0;
let mut text = query.single_mut();
text.sections[0].value = format!("Score: {score}");
**text = Text::new(format!("Score: {}", score));
}
Loading