From 6f5204910b9af0dee3dbe8af977be66da4bf76ad Mon Sep 17 00:00:00 2001 From: laund Date: Sat, 6 Jul 2024 14:08:12 +0200 Subject: [PATCH] update to bevy 0.14 --- Cargo.toml | 12 ++++++------ README.md | 1 + examples/distance2d.rs | 7 ++++--- examples/distance3d.rs | 11 ++++++----- examples/modify_timestep.rs | 18 ++++++++++-------- examples/movetowards.rs | 4 ++-- 6 files changed, 29 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6116b76..19f89eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "bevy_spatial" description = "A crate for tracking bevy entities in spatial indices." documentation = "https://docs.rs/bevy_spatial" -version = "0.8.0" +version = "0.9.0" license = "MIT OR Apache-2.0" edition = "2021" keywords = ["gamedev", "bevy", "kdtree", "knn", "nearest-neighbour"] @@ -11,9 +11,9 @@ readme = "README.md" authors = ["laundmo"] [dependencies] -bevy = { version = "0.13", default-features = false } +bevy = { version = "0.14", default-features = false } # KD-Tree dependencies -kd-tree = { version = "0.5.1", optional = true, features = ["rayon"] } +kd-tree = { version = "0.6", optional = true, features = ["rayon"] } typenum = { version = "1.17.0" } num-traits = { version = "0.2.17" } @@ -23,13 +23,13 @@ default = ["kdtree"] kdtree = ["dep:kd-tree"] [dev-dependencies] -bevy = { version = "0.13" } +bevy = { version = "0.14" } rand = "0.8.5" -wasm-server-runner = "0.4.0" +wasm-server-runner = "0.6" # without the rayon feature [target.'cfg(target_arch = "wasm32")'.dependencies] -kd-tree = { version = "0.5.1", optional = true } +kd-tree = { version = "0.6", optional = true } [profile.dev] opt-level = 1 diff --git a/README.md b/README.md index 7a1130f..c021c1d 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ For more details on usage see [Examples](https://github.com/laundmo/bevy-spatial | bevy | bevy_spatial | | ---- | ------------ | +| 0.14 | 0.9.0 | | 0.13 | 0.8.0 | | 0.12 | 0.7.0 | | 0.11 | 0.6.0 | diff --git a/examples/distance2d.rs b/examples/distance2d.rs index d5e6014..a23220d 100644 --- a/examples/distance2d.rs +++ b/examples/distance2d.rs @@ -1,6 +1,7 @@ use std::time::Duration; use bevy::{ + color::palettes::css as csscolors, diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, math::Vec3Swizzles, prelude::*, @@ -55,7 +56,7 @@ fn setup(mut commands: Commands) { Cursor, SpriteBundle { sprite: Sprite { - color: Color::rgb(0.0, 0.0, 1.0), + color: Color::srgb(0.0, 0.0, 1.0), custom_size: Some(Vec2::new(10.0, 10.0)), ..default() }, @@ -67,7 +68,7 @@ fn setup(mut commands: Commands) { }, )); let sprite = Sprite { - color: Color::ORANGE_RED, + color: csscolors::ORANGE_RED.into(), custom_size: Some(Vec2::new(6.0, 6.0)), ..default() }; @@ -140,7 +141,7 @@ fn color( fn reset_color(mut query: Query<&mut Sprite, With>) { for mut sprite in &mut query { - sprite.color = Color::ORANGE_RED; + sprite.color = csscolors::ORANGE_RED.into(); } } diff --git a/examples/distance3d.rs b/examples/distance3d.rs index 26b53f9..c65df9f 100644 --- a/examples/distance3d.rs +++ b/examples/distance3d.rs @@ -1,4 +1,5 @@ use bevy::{ + color::palettes::css as csscolors, diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, prelude::*, window::PrimaryWindow, @@ -41,9 +42,9 @@ fn setup( mut materials: ResMut>, ) { let handles = MaterialHandles { - orange_red: materials.add(Color::ORANGE_RED), - black: materials.add(Color::BLACK), - blue: materials.add(Color::BLUE), + orange_red: materials.add(Color::from(csscolors::ORANGE_RED)), + black: materials.add(Color::from(csscolors::BLACK)), + blue: materials.add(Color::from(csscolors::BLUE)), }; commands.insert_resource(handles.clone()); commands.insert_resource(AmbientLight { @@ -56,7 +57,7 @@ fn setup( }); commands .spawn(PbrBundle { - mesh: meshes.add(Mesh::from(shape::Cube { size: 10.0 })), + mesh: meshes.add(Cuboid::new(10., 10., 10.)), material: handles.blue.clone(), transform: Transform::from_xyz(0.0, 0.5, 0.0), ..default() @@ -68,7 +69,7 @@ fn setup( for z in -6..6 { commands .spawn(PbrBundle { - mesh: meshes.add(Mesh::from(shape::Cube { size: 4.0 })), + mesh: meshes.add(Cuboid::new(4., 4., 4.)), material: handles.orange_red.clone(), transform: Transform::from_xyz( (x * 15) as f32, diff --git a/examples/modify_timestep.rs b/examples/modify_timestep.rs index aab2706..9a1979e 100644 --- a/examples/modify_timestep.rs +++ b/examples/modify_timestep.rs @@ -1,6 +1,8 @@ use std::time::Duration; +use bevy::color::palettes::css as csscolors; use bevy::prelude::*; + use bevy_spatial::{ kdtree::KDTree2, AutomaticUpdate, SpatialAccess, SpatialStructure, TimestepLength, }; @@ -42,7 +44,7 @@ fn setup(mut commands: Commands) { Chaser, SpriteBundle { sprite: Sprite { - color: Color::BLUE, + color: csscolors::BLUE.into(), custom_size: Some(Vec2::new(10.0, 10.0)), ..default() }, @@ -52,22 +54,22 @@ fn setup(mut commands: Commands) { )); let neighbours = [ - (Color::RED, Vec3::Y * 100.), - (Color::RED, Vec3::NEG_Y * 100.), - (Color::RED, Vec3::X * 100.), - (Color::RED, Vec3::NEG_X * 100.), + (csscolors::RED, Vec3::Y * 100.), + (csscolors::RED, Vec3::NEG_Y * 100.), + (csscolors::RED, Vec3::X * 100.), + (csscolors::RED, Vec3::NEG_X * 100.), ]; - for (color, position) in neighbours.iter() { + for (color, position) in neighbours { commands.spawn(( NearestNeighbour, SpriteBundle { sprite: Sprite { - color: *color, + color: Color::from(color), custom_size: Some(Vec2::new(10.0, 10.0)), ..default() }, - transform: Transform::from_translation(*position), + transform: Transform::from_translation(position), ..default() }, )); diff --git a/examples/movetowards.rs b/examples/movetowards.rs index 11b9520..1aa806d 100644 --- a/examples/movetowards.rs +++ b/examples/movetowards.rs @@ -35,7 +35,7 @@ fn setup(mut commands: Commands) { NearestNeighbour, SpriteBundle { sprite: Sprite { - color: Color::rgb(0.7, 0.3, 0.5), + color: Color::srgb(0.7, 0.3, 0.5), custom_size: Some(Vec2::new(10.0, 10.0)), ..default() }, @@ -64,7 +64,7 @@ fn mouseclick( MoveTowards, SpriteBundle { sprite: Sprite { - color: Color::rgb(0.15, 0.15, 1.0), + color: Color::srgb(0.15, 0.15, 1.0), custom_size: Some(Vec2::new(10.0, 10.0)), ..default() },