Skip to content

Commit

Permalink
upgraded to bevy 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FloWi committed Jul 31, 2024
1 parent 7e2d7b3 commit b501804
Show file tree
Hide file tree
Showing 11 changed files with 676 additions and 477 deletions.
1,090 changes: 642 additions & 448 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ opt-level = 3
opt-level = 1

[dependencies]
bevy = { version = "0.13.2", default-features = false, features = [
bevy = { version = "0.14.0", default-features = false, features = [
"animation",
"bevy_asset",
"bevy_scene",
Expand All @@ -29,11 +29,11 @@ bevy = { version = "0.13.2", default-features = false, features = [
"x11",
"ktx2",
"file_watcher", # Changed from "filesystem_watcher"
"multi-threaded", # Add this line
"multi_threaded", # Add this line
"tonemapping_luts",
"dynamic_linking" # Optional: remove if not needed
]}
bevy_asset_loader = { version = "0.20.2" }
bevy_kira_audio = { version = "0.19.0", default-features = false, features = ["wav", "ogg"] }
bevy_asset_loader = { version = "0.21.0" }
bevy_kira_audio = { version = "0.20.0", default-features = false, features = ["wav", "ogg"] }
rand = "0.8.5"
bevy_jornet = "0.7.0"
bevy_jornet = "0.8.0"
2 changes: 1 addition & 1 deletion src/enemies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ pub fn update_healthbar(
.spawn(SpriteBundle {
sprite: Sprite {
custom_size: Some(Vec2::new(22.0, 4.0)),
color: Color::rgb(0.0, 0.0, 0.0),
color: Color::srgb(0.0, 0.0, 0.0),
..Default::default()
},
transform: Transform::from_translation(Vec3::new(0.0, -16.0, 6.0)),
Expand Down
6 changes: 3 additions & 3 deletions src/tower/charge_shot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
state::loading::GameAssets,
ui::constants::BLUE,
};

use crate::ui::legacy_mul_f32;
use super::{Projectile, RangeIndicator, RotatingTurret, TargetMode, Tower, TowerPlaced};

#[derive(Component, Debug)]
Expand Down Expand Up @@ -146,7 +146,7 @@ pub fn shoot(
.spawn(SpriteBundle {
texture: game_assets.bullet.clone(),
sprite: Sprite {
color: BLUE * 5.0,
color: legacy_mul_f32(BLUE, 5.0),
..Default::default()
},
transform: Transform::from_translation(projectile_pos),
Expand Down Expand Up @@ -199,7 +199,7 @@ pub fn spawn_charge_shot(
parent
.spawn(MaterialMesh2dBundle {
mesh: meshes.add(Circle::new(1.5 * 32.0)).into(),
material: materials.add(ColorMaterial::from(Color::rgba(0.8, 0.4, 0.4, 0.2))),
material: materials.add(ColorMaterial::from(Color::srgba(0.8, 0.4, 0.4, 0.2))),
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 5.0)),
visibility: Visibility::Hidden,
..Default::default()
Expand Down
2 changes: 1 addition & 1 deletion src/tower/jammer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn spawn_jammer(
parent
.spawn(MaterialMesh2dBundle {
mesh: meshes.add(Circle::new(1.5 * 32.0)).into(),
material: materials.add(ColorMaterial::from(Color::rgba(0.8, 0.4, 0.4, 0.2))),
material: materials.add(ColorMaterial::from(Color::srgba(0.8, 0.4, 0.4, 0.2))),
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 5.0)),
visibility: Visibility::Hidden,
..Default::default()
Expand Down
2 changes: 1 addition & 1 deletion src/tower/laser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ pub fn spawn_laser_beam(
parent
.spawn(MaterialMesh2dBundle {
mesh: meshes.add(Rectangle::from_size(beam_dimensions)).into(),
material: materials.add(ColorMaterial::from(Color::rgba(
material: materials.add(ColorMaterial::from(Color::srgba(
1.74 * 2.0,
1.15 * 2.0,
0.74 * 2.0,
Expand Down
6 changes: 3 additions & 3 deletions src/tower/sniper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
state::loading::GameAssets,
ui::constants::RED,
};

use crate::ui::legacy_mul_f32;
use super::{Projectile, RangeIndicator, RotatingTurret, TargetMode, Tower, TowerPlaced};

#[derive(Component, Debug)]
Expand Down Expand Up @@ -144,7 +144,7 @@ pub fn shoot(
.spawn(SpriteBundle {
texture: game_assets.bullet.clone(),
sprite: Sprite {
color: RED * 5.0,
color: legacy_mul_f32(RED, 5.0),
..Default::default()
},
transform: Transform::from_translation(projectile_pos),
Expand Down Expand Up @@ -197,7 +197,7 @@ pub fn spawn_sniper(
parent
.spawn(MaterialMesh2dBundle {
mesh: meshes.add(Circle::new(3.5 * 32.0)).into(),
material: materials.add(ColorMaterial::from(Color::rgba(0.8, 0.4, 0.4, 0.2))),
material: materials.add(ColorMaterial::from(Color::srgba(0.8, 0.4, 0.4, 0.2))),
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 5.0)),
visibility: Visibility::Hidden,
..Default::default()
Expand Down
26 changes: 13 additions & 13 deletions src/ui/constants.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use bevy::prelude::Color;

pub const BACKGROUND_COLOR: Color = Color::rgb(0.11, 0.12, 0.13);
pub const TEXT_COLOR: Color = Color::rgb(0.77, 0.78, 0.78);
pub const CARD_BACKGROUND_COLOR: Color = Color::rgb(0.16, 0.16, 0.18);
pub const CARD_BACKGROUND_COLOR_HOVER: Color = Color::rgb(0.22, 0.23, 0.25);
pub const CARD_TEXT_COLOR: Color = Color::rgb(0.77, 0.78, 0.78);
pub const BUTTON_BACKGROUND_COLOR: Color = Color::rgb(0.22, 0.23, 0.25);
pub const BUTTON_BACKGROUND_COLOR_HOVER: Color = Color::rgb(0.25, 0.26, 0.28);
pub const BUTTON_BACKGROUND_COLOR_PRESSED: Color = Color::rgb(0.18, 0.19, 0.21);
pub const BUTTON_BACKGROUND_COLOR_ACTIVE: Color = Color::rgb(0.30, 0.31, 0.33);
pub const BUTTON_TEXT_COLOR: Color = Color::rgb(0.77, 0.78, 0.78);
pub const RED: Color = Color::rgb(0.8, 0.4, 0.4);
pub const GREEN: Color = Color::rgb(0.41, 0.74, 0.41);
pub const BLUE: Color = Color::rgb(0.4, 0.4, 0.8);
pub const BACKGROUND_COLOR: Color = Color::srgb(0.11, 0.12, 0.13);
pub const TEXT_COLOR: Color = Color::srgb(0.77, 0.78, 0.78);
pub const CARD_BACKGROUND_COLOR: Color = Color::srgb(0.16, 0.16, 0.18);
pub const CARD_BACKGROUND_COLOR_HOVER: Color = Color::srgb(0.22, 0.23, 0.25);
pub const CARD_TEXT_COLOR: Color = Color::srgb(0.77, 0.78, 0.78);
pub const BUTTON_BACKGROUND_COLOR: Color = Color::srgb(0.22, 0.23, 0.25);
pub const BUTTON_BACKGROUND_COLOR_HOVER: Color = Color::srgb(0.25, 0.26, 0.28);
pub const BUTTON_BACKGROUND_COLOR_PRESSED: Color = Color::srgb(0.18, 0.19, 0.21);
pub const BUTTON_BACKGROUND_COLOR_ACTIVE: Color = Color::srgb(0.30, 0.31, 0.33);
pub const BUTTON_TEXT_COLOR: Color = Color::srgb(0.77, 0.78, 0.78);
pub const RED: Color = Color::srgb(0.8, 0.4, 0.4);
pub const GREEN: Color = Color::srgb(0.41, 0.74, 0.41);
pub const BLUE: Color = Color::srgb(0.4, 0.4, 0.8);
2 changes: 1 addition & 1 deletion src/ui/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ pub fn create_ghost(
},
transform: Transform::from_xyz(0.0, 0.0, -1.0),
sprite: Sprite {
color: Color::rgba(1.0, 1.0, 1.0, 0.5),
color: Color::srgba(1.0, 1.0, 1.0, 0.5),
..Default::default()
},
..Default::default()
Expand Down
5 changes: 5 additions & 0 deletions src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@ pub fn update_selection_indicator(
}
}
}

pub fn legacy_mul_f32(color: Color, scale: f32) -> Color {
let rgba = color.to_linear();
Color::srgb(rgba.red * scale, rgba.green * scale, rgba.blue * scale)
}
2 changes: 1 addition & 1 deletion src/ui/tower_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn present_tower_options(mut commands: Commands, font: Handle<Font>, towers:
flex_direction: FlexDirection::Column,
..Default::default()
},
background_color: Color::rgba(0.0, 0.0, 0.0, 0.5).into(),
background_color: Color::srgba(0.0, 0.0, 0.0, 0.5).into(),
..Default::default()
})
.insert(TowerOptionsRoot)
Expand Down

0 comments on commit b501804

Please sign in to comment.