Skip to content

Commit

Permalink
Merge pull request #508 from rparrett/bevy13
Browse files Browse the repository at this point in the history
Upgrade to Bevy 0.13
  • Loading branch information
StarArawn authored Mar 11, 2024
2 parents 1e345d1 + a7b308a commit 25def41
Show file tree
Hide file tree
Showing 19 changed files with 208 additions and 189 deletions.
184 changes: 92 additions & 92 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ render = []
serde = ["dep:serde"]

[dependencies]
bevy = { version = "0.12", default-features = false, features = [
bevy = { version = "0.13", default-features = false, features = [
"bevy_core_pipeline",
"bevy_render",
"bevy_asset",
Expand All @@ -35,7 +35,7 @@ tiled = { version = "0.11.0", default-features = false }
thiserror = { version = "1.0" }

[dev-dependencies.bevy]
version = "0.12"
version = "0.13"
default-features = false
features = [
"bevy_core_pipeline",
Expand All @@ -47,11 +47,11 @@ features = [
"bevy_text",
"bevy_sprite",
#"file_watcher",
"multi-threaded"
"multi-threaded",
]

[target.'cfg(unix)'.dev-dependencies.bevy]
version = "0.12"
version = "0.13"
default-features = false
features = [
"bevy_core_pipeline",
Expand All @@ -63,123 +63,123 @@ features = [
"x11",
"bevy_text",
"bevy_sprite",
"multi-threaded"
"multi-threaded",
]


[[example]]
name="3d_iso"
path="examples/3d_iso.rs"
required-features=["render"]
name = "3d_iso"
path = "examples/3d_iso.rs"
required-features = ["render"]
[[example]]
name="accessing_tiles"
path="examples/accessing_tiles.rs"
required-features=["render"]
name = "accessing_tiles"
path = "examples/accessing_tiles.rs"
required-features = ["render"]
[[example]]
name="animation"
path="examples/animation.rs"
required-features=["render"]
name = "animation"
path = "examples/animation.rs"
required-features = ["render"]
[[example]]
name="basic"
path="examples/basic.rs"
required-features=["render"]
name = "basic"
path = "examples/basic.rs"
required-features = ["render"]
[[example]]
name="bench"
path="examples/bench.rs"
required-features=["render"]
name = "bench"
path = "examples/bench.rs"
required-features = ["render"]
[[example]]
name="chunking"
path="examples/chunking.rs"
required-features=["render"]
name = "chunking"
path = "examples/chunking.rs"
required-features = ["render"]
[[example]]
name="colors"
path="examples/colors.rs"
required-features=["render"]
name = "colors"
path = "examples/colors.rs"
required-features = ["render"]
[[example]]
name="custom_shader"
path="examples/custom_shader.rs"
required-features=["render"]
name = "custom_shader"
path = "examples/custom_shader.rs"
required-features = ["render"]
[[example]]
name="frustum_cull_test"
path="examples/frustum_cull_test.rs"
required-features=["render"]
name = "frustum_cull_test"
path = "examples/frustum_cull_test.rs"
required-features = ["render"]
[[example]]
name="game_of_life"
path="examples/game_of_life.rs"
required-features=["render"]
name = "game_of_life"
path = "examples/game_of_life.rs"
required-features = ["render"]
[[example]]
name="hex_neighbors_radius_chunks"
path="examples/hex_neighbors_radius_chunks.rs"
required-features=["render"]
name = "hex_neighbors_radius_chunks"
path = "examples/hex_neighbors_radius_chunks.rs"
required-features = ["render"]
[[example]]
name="hex_neighbors"
path="examples/hex_neighbors.rs"
required-features=["render"]
name = "hex_neighbors"
path = "examples/hex_neighbors.rs"
required-features = ["render"]
[[example]]
name="hexagon_column"
path="examples/hexagon_column.rs"
required-features=["render"]
name = "hexagon_column"
path = "examples/hexagon_column.rs"
required-features = ["render"]
[[example]]
name="hexagon_generation"
path="examples/hexagon_generation.rs"
required-features=["render"]
name = "hexagon_generation"
path = "examples/hexagon_generation.rs"
required-features = ["render"]
[[example]]
name="hexagon_row"
path="examples/hexagon_row.rs"
required-features=["render"]
name = "hexagon_row"
path = "examples/hexagon_row.rs"
required-features = ["render"]
[[example]]
name="iso_diamond"
path="examples/iso_diamond.rs"
required-features=["render"]
name = "iso_diamond"
path = "examples/iso_diamond.rs"
required-features = ["render"]
[[example]]
name="iso_staggered"
path="examples/iso_staggered.rs"
required-features=["render"]
name = "iso_staggered"
path = "examples/iso_staggered.rs"
required-features = ["render"]
[[example]]
name="layers"
path="examples/layers.rs"
required-features=["render"]
name = "layers"
path = "examples/layers.rs"
required-features = ["render"]
[[example]]
name="ldtk"
path="examples/ldtk.rs"
required-features=["render"]
name = "ldtk"
path = "examples/ldtk.rs"
required-features = ["render"]
[[example]]
name="mouse_to_tile"
path="examples/mouse_to_tile.rs"
required-features=["render"]
name = "mouse_to_tile"
path = "examples/mouse_to_tile.rs"
required-features = ["render"]
[[example]]
name="move_tile"
path="examples/move_tile.rs"
required-features=["render"]
name = "move_tile"
path = "examples/move_tile.rs"
required-features = ["render"]
[[example]]
name="random_map"
path="examples/random_map.rs"
required-features=["render"]
name = "random_map"
path = "examples/random_map.rs"
required-features = ["render"]
[[example]]
name="remove_tiles"
path="examples/remove_tiles.rs"
required-features=["render"]
name = "remove_tiles"
path = "examples/remove_tiles.rs"
required-features = ["render"]
[[example]]
name="spacing"
path="examples/spacing.rs"
required-features=["render"]
name = "spacing"
path = "examples/spacing.rs"
required-features = ["render"]
[[example]]
name="texture_container"
path="examples/texture_container.rs"
required-features=["render"]
name = "texture_container"
path = "examples/texture_container.rs"
required-features = ["render"]
[[example]]
name="texture_vec"
path="examples/texture_vec.rs"
required-features=["render"]
name = "texture_vec"
path = "examples/texture_vec.rs"
required-features = ["render"]
[[example]]
name="tiled_rotated"
path="examples/tiled_rotated.rs"
required-features=["render"]
name = "tiled_rotated"
path = "examples/tiled_rotated.rs"
required-features = ["render"]
[[example]]
name="tiled"
path="examples/tiled.rs"
required-features=["render"]
name = "tiled"
path = "examples/tiled.rs"
required-features = ["render"]
[[example]]
name="visibility"
path="examples/visibility.rs"
required-features=["render"]
name = "visibility"
path = "examples/visibility.rs"
required-features = ["render"]
4 changes: 2 additions & 2 deletions examples/animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ fn main() {
.run();
}

fn pause_animation(mut query: Query<&mut AnimatedTile>, keys: Res<Input<KeyCode>>) {
if keys.just_pressed(KeyCode::P) {
fn pause_animation(mut query: Query<&mut AnimatedTile>, keys: Res<ButtonInput<KeyCode>>) {
if keys.just_pressed(KeyCode::KeyP) {
for mut anim in &mut query {
anim.speed = if anim.speed == 0.0 { 1.0 } else { 0.0 }
}
Expand Down
4 changes: 2 additions & 2 deletions examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn startup(

fn swap_texture_or_hide(
asset_server: Res<AssetServer>,
keyboard_input: Res<Input<KeyCode>>,
keyboard_input: Res<ButtonInput<KeyCode>>,
mut query: Query<(&mut TilemapTexture, &mut Visibility)>,
) {
if keyboard_input.just_pressed(KeyCode::Space) {
Expand All @@ -88,7 +88,7 @@ fn swap_texture_or_hide(
}
}
}
if keyboard_input.just_pressed(KeyCode::H) {
if keyboard_input.just_pressed(KeyCode::KeyH) {
for (_, mut visibility) in &mut query {
*visibility = match *visibility {
Visibility::Inherited | Visibility::Visible => Visibility::Hidden,
Expand Down
7 changes: 4 additions & 3 deletions examples/frustum_cull_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn spawn_map_type_label(
font_size: 20.0,
color: Color::BLACK,
};
let text_alignment = TextAlignment::Center;
let text_justify = JustifyText::Center;

for window in windows.iter() {
for map_type in map_type_q.iter() {
Expand All @@ -140,7 +140,7 @@ fn spawn_map_type_label(
commands.spawn((
Text2dBundle {
text: Text::from_section(format!("{map_type:?}"), text_style.clone())
.with_alignment(text_alignment),
.with_justify(text_justify),
transform,
..default()
},
Expand All @@ -159,7 +159,7 @@ fn swap_map_type(
&mut TilemapTexture,
&mut TilemapTileSize,
)>,
keyboard_input: Res<Input<KeyCode>>,
keyboard_input: Res<ButtonInput<KeyCode>>,
mut map_type_label_q: Query<&mut Text, With<MapTypeLabel>>,
tile_handle_square: Res<TileHandleSquare>,
tile_handle_hex_row: Res<TileHandleHexRow>,
Expand Down Expand Up @@ -240,6 +240,7 @@ fn main() {
level: Level::ERROR,
// except for bevy_ecs_tilemap
filter: "bevy_ecs_tilemap=trace".into(),
..default()
}),
)
.add_plugins(TilemapPlugin)
Expand Down
5 changes: 2 additions & 3 deletions examples/game_of_life.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ fn update(
.entities(tile_storage)
.iter()
.filter(|neighbor| {
let tile_component =
tile_query.get_component::<TileVisible>(**neighbor).unwrap();
tile_component.0
let (_, _, tile_visible) = tile_query.get(**neighbor).unwrap();
tile_visible.0
})
.count();

Expand Down
16 changes: 8 additions & 8 deletions examples/helpers/camera.rs
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
use bevy::{input::Input, math::Vec3, prelude::*, render::camera::Camera};
use bevy::{input::ButtonInput, math::Vec3, prelude::*, render::camera::Camera};

// A simple camera system for moving and zooming the camera.
#[allow(dead_code)]
pub fn movement(
time: Res<Time>,
keyboard_input: Res<Input<KeyCode>>,
keyboard_input: Res<ButtonInput<KeyCode>>,
mut query: Query<(&mut Transform, &mut OrthographicProjection), With<Camera>>,
) {
for (mut transform, mut ortho) in query.iter_mut() {
let mut direction = Vec3::ZERO;

if keyboard_input.pressed(KeyCode::A) {
if keyboard_input.pressed(KeyCode::KeyA) {
direction -= Vec3::new(1.0, 0.0, 0.0);
}

if keyboard_input.pressed(KeyCode::D) {
if keyboard_input.pressed(KeyCode::KeyD) {
direction += Vec3::new(1.0, 0.0, 0.0);
}

if keyboard_input.pressed(KeyCode::W) {
if keyboard_input.pressed(KeyCode::KeyW) {
direction += Vec3::new(0.0, 1.0, 0.0);
}

if keyboard_input.pressed(KeyCode::S) {
if keyboard_input.pressed(KeyCode::KeyS) {
direction -= Vec3::new(0.0, 1.0, 0.0);
}

if keyboard_input.pressed(KeyCode::Z) {
if keyboard_input.pressed(KeyCode::KeyZ) {
ortho.scale += 0.1;
}

if keyboard_input.pressed(KeyCode::X) {
if keyboard_input.pressed(KeyCode::KeyX) {
ortho.scale -= 0.1;
}

Expand Down
Loading

0 comments on commit 25def41

Please sign in to comment.