70 lines
1.5 KiB
Rust
70 lines
1.5 KiB
Rust
use bevy_prototype_lyon::prelude::PathBuilder;
|
|
|
|
use crate::{
|
|
datatypes::{
|
|
angle::{Angle, AngleUnit},
|
|
length::Length,
|
|
Coordinate,
|
|
},
|
|
turtle::Precision,
|
|
};
|
|
|
|
/**
|
|
* All the possibilities to draw something with turtle. All the commands can get the position, heading,
|
|
* color and fill_color from the turtles state.
|
|
*/
|
|
pub enum MoveCommand {
|
|
Forward(Length),
|
|
Backward(Length),
|
|
Circle { radius: Length, angle: Angle<f32> },
|
|
Goto(Coordinate),
|
|
Home,
|
|
}
|
|
|
|
/// Different ways to drop breadcrumbs on the way like a dot or a stamp of the turtles shape.
|
|
|
|
pub enum Breadcrumb {
|
|
Dot,
|
|
Stamp,
|
|
}
|
|
|
|
/// Different ways that change the orientation of the turtle.
|
|
pub enum OrientationCommand {
|
|
Left(Angle<Precision>),
|
|
Right(Angle<Precision>),
|
|
SetHeading,
|
|
LookAt(Coordinate),
|
|
}
|
|
|
|
/// A combination of all commands that can be used while drawing.
|
|
pub enum DrawElement {
|
|
Draw(MoveCommand),
|
|
Move(MoveCommand),
|
|
Orient(OrientationCommand),
|
|
Drip(Breadcrumb),
|
|
}
|
|
|
|
pub enum DrawingSegment {
|
|
Single(DrawElement),
|
|
Outline(Vec<DrawElement>),
|
|
Filled(Vec<DrawElement>),
|
|
}
|
|
|
|
impl DrawingSegment {
|
|
pub fn draw(&self) {
|
|
match self {
|
|
DrawingSegment::Single(elem) => {
|
|
let mut path_builder = PathBuilder::new();
|
|
}
|
|
DrawingSegment::Outline(_) => todo!(),
|
|
DrawingSegment::Filled(_) => todo!(),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(PartialEq, Eq)]
|
|
pub enum DrawState {
|
|
PenDown,
|
|
PenUp,
|
|
}
|