Skip to content

Commit 2d4de13

Browse files
Niliradiwek7
andauthored
Update 0.9.0 (#220)
* Update code after changes of systems api in bevy (#208) Breaking changes were introduced in bevyengine/bevy#8079 * Use GitHub Actions config from master branch (#217) * Use GitHub Actions config from master branch * Fix formatting * Fix deprecation warnings on add_plugin * Fix CI (#218) * Fix shader (#219) * Depend on Bevy 0.11 * Bump version to v0.9.0 * Use cargo add instruction in README * Update README * Update CHANGELOG --------- Co-authored-by: Michał Iwańczuk <[email protected]>
1 parent 949c352 commit 2d4de13

File tree

12 files changed

+43
-41
lines changed

12 files changed

+43
-41
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 0.9.0
4+
- Support for Bevy 0.11.
5+
36
## 0.8.0
47
- Support for Bevy 0.10.
58
- Uses original render.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ license = "MIT OR Apache-2.0"
88
name = "bevy_prototype_lyon"
99
readme = "README.md"
1010
repository = "https://github.com/Nilirad/bevy_prototype_lyon/"
11-
version = "0.8.0"
11+
version = "0.9.0"
1212

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

1515
[dependencies]
16-
bevy = { version = "0.10", default-features = false, features = ["bevy_sprite", "bevy_render", "bevy_core_pipeline", "bevy_asset"] }
16+
bevy = { version = "0.11", default-features = false, features = ["bevy_sprite", "bevy_render", "bevy_core_pipeline", "bevy_asset"] }
1717
lyon_tessellation = "1"
1818
lyon_algorithms = "1"
1919
svgtypes = "0.8"
2020

2121
[dev-dependencies]
22-
bevy = { version = "0.10", default-features = false, features = ["x11", "bevy_asset"] }
22+
bevy = { version = "0.11", default-features = false, features = ["x11", "bevy_asset"] }

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ Currently Bevy does not support drawing custom shapes in an easy way. This crate
1818

1919
## Usage
2020

21-
Add the following line in your `cargo.toml` manifest file, under the `[dependencies]` section:
21+
Add `bevy_prototype_lyon` to your package's dependencies:
2222

23-
```TOML
24-
bevy_prototype_lyon = "0.8.0"
23+
```shell
24+
cargo add bevy_prototype_lyon
2525
```
2626

2727
Then, you can start by drawing simple shapes:
@@ -34,8 +34,8 @@ fn main() {
3434
App::new()
3535
.insert_resource(Msaa::Sample4)
3636
.add_plugins(DefaultPlugins)
37-
.add_plugin(ShapePlugin)
38-
.add_startup_system(setup_system)
37+
.add_plugins(ShapePlugin)
38+
.add_systems(Startup, setup_system)
3939
.run();
4040
}
4141

@@ -68,6 +68,7 @@ The following table shows the latest version of `bevy_prototype_lyon` that suppo
6868

6969
|bevy|bevy_prototype_lyon|license|
7070
|---|---|---|
71+
|0.11|0.9|MIT/Apache 2.0|
7172
|0.10|0.8|MIT/Apache 2.0|
7273
|0.9|0.7|MIT/Apache 2.0|
7374
|0.8|0.6|MIT/Apache 2.0|

examples/dynamic_shape.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ fn main() {
77
App::new()
88
.insert_resource(Msaa::Sample4)
99
.add_plugins(DefaultPlugins)
10-
.add_plugin(ShapePlugin)
11-
.add_startup_system(setup_system)
12-
.add_system(change_draw_mode_system)
13-
.add_system(change_number_of_sides)
14-
.add_system(rotate_shape_system)
10+
.add_plugins(ShapePlugin)
11+
.add_systems(Startup, setup_system)
12+
.add_systems(Update, change_draw_mode_system)
13+
.add_systems(Update, change_number_of_sides)
14+
.add_systems(Update, rotate_shape_system)
1515
.run();
1616
}
1717

examples/path.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ fn main() {
55
App::new()
66
.insert_resource(Msaa::Sample4)
77
.add_plugins(DefaultPlugins)
8-
.add_plugin(ShapePlugin)
9-
.add_startup_system(setup_system)
8+
.add_plugins(ShapePlugin)
9+
.add_systems(Startup, setup_system)
1010
.run();
1111
}
1212

examples/readme.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ fn main() {
88
App::new()
99
.insert_resource(Msaa::Sample4)
1010
.add_plugins(DefaultPlugins)
11-
.add_plugin(ShapePlugin)
12-
.add_startup_system(setup_system)
11+
.add_plugins(ShapePlugin)
12+
.add_systems(Startup, setup_system)
1313
.run();
1414
}
1515

examples/rounded_polygon.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ fn main() {
55
App::new()
66
.insert_resource(Msaa::Sample4)
77
.add_plugins(DefaultPlugins)
8-
.add_plugin(ShapePlugin)
9-
.add_startup_system(setup_system)
8+
.add_plugins(ShapePlugin)
9+
.add_systems(Startup, setup_system)
1010
.run();
1111
}
1212

examples/svg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ fn main() {
66
//Added msaa to reduce aliasing
77
.insert_resource(Msaa::Sample4)
88
.add_plugins(DefaultPlugins)
9-
.add_plugin(ShapePlugin)
10-
.add_startup_system(setup_system)
9+
.add_plugins(ShapePlugin)
10+
.add_systems(Startup, setup_system)
1111
.run();
1212
}
1313

src/plugin.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ use bevy::{
1919
system::{Query, ResMut, Resource},
2020
},
2121
log::error,
22-
prelude::{Color, CoreSet, Deref, DerefMut, IntoSystemConfig, IntoSystemSetConfig, SystemSet},
22+
prelude::{
23+
Color, Deref, DerefMut, IntoSystemConfigs, IntoSystemSetConfig, PostUpdate, SystemSet,
24+
},
2325
render::{
2426
mesh::{Indices, Mesh},
2527
render_resource::PrimitiveTopology,
@@ -46,17 +48,16 @@ impl Plugin for ShapePlugin {
4648
app.insert_resource(FillTessellator(fill_tess))
4749
.insert_resource(StrokeTessellator(stroke_tess))
4850
.configure_set(
49-
BuildShapes
50-
.in_base_set(CoreSet::PostUpdate)
51-
.after(bevy::transform::TransformSystem::TransformPropagate),
51+
PostUpdate,
52+
BuildShapes.after(bevy::transform::TransformSystem::TransformPropagate),
5253
)
53-
.add_system(mesh_shapes_system.in_set(BuildShapes))
54-
.add_plugin(ShapeMaterialPlugin);
54+
.add_systems(PostUpdate, mesh_shapes_system.in_set(BuildShapes))
55+
.add_plugins(ShapeMaterialPlugin);
5556
}
5657
}
5758

58-
/// [`SystemLabel`] for the system that builds the meshes for newly-added
59-
/// or changed shapes. Resides in [`PostUpdate`](CoreStage::PostUpdate).
59+
/// [`SystemSet`] for the system that builds the meshes for newly-added
60+
/// or changed shapes. Resides in [`PostUpdate`] schedule.
6061
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, SystemSet)]
6162
pub struct BuildShapes;
6263

@@ -72,7 +73,7 @@ fn mesh_shapes_system(
7273
Or<(Changed<Path>, Changed<Fill>, Changed<Stroke>)>,
7374
>,
7475
) {
75-
for (maybe_fill_mode, maybe_stroke_mode, path, mut mesh) in query.iter_mut() {
76+
for (maybe_fill_mode, maybe_stroke_mode, path, mut mesh) in &mut query {
7677
let mut buffers = VertexBuffers::new();
7778

7879
if let Some(fill_mode) = maybe_fill_mode {

src/render/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl Plugin for ShapeMaterialPlugin {
2424
Shader::from_wgsl
2525
);
2626

27-
app.add_plugin(Material2dPlugin::<ShapeMaterial>::default())
27+
app.add_plugins(Material2dPlugin::<ShapeMaterial>::default())
2828
.register_asset_reflect::<ShapeMaterial>();
2929

3030
app.world
@@ -40,7 +40,7 @@ impl Material2d for ShapeMaterial {
4040
}
4141

4242
/// A simple `Material2d` that renders with vertex colors.
43-
#[derive(Default, AsBindGroup, Reflect, FromReflect, Debug, Clone, TypeUuid)]
43+
#[derive(Default, AsBindGroup, Reflect, Debug, Clone, TypeUuid)]
4444
#[reflect(Default, Debug)]
4545
#[uuid = "ab2e068e-0cca-4941-a114-524af2c431bb"]
4646
pub struct ShapeMaterial {}

src/render/shape_material.wgsl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#import bevy_sprite::mesh2d_types
1+
#import bevy_sprite::mesh2d_types Mesh2d
22
#import bevy_sprite::mesh2d_view_bindings
3+
#import bevy_sprite::mesh2d_vertex_output MeshVertexOutput
34

45
@group(1) @binding(1)
56
var texture: texture_2d<f32>;
@@ -8,11 +9,7 @@ var texture_sampler: sampler;
89
@group(2) @binding(0)
910
var<uniform> mesh: Mesh2d;
1011

11-
struct FragmentInput {
12-
#import bevy_sprite::mesh2d_vertex_output
13-
};
14-
1512
@fragment
16-
fn fragment(in: FragmentInput) -> @location(0) vec4<f32> {
13+
fn fragment(in: MeshVertexOutput) -> @location(0) vec4<f32> {
1714
return in.color;
1815
}

src/shapes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,12 @@ impl Geometry for Line {
291291
///offset the coordinates of the paths
292292
///
293293
///In inkscape for example, to turn your units into pixels, you:
294-
///1) Go to File>Document Properties>General>Display Units and set it to px
294+
/// 1) Go to File>Document Properties>General>Display Units and set it to px
295295
///
296-
///2) In File>Document Properties>Custom Size>Units set it to px, also, this
296+
/// 2) In File>Document Properties>Custom Size>Units set it to px, also, this
297297
/// size would be used for `svg_doc_size_in_px`
298298
///
299-
///3) In File>Document Properties>Scale>Scale x make sure it is set to 1 User
299+
/// 3) In File>Document Properties>Scale>Scale x make sure it is set to 1 User
300300
/// unit per px
301301
///
302302
///Example exists in the examples folder

0 commit comments

Comments
 (0)