From 11b9539800215db46cd610e8d6e8e05158683420 Mon Sep 17 00:00:00 2001 From: Dietrich Date: Wed, 7 Dec 2022 13:51:46 +0100 Subject: [PATCH] enable basic left and right rotation --- src/commands.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 0c3e630..160acdb 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -5,7 +5,7 @@ use crate::{ drawing::{ self, animation::{ - draw_straight_segment, move_straight_segment, ToAnimationSegment, + draw_straight_segment, move_straight_segment, turtle_turn, ToAnimationSegment, TurtleAnimationSegment, }, TurtleGraphElement, @@ -89,7 +89,12 @@ impl ToAnimationSegment for DrawElement { MoveCommand::Circle { radius, angle } => todo!(), MoveCommand::Goto(coord) => todo!(), }, - DrawElement::Orient(_) => todo!(), + DrawElement::Orient(e) => match e { + OrientationCommand::Left(angle_to_turn) => turtle_turn(state, -*angle_to_turn), + OrientationCommand::Right(angle_to_turn) => turtle_turn(state, *angle_to_turn), + OrientationCommand::SetHeading => todo!(), + OrientationCommand::LookAt(_) => todo!(), + }, DrawElement::Drip(_) => todo!(), } }