Skip to content

Commit

Permalink
update to bevy 0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
laundmo committed Jul 6, 2024
1 parent 0343e7a commit 6f52049
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 24 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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" }

Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
7 changes: 4 additions & 3 deletions examples/distance2d.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::time::Duration;

use bevy::{
color::palettes::css as csscolors,
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
math::Vec3Swizzles,
prelude::*,
Expand Down Expand Up @@ -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()
},
Expand All @@ -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()
};
Expand Down Expand Up @@ -140,7 +141,7 @@ fn color(

fn reset_color(mut query: Query<&mut Sprite, With<NearestNeighbourComponent>>) {
for mut sprite in &mut query {
sprite.color = Color::ORANGE_RED;
sprite.color = csscolors::ORANGE_RED.into();
}
}

Expand Down
11 changes: 6 additions & 5 deletions examples/distance3d.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use bevy::{
color::palettes::css as csscolors,
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::*,
window::PrimaryWindow,
Expand Down Expand Up @@ -41,9 +42,9 @@ fn setup(
mut materials: ResMut<Assets<StandardMaterial>>,
) {
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 {
Expand All @@ -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()
Expand All @@ -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,
Expand Down
18 changes: 10 additions & 8 deletions examples/modify_timestep.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down Expand Up @@ -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()
},
Expand All @@ -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()
},
));
Expand Down
4 changes: 2 additions & 2 deletions examples/movetowards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
Expand Down Expand Up @@ -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()
},
Expand Down

0 comments on commit 6f52049

Please sign in to comment.