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

Revert "Rename Color to LegacyColor" #243

Merged
merged 1 commit into from
Mar 1, 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
6 changes: 3 additions & 3 deletions examples/dynamic_shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn change_draw_mode_system(mut query: Query<(&mut Fill, &mut Stroke)>, time: Res
let outline_width = 2.0 + time.elapsed_seconds_f64().sin().abs() * 10.0;

for (mut fill_mode, mut stroke_mode) in query.iter_mut() {
fill_mode.color = LegacyColor::hsl(hue as f32, 1.0, 0.5);
fill_mode.color = Color::hsl(hue as f32, 1.0, 0.5);
stroke_mode.options.line_width = outline_width as f32;
}
}
Expand Down Expand Up @@ -63,8 +63,8 @@ fn setup_system(mut commands: Commands) {
path: GeometryBuilder::build_as(&shape),
..default()
},
Fill::color(LegacyColor::CYAN),
Stroke::new(LegacyColor::BLACK, 10.0),
Fill::color(Color::CYAN),
Stroke::new(Color::BLACK, 10.0),
ExampleShape,
));
}
4 changes: 2 additions & 2 deletions examples/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn setup_system(mut commands: Commands) {
},
..default()
},
Stroke::new(LegacyColor::BLACK, 10.0),
Fill::color(LegacyColor::RED),
Stroke::new(Color::BLACK, 10.0),
Fill::color(Color::RED),
));
}
4 changes: 2 additions & 2 deletions examples/readme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn setup_system(mut commands: Commands) {
path: GeometryBuilder::build_as(&shape),
..default()
},
Fill::color(LegacyColor::CYAN),
Stroke::new(LegacyColor::BLACK, 10.0),
Fill::color(Color::CYAN),
Stroke::new(Color::BLACK, 10.0),
));
}
2 changes: 1 addition & 1 deletion examples/rounded_polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ fn setup_system(mut commands: Commands) {
path: GeometryBuilder::build_as(&shape),
..default()
},
Fill::color(LegacyColor::CYAN),
Fill::color(Color::CYAN),
));
}
8 changes: 4 additions & 4 deletions examples/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn setup_system(mut commands: Commands) {
}),
..default()
},
Stroke::new(LegacyColor::BLACK, 4.0),
Stroke::new(Color::BLACK, 4.0),
));
parent.spawn((
ShapeBundle {
Expand All @@ -53,7 +53,7 @@ fn setup_system(mut commands: Commands) {
}),
..default()
},
Stroke::new(LegacyColor::BLACK, 2.5),
Stroke::new(Color::BLACK, 2.5),
));
});

Expand Down Expand Up @@ -84,7 +84,7 @@ fn setup_system(mut commands: Commands) {
}),
..default()
},
Stroke::new(LegacyColor::BLACK, 20.0),
Stroke::new(Color::BLACK, 20.0),
));

// shack walls
Expand All @@ -96,7 +96,7 @@ fn setup_system(mut commands: Commands) {
}),
..default()
},
Stroke::new(LegacyColor::BLACK, 17.5),
Stroke::new(Color::BLACK, 17.5),
));
});
}
Expand Down
18 changes: 9 additions & 9 deletions src/draw.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Types for defining shape color and options.

use bevy::{ecs::component::Component, render::color::LegacyColor};
use bevy::{ecs::component::Component, render::color::Color};

Check failure on line 3 in src/draw.rs

View workflow job for this annotation

GitHub Actions / clippy

unresolved import `bevy::render::color`

error[E0432]: unresolved import `bevy::render::color` --> src/draw.rs:3:47 | 3 | use bevy::{ecs::component::Component, render::color::Color}; | ^^^^^ could not find `color` in `render`

Check failure on line 3 in src/draw.rs

View workflow job for this annotation

GitHub Actions / clippy

unresolved import `bevy::render::color`

error[E0432]: unresolved import `bevy::render::color` --> src/draw.rs:3:47 | 3 | use bevy::{ecs::component::Component, render::color::Color}; | ^^^^^ could not find `color` in `render`
use lyon_tessellation::{FillOptions, StrokeOptions};

/// Defines the fill options for the lyon tessellator and color of the generated
Expand All @@ -9,13 +9,13 @@
#[derive(Component, Debug, Clone, Copy, PartialEq)]
pub struct Fill {
pub options: FillOptions,
pub color: LegacyColor,
pub color: Color,
}

impl Fill {
/// Convenience constructor requiring only the `LegacyColor`.
/// Convenience constructor requiring only the `Color`.
#[must_use]
pub fn color(color: LegacyColor) -> Self {
pub fn color(color: Color) -> Self {
Self {
options: FillOptions::default(),
color,
Expand All @@ -29,22 +29,22 @@
#[derive(Component, Debug, Clone, Copy, PartialEq)]
pub struct Stroke {
pub options: StrokeOptions,
pub color: LegacyColor,
pub color: Color,
}

impl Stroke {
/// Constructor that requires a `LegacyColor` and a line width.
/// Constructor that requires a `Color` and a line width.
#[must_use]
pub fn new(color: LegacyColor, line_width: f32) -> Self {
pub fn new(color: Color, line_width: f32) -> Self {
Self {
options: StrokeOptions::default().with_line_width(line_width),
color,
}
}

/// Convenience constructor requiring only the `LegacyColor`.
/// Convenience constructor requiring only the `Color`.
#[must_use]
pub fn color(color: LegacyColor) -> Self {
pub fn color(color: Color) -> Self {
Self {
options: StrokeOptions::default(),
color,
Expand Down
6 changes: 3 additions & 3 deletions src/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ impl GeometryBuilder {
/// path: builder.build(),
/// ..default()
/// },
/// Fill::color(LegacyColor::ORANGE_RED),
/// Stroke::new(LegacyColor::ORANGE_RED, 10.0),
/// Fill::color(Color::ORANGE_RED),
/// Stroke::new(Color::ORANGE_RED, 10.0),
/// ));
/// }
/// # bevy::ecs::system::assert_is_system(my_system);
Expand Down Expand Up @@ -115,7 +115,7 @@ impl GeometryBuilder {
/// path: GeometryBuilder::build_as(&line),
/// ..default()
/// },
/// Fill::color(LegacyColor::ORANGE_RED),
/// Fill::color(Color::ORANGE_RED),
/// ));
/// }
/// # bevy::ecs::system::assert_is_system(my_system);
Expand Down
4 changes: 2 additions & 2 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Plugin for ShapePlugin {
app.world.resource_mut::<Assets<ColorMaterial>>().insert(
COLOR_MATERIAL_HANDLE,
ColorMaterial {
color: LegacyColor::WHITE,
color: Color::WHITE,
..default()
},
);
Expand Down Expand Up @@ -85,7 +85,7 @@ fn mesh_shapes_system(
fill(
&mut fill_tess,
&path.0,
&Fill::color(LegacyColor::FUCHSIA),
&Fill::color(Color::FUCHSIA),
&mut buffers,
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/vertex.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy::render::color::LegacyColor;
use bevy::render::color::Color;

Check failure on line 1 in src/vertex.rs

View workflow job for this annotation

GitHub Actions / clippy

unresolved import `bevy::render::color`

error[E0432]: unresolved import `bevy::render::color` --> src/vertex.rs:1:19 | 1 | use bevy::render::color::Color; | ^^^^^ could not find `color` in `render`

Check failure on line 1 in src/vertex.rs

View workflow job for this annotation

GitHub Actions / clippy

unresolved import `bevy::render::color`

error[E0432]: unresolved import `bevy::render::color` --> src/vertex.rs:1:19 | 1 | use bevy::render::color::Color; | ^^^^^ could not find `color` in `render`
use lyon_tessellation::{
self as tess, FillVertex, FillVertexConstructor, StrokeVertex, StrokeVertexConstructor,
};
Expand All @@ -19,7 +19,7 @@
/// Zero-sized type used to implement various vertex construction traits from
/// Lyon.
pub struct VertexConstructor {
pub color: LegacyColor,
pub color: Color,
}

/// Enables the construction of a [`Vertex`] when using a `FillTessellator`.
Expand Down
Loading