diff --git a/CHANGELOG.md b/CHANGELOG.md index 1274fd0..c1677a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,8 @@ * Deprecated `Hex::to_array3` in favor of `Hex::to_cubic_array` * Made most modules public but kept the wildcard exports at the crate root +* Bump `bevy` dev dependenvy to `0.10` and updated the examples +* Bump `glam` to `0.23` ## 0.4.2 diff --git a/Cargo.toml b/Cargo.toml index f352958..dc4dbb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ default = [] ser_de = ["serde", "glam/serde"] [dependencies] -glam = "0.22" +glam = "0.23" itertools = "0.10" [dependencies.serde] @@ -27,8 +27,8 @@ optional = true # For lib.rs doctests and examples [dev-dependencies.bevy] -version = "0.9" -features = ["render", "bevy_asset", "bevy_winit", "x11"] +version = "0.10" +features = ["bevy_render", "bevy_pbr", "bevy_core_pipeline", "bevy_asset", "bevy_winit", "x11"] default-features = false [[example]] diff --git a/README.md b/README.md index f2b6ead..7aabd7d 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ let world_pos = layout.hex_to_world_pos(hex); ``` - ## Usage in [Bevy](https://bevyengine.org/) 0.9.x + ## Usage in [Bevy](https://bevyengine.org/) If you want to generate 3D hexagonal mesh and use it in [bevy](bevyengine.org) you may do it this way: diff --git a/examples/3d_columns.rs b/examples/3d_columns.rs index 793ba4d..8c4faaf 100644 --- a/examples/3d_columns.rs +++ b/examples/3d_columns.rs @@ -1,10 +1,11 @@ use bevy::prelude::*; use bevy::render::mesh::Indices; use bevy::render::render_resource::PrimitiveTopology; -use bevy::time::FixedTimestep; +use bevy::time::common_conditions::on_timer; use hexx::shapes; use hexx::*; use std::collections::HashMap; +use std::time::Duration; /// World size of the hexagons (outer radius) const HEX_SIZE: Vec2 = Vec2::splat(1.0); @@ -12,6 +13,8 @@ const HEX_SIZE: Vec2 = Vec2::splat(1.0); const COLUMN_HEIGHT: f32 = 10.0; /// Map radius const MAP_RADIUS: u32 = 20; +/// Animation time step +const TIME_STEP: Duration = Duration::from_millis(100); pub fn main() { App::new() @@ -22,11 +25,7 @@ pub fn main() { .add_plugins(DefaultPlugins) .add_startup_system(setup_camera) .add_startup_system(setup_grid) - .add_system_set( - SystemSet::new() - .with_run_criteria(FixedTimestep::step(0.1)) - .with_system(animate_rings), - ) + .add_system(animate_rings.run_if(on_timer(TIME_STEP))) .run(); } diff --git a/examples/hex_grid.rs b/examples/hex_grid.rs index c1ea0b2..fb0ebbd 100644 --- a/examples/hex_grid.rs +++ b/examples/hex_grid.rs @@ -3,6 +3,7 @@ use std::collections::HashMap; use bevy::prelude::*; use bevy::render::mesh::Indices; use bevy::render::render_resource::PrimitiveTopology; +use bevy::window::PrimaryWindow; use hexx::shapes; use hexx::*; @@ -16,11 +17,10 @@ pub fn main() { ..default() }) .add_plugins(DefaultPlugins.set(WindowPlugin { - window: WindowDescriptor { - width: 1_000.0, - height: 1_000.0, + primary_window: Some(Window { + resolution: (1_000.0, 1_000.0).into(), ..default() - }, + }), ..default() })) .add_startup_system(setup_camera) @@ -115,11 +115,11 @@ fn setup_grid( /// Input interaction fn handle_input( mut commands: Commands, - windows: Res, + windows: Query<&Window, With>, map: Res, mut highlighted_hexes: Local, ) { - let window = windows.primary(); + let window = windows.single(); if let Some(pos) = window.cursor_position() { let pos = Vec2::new(pos.x, window.height() - pos.y) - Vec2::new(window.width(), window.height()) / 2.0; diff --git a/src/lib.rs b/src/lib.rs index a9e6daf..9a0a1d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -87,7 +87,7 @@ //! let world_pos = layout.hex_to_world_pos(hex); //!``` //! -//! ## Usage in [Bevy](https://bevyengine.org/) 0.9.x +//! ## Usage in [Bevy](https://bevyengine.org/) //! //! If you want to generate 3D hexagonal mesh and use it in [bevy](bevyengine.org) you may do it this way: //!