From 742f51ee1e1c6b97fecfb09c8cea25481d1e002f Mon Sep 17 00:00:00 2001 From: Azorlogh Date: Tue, 25 Jun 2024 11:43:20 +0200 Subject: [PATCH 1/2] update to bevy 0.14.0-rc.3 --- Cargo.toml | 16 ++++++++++++++-- examples/dynamic_shape.rs | 6 +++--- examples/path.rs | 6 +++--- examples/readme.rs | 6 +++--- examples/rounded_polygon.rs | 4 ++-- src/draw.rs | 12 ++++++------ src/vertex.rs | 6 +++--- 7 files changed, 34 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6d64dda..9a503cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,10 +13,22 @@ version = "0.8.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy = { git = "https://github.com/bevyengine/bevy", branch = "main", default-features = false, features = ["bevy_sprite", "bevy_render", "bevy_core_pipeline", "bevy_asset"] } +bevy = { version = "0.14.0-rc.3", default-features = false, features = [ + "bevy_sprite", + "bevy_render", + "bevy_core_pipeline", + "bevy_asset", +] } lyon_tessellation = "1" lyon_algorithms = "1" svgtypes = "0.8" [dev-dependencies] -bevy = { git = "https://github.com/bevyengine/bevy", branch = "main", default-features = false, features = ["x11", "bevy_asset"] } +bevy = { version = "0.14.0-rc.3", default-features = false, features = [ + "x11", + "bevy_asset", + # TODO: Figure out if this will be needed https://github.com/bevyengine/bevy/issues/13728 + "ktx2", + "zstd", + "bevy_pbr", +] } diff --git a/examples/dynamic_shape.rs b/examples/dynamic_shape.rs index d1c11df..2c777b9 100644 --- a/examples/dynamic_shape.rs +++ b/examples/dynamic_shape.rs @@ -1,6 +1,6 @@ use std::f64::consts::PI; -use bevy::{color::palettes, prelude::*}; +use bevy::{color::palettes::css::*, prelude::*}; use bevy_prototype_lyon::prelude::*; fn main() { @@ -63,8 +63,8 @@ fn setup_system(mut commands: Commands) { path: GeometryBuilder::build_as(&shape), ..default() }, - Fill::color(Color::Srgba(palettes::css::DARK_CYAN)), - Stroke::new(Color::Srgba(palettes::css::BLACK), 10.0), + Fill::color(DARK_CYAN), + Stroke::new(BLACK, 10.0), ExampleShape, )); } diff --git a/examples/path.rs b/examples/path.rs index 1e23ff4..ec2fd47 100644 --- a/examples/path.rs +++ b/examples/path.rs @@ -1,4 +1,4 @@ -use bevy::{color::palettes, prelude::*}; +use bevy::{color::palettes::css::*, prelude::*}; use bevy_prototype_lyon::prelude::*; fn main() { @@ -36,7 +36,7 @@ fn setup_system(mut commands: Commands) { }, ..default() }, - Stroke::new(Color::Srgba(palettes::css::BLACK), 10.0), - Fill::color(Color::Srgba(palettes::css::RED)), + Stroke::new(BLACK, 10.0), + Fill::color(RED), )); } diff --git a/examples/readme.rs b/examples/readme.rs index 4cb8029..60ccf64 100644 --- a/examples/readme.rs +++ b/examples/readme.rs @@ -1,7 +1,7 @@ //! This is the example that goes to the README.md file. The README.md should be //! updated before every release. -use bevy::{color::palettes, prelude::*}; +use bevy::{color::palettes::css::*, prelude::*}; use bevy_prototype_lyon::prelude::*; fn main() { @@ -26,7 +26,7 @@ fn setup_system(mut commands: Commands) { path: GeometryBuilder::build_as(&shape), ..default() }, - Fill::color(Color::Srgba(palettes::css::DARK_CYAN)), - Stroke::new(Color::Srgba(palettes::css::BLACK), 10.0), + Fill::color(DARK_CYAN), + Stroke::new(BLACK, 10.0), )); } diff --git a/examples/rounded_polygon.rs b/examples/rounded_polygon.rs index 36cde16..52c34ce 100644 --- a/examples/rounded_polygon.rs +++ b/examples/rounded_polygon.rs @@ -1,4 +1,4 @@ -use bevy::{color::palettes, prelude::*}; +use bevy::{color::palettes::css::*, prelude::*}; use bevy_prototype_lyon::prelude::*; fn main() { @@ -34,6 +34,6 @@ fn setup_system(mut commands: Commands) { path: GeometryBuilder::build_as(&shape), ..default() }, - Fill::color(Color::Srgba(palettes::css::DARK_CYAN)), + Fill::color(DARK_CYAN), )); } diff --git a/src/draw.rs b/src/draw.rs index 511a483..3b241fd 100644 --- a/src/draw.rs +++ b/src/draw.rs @@ -15,10 +15,10 @@ pub struct Fill { impl Fill { /// Convenience constructor requiring only the `Color`. #[must_use] - pub fn color(color: Color) -> Self { + pub fn color(color: impl Into) -> Self { Self { options: FillOptions::default(), - color, + color: color.into(), } } } @@ -35,19 +35,19 @@ pub struct Stroke { impl Stroke { /// Constructor that requires a `Color` and a line width. #[must_use] - pub fn new(color: Color, line_width: f32) -> Self { + pub fn new(color: impl Into, line_width: f32) -> Self { Self { options: StrokeOptions::default().with_line_width(line_width), - color, + color: color.into(), } } /// Convenience constructor requiring only the `Color`. #[must_use] - pub fn color(color: Color) -> Self { + pub fn color(color: impl Into) -> Self { Self { options: StrokeOptions::default(), - color, + color: color.into(), } } } diff --git a/src/vertex.rs b/src/vertex.rs index d7909c7..7cad78e 100644 --- a/src/vertex.rs +++ b/src/vertex.rs @@ -1,4 +1,4 @@ -use bevy::color::{Color, LinearRgba}; +use bevy::color::{Color, ColorToComponents}; use lyon_tessellation::{ self as tess, FillVertex, FillVertexConstructor, StrokeVertex, StrokeVertexConstructor, }; @@ -27,7 +27,7 @@ impl FillVertexConstructor for VertexConstructor { fn new_vertex(&mut self, vertex: FillVertex) -> Vertex { Vertex { position: [vertex.position().x, vertex.position().y], - color: LinearRgba::to_f32_array(&LinearRgba::from(self.color)), + color: self.color.to_linear().to_f32_array(), } } } @@ -37,7 +37,7 @@ impl StrokeVertexConstructor for VertexConstructor { fn new_vertex(&mut self, vertex: StrokeVertex) -> Vertex { Vertex { position: [vertex.position().x, vertex.position().y], - color: LinearRgba::to_f32_array(&LinearRgba::from(self.color)), + color: self.color.to_linear().to_f32_array(), } } } From de37711867a86f450124e03f638728cfe47bf4ca Mon Sep 17 00:00:00 2001 From: Nilirad Date: Tue, 25 Jun 2024 19:17:32 +0200 Subject: [PATCH 2/2] Depend on `main` branch of Bevy --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9a503cf..53e1103 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ version = "0.8.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy = { version = "0.14.0-rc.3", default-features = false, features = [ +bevy = { git = "https://github.com/bevyengine/bevy", branch = "main", default-features = false, features = [ "bevy_sprite", "bevy_render", "bevy_core_pipeline", @@ -24,7 +24,7 @@ lyon_algorithms = "1" svgtypes = "0.8" [dev-dependencies] -bevy = { version = "0.14.0-rc.3", default-features = false, features = [ +bevy = { git = "https://github.com/bevyengine/bevy", branch = "main", default-features = false, features = [ "x11", "bevy_asset", # TODO: Figure out if this will be needed https://github.com/bevyengine/bevy/issues/13728