Skip to content

Commit 0455592

Browse files
rparrettfundon
andauthored
Upgrade to Bevy 0.17 (#292)
Closes #284 Closes #285 Re-implemented on top of the `bevy_prototype_lyon` 0.14 changes with the suggestions from #285 code review and an additional fix for CI. Co-authored-by: Fangdun Tsai <[email protected]>
1 parent 9014ee2 commit 0455592

File tree

6 files changed

+25
-44
lines changed

6 files changed

+25
-44
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install stable toolchain
3333
uses: dtolnay/rust-toolchain@stable
3434
- name: Install Dependencies
35-
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
35+
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev
3636
- name: Run cargo test
3737
run: cargo test
3838

@@ -59,7 +59,7 @@ jobs:
5959
with:
6060
components: clippy
6161
- name: Install Dependencies
62-
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
62+
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev
6363
- name: Run clippy
6464
run: cargo clippy -- -D warnings
6565

Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,20 @@ license = "MIT OR Apache-2.0"
1111
name = "bevy_prototype_lyon"
1212
readme = "README.md"
1313
repository = "https://github.com/rparrett/bevy_prototype_lyon/"
14-
version = "0.14.1"
14+
version = "0.15.0"
1515

1616
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1717

1818
[dependencies]
19-
bevy = { version = "0.16", default-features = false, features = [
19+
bevy = { version = "0.17", default-features = false, features = [
2020
"bevy_asset",
21-
"bevy_core_pipeline",
2221
"bevy_log",
2322
"bevy_render",
24-
"bevy_sprite",
23+
"bevy_sprite_render",
2524
] }
2625
lyon_tessellation = "1"
2726
lyon_algorithms = "1"
2827
svgtypes = "0.15"
2928

3029
[dev-dependencies]
31-
bevy = "0.16"
30+
bevy = "0.17"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ The following table shows the latest version of `bevy_prototype_lyon` that suppo
6363

6464
|bevy|bevy_prototype_lyon|license|
6565
|---|---|---|
66+
|0.17|0.15|MIT/Apache 2.0|
6667
|0.16|0.14|MIT/Apache 2.0|
6768
|0.15|0.13|MIT/Apache 2.0|
6869
|0.14|0.12|MIT/Apache 2.0|

examples/dynamic_stroke_size.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ fn setup_system(mut commands: Commands) {
9898
Transform::default().with_translation(Vec3::new(0.0, 0.0, 1.0)),
9999
HexagonShape,
100100
));
101-
commands.spawn((ShapeBuilder::with(&big_square)
102-
.fill(ORANGE)
103-
.stroke((BLACK, 10.0))
104-
.build(),));
101+
commands.spawn(
102+
ShapeBuilder::with(&big_square)
103+
.fill(ORANGE)
104+
.stroke((BLACK, 10.0))
105+
.build(),
106+
);
105107
}

src/entity.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//! Custom Bevy ECS bundle for shapes.
2-
#![expect(deprecated)]
32
43
use bevy::prelude::*;
54
use lyon_algorithms::path::Builder;
@@ -11,30 +10,6 @@ use crate::{
1110
plugin::COLOR_MATERIAL_HANDLE,
1211
};
1312

14-
/// A Bevy `Bundle` to represent a shape.
15-
#[deprecated(since = "0.14.0", note = "please use the `Shape` component instead.")]
16-
#[allow(missing_docs)]
17-
#[derive(Bundle, Clone)]
18-
pub struct ShapeBundle {
19-
pub path: Shape,
20-
pub mesh: Mesh2d,
21-
pub material: MeshMaterial2d<ColorMaterial>,
22-
pub transform: Transform,
23-
pub visibility: Visibility,
24-
}
25-
26-
impl Default for ShapeBundle {
27-
fn default() -> Self {
28-
Self {
29-
path: default(),
30-
mesh: default(),
31-
material: MeshMaterial2d(COLOR_MATERIAL_HANDLE),
32-
transform: default(),
33-
visibility: default(),
34-
}
35-
}
36-
}
37-
3813
/// `Component` describing a geometric shape.
3914
///
4015
/// It can be constructed using `ShapeBuilder`.

src/plugin.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
//! boilerplate.
55
66
use bevy::{
7-
asset::weak_handle,
7+
asset::{RenderAssetUsages, uuid_handle},
8+
mesh::Indices,
89
prelude::*,
9-
render::{mesh::Indices, render_asset::RenderAssetUsages, render_resource::PrimitiveTopology},
10+
render::render_resource::PrimitiveTopology,
1011
};
1112
use lyon_tessellation::{self as tess, BuffersBuilder};
1213

@@ -17,7 +18,7 @@ use crate::{
1718
};
1819

1920
pub(crate) const COLOR_MATERIAL_HANDLE: Handle<ColorMaterial> =
20-
weak_handle!("7cc661a1-0cd6-c147-129a-2c01882d9580");
21+
uuid_handle!("7cc661a1-0cd6-c147-129a-2c01882d9580");
2122

2223
/// A plugin that provides resources and a system to draw shapes in Bevy with
2324
/// less boilerplate.
@@ -32,20 +33,23 @@ impl Plugin for ShapePlugin {
3233
.configure_sets(
3334
PostUpdate,
3435
BuildShapes
35-
.after(bevy::transform::TransformSystem::TransformPropagate)
36-
.before(bevy::asset::AssetEvents),
36+
.after(bevy::transform::TransformSystems::Propagate)
37+
.before(bevy::asset::AssetEventSystems),
3738
)
3839
.add_systems(PostUpdate, mesh_shapes_system.in_set(BuildShapes));
3940

40-
app.world_mut()
41-
.resource_mut::<Assets<ColorMaterial>>()
42-
.insert(
41+
if let Some(mut materials) = app.world_mut().get_resource_mut::<Assets<ColorMaterial>>() {
42+
// `insert` will not fail for uuid assets
43+
let _ = materials.insert(
4344
&COLOR_MATERIAL_HANDLE,
4445
ColorMaterial {
4546
color: Color::WHITE,
4647
..default()
4748
},
4849
);
50+
} else {
51+
error!("Failed to get Assets<ColorMaterial> resource");
52+
}
4953
}
5054
}
5155

0 commit comments

Comments
 (0)