Add Debug to a lot of structs
This commit is contained in:
parent
08d4e67328
commit
e0926a00f7
@ -17,7 +17,7 @@ use crate::{
|
|||||||
* All the possibilities to draw something with turtle. All the commands can get the position, heading,
|
* All the possibilities to draw something with turtle. All the commands can get the position, heading,
|
||||||
* color and fill_color from the turtles state.
|
* color and fill_color from the turtles state.
|
||||||
*/
|
*/
|
||||||
#[derive(Component, Inspectable)]
|
#[derive(Component, Inspectable, Debug)]
|
||||||
pub enum MoveCommand {
|
pub enum MoveCommand {
|
||||||
Forward(Length),
|
Forward(Length),
|
||||||
Backward(Length),
|
Backward(Length),
|
||||||
@ -35,7 +35,7 @@ impl Default for MoveCommand {
|
|||||||
}
|
}
|
||||||
/// Different ways to drop breadcrumbs on the way like a dot or a stamp of the turtles shape.
|
/// Different ways to drop breadcrumbs on the way like a dot or a stamp of the turtles shape.
|
||||||
|
|
||||||
#[derive(Component, Inspectable, Default)]
|
#[derive(Component, Inspectable, Default, Debug)]
|
||||||
pub enum Breadcrumb {
|
pub enum Breadcrumb {
|
||||||
Dot,
|
Dot,
|
||||||
#[default]
|
#[default]
|
||||||
@ -43,7 +43,7 @@ pub enum Breadcrumb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Different ways that change the orientation of the turtle.
|
/// Different ways that change the orientation of the turtle.
|
||||||
#[derive(Component, Inspectable)]
|
#[derive(Component, Inspectable, Debug)]
|
||||||
pub enum OrientationCommand {
|
pub enum OrientationCommand {
|
||||||
Left(Angle<Precision>),
|
Left(Angle<Precision>),
|
||||||
Right(Angle<Precision>),
|
Right(Angle<Precision>),
|
||||||
@ -58,7 +58,7 @@ impl Default for OrientationCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A combination of all commands that can be used while drawing.
|
/// A combination of all commands that can be used while drawing.
|
||||||
#[derive(Component, Inspectable)]
|
#[derive(Component, Inspectable, Debug)]
|
||||||
pub enum DrawElement {
|
pub enum DrawElement {
|
||||||
Draw(MoveCommand),
|
Draw(MoveCommand),
|
||||||
Move(MoveCommand),
|
Move(MoveCommand),
|
||||||
@ -95,7 +95,7 @@ impl ToAnimationSegment for DrawElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Component, Inspectable)]
|
#[derive(Component, Inspectable, Debug)]
|
||||||
pub enum TurtleSegment {
|
pub enum TurtleSegment {
|
||||||
Single(DrawElement),
|
Single(DrawElement),
|
||||||
Outline(Vec<DrawElement>),
|
Outline(Vec<DrawElement>),
|
||||||
@ -119,7 +119,7 @@ impl ToAnimationSegment for TurtleSegment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(Component, Inspectable)]
|
#[derive(Component, Inspectable, Debug)]
|
||||||
pub struct TurtleCommands {
|
pub struct TurtleCommands {
|
||||||
animation_state: usize,
|
animation_state: usize,
|
||||||
commands: Vec<TurtleSegment>,
|
commands: Vec<TurtleSegment>,
|
||||||
|
|||||||
@ -6,7 +6,7 @@ pub mod animation;
|
|||||||
mod line_segments;
|
mod line_segments;
|
||||||
pub(crate) mod run_step;
|
pub(crate) mod run_step;
|
||||||
|
|
||||||
#[derive(Inspectable, Default)]
|
#[derive(Inspectable, Default, Debug)]
|
||||||
pub enum TurtleGraphElement {
|
pub enum TurtleGraphElement {
|
||||||
TurtleLine(TurtleDrawLine),
|
TurtleLine(TurtleDrawLine),
|
||||||
TurtleCircle(TurtleDrawCircle),
|
TurtleCircle(TurtleDrawCircle),
|
||||||
|
|||||||
@ -16,7 +16,16 @@ pub struct TurtleDrawLine {
|
|||||||
marker: LineMarker,
|
marker: LineMarker,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Component, Default, Inspectable)]
|
impl std::fmt::Debug for TurtleDrawLine {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
f.debug_struct("TurtleDrawLine")
|
||||||
|
.field("name", &self.name)
|
||||||
|
.field("marker", &self.marker)
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Component, Default, Inspectable, Debug)]
|
||||||
struct LineMarker;
|
struct LineMarker;
|
||||||
|
|
||||||
impl TurtleDrawLine {
|
impl TurtleDrawLine {
|
||||||
@ -45,7 +54,16 @@ pub struct TurtleDrawCircle {
|
|||||||
marker: CircleMarker,
|
marker: CircleMarker,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Component, Default, Inspectable)]
|
impl std::fmt::Debug for TurtleDrawCircle {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
f.debug_struct("TurtleDrawCircle")
|
||||||
|
.field("name", &self.name)
|
||||||
|
.field("marker", &self.marker)
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Component, Default, Inspectable, Debug)]
|
||||||
struct CircleMarker;
|
struct CircleMarker;
|
||||||
|
|
||||||
impl TurtleDrawCircle {
|
impl TurtleDrawCircle {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ pub use turtle::turtle;
|
|||||||
#[derive(Clone, Component, Inspectable)]
|
#[derive(Clone, Component, Inspectable)]
|
||||||
pub struct TurtleShape;
|
pub struct TurtleShape;
|
||||||
|
|
||||||
#[derive(Clone, Component, Inspectable, Default)]
|
#[derive(Clone, Component, Inspectable, Default, Debug)]
|
||||||
pub struct TurtleColors {
|
pub struct TurtleColors {
|
||||||
color: Color,
|
color: Color,
|
||||||
fill_color: Color,
|
fill_color: Color,
|
||||||
|
|||||||
@ -10,7 +10,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Describing the full state of a turtle.
|
/// Describing the full state of a turtle.
|
||||||
#[derive(Component, Inspectable, Default)]
|
#[derive(Component, Inspectable, Default, Debug)]
|
||||||
pub struct TurtleState {
|
pub struct TurtleState {
|
||||||
drawing: Vec<TurtleSegment>,
|
drawing: Vec<TurtleSegment>,
|
||||||
position: Coordinate,
|
position: Coordinate,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user