Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to bevy 0.14 #247

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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:/bevyengine/bevy", branch = "main", default-features = false, features = ["bevy_sprite", "bevy_render", "bevy_core_pipeline", "bevy_asset"] }
bevy = { git = "https:/bevyengine/bevy", branch = "main", 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:/bevyengine/bevy", branch = "main", default-features = false, features = ["x11", "bevy_asset"] }
bevy = { git = "https:/bevyengine/bevy", branch = "main", default-features = false, features = [
"x11",
"bevy_asset",
# TODO: Figure out if this will be needed https:/bevyengine/bevy/issues/13728
"ktx2",
"zstd",
"bevy_pbr",
] }
6 changes: 3 additions & 3 deletions examples/dynamic_shape.rs
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down Expand Up @@ -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,
));
}
6 changes: 3 additions & 3 deletions examples/path.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy::{color::palettes, prelude::*};
use bevy::{color::palettes::css::*, prelude::*};
use bevy_prototype_lyon::prelude::*;

fn main() {
Expand Down Expand Up @@ -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),
));
}
6 changes: 3 additions & 3 deletions examples/readme.rs
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -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),
));
}
4 changes: 2 additions & 2 deletions examples/rounded_polygon.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy::{color::palettes, prelude::*};
use bevy::{color::palettes::css::*, prelude::*};
use bevy_prototype_lyon::prelude::*;

fn main() {
Expand Down Expand Up @@ -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),
));
}
12 changes: 6 additions & 6 deletions src/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Color>) -> Self {
Self {
options: FillOptions::default(),
color,
color: color.into(),
}
}
}
Expand All @@ -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<Color>, 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<Color>) -> Self {
Self {
options: StrokeOptions::default(),
color,
color: color.into(),
}
}
}
6 changes: 3 additions & 3 deletions src/vertex.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy::color::{Color, LinearRgba};
use bevy::color::{Color, ColorToComponents};
use lyon_tessellation::{
self as tess, FillVertex, FillVertexConstructor, StrokeVertex, StrokeVertexConstructor,
};
Expand Down Expand Up @@ -27,7 +27,7 @@ impl FillVertexConstructor<Vertex> 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(),
}
}
}
Expand All @@ -37,7 +37,7 @@ impl StrokeVertexConstructor<Vertex> 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(),
}
}
}
Loading