flip the direction of y now y increases upwards

This commit is contained in:
Franz Dietrich 2025-10-19 14:19:00 +02:00
parent 1d93c22a73
commit 64bd8ee530
3 changed files with 5 additions and 3 deletions

View File

@ -615,7 +615,7 @@ impl TurtlePlan {
/// Coordinates are in screen space: /// Coordinates are in screen space:
/// - `(0, 0)` is at the center /// - `(0, 0)` is at the center
/// - Positive x goes right /// - Positive x goes right
/// - Positive y goes down /// - Positive y goes up
/// ///
/// # Examples /// # Examples
/// ///

View File

@ -247,7 +247,8 @@ pub fn execute_command(command: &TurtleCommand, state: &mut Turtle) {
TurtleCommand::Goto(coord) => { TurtleCommand::Goto(coord) => {
let start = state.params.position; let start = state.params.position;
state.params.position = *coord; // Flip Y coordinate: turtle graphics uses Y+ = up, but Macroquad uses Y+ = down
state.params.position = vec2(coord.x, -coord.y);
if state.params.pen_down { if state.params.pen_down {
// Draw line segment with round caps // Draw line segment with round caps

View File

@ -400,7 +400,8 @@ impl TweenController {
}); });
} }
TurtleCommand::Goto(coord) => { TurtleCommand::Goto(coord) => {
target.position = *coord; // Flip Y coordinate: turtle graphics uses Y+ = up, but Macroquad uses Y+ = down
target.position = vec2(coord.x, -coord.y);
} }
TurtleCommand::SetHeading(heading) => { TurtleCommand::SetHeading(heading) => {
target.heading = normalize_angle(*heading); target.heading = normalize_angle(*heading);