don't draw line on turtle if pen is up

This commit is contained in:
Scott Richmond 2024-06-20 12:04:45 -04:00
parent fe5b196404
commit b9e721e4e2

View File

@ -1112,6 +1112,7 @@ fn render_turtle! () -> {
let #{heading let #{heading
:pencolor (pen_r, pen_g, pen_b, pen_a) :pencolor (pen_r, pen_g, pen_b, pen_a)
:position (x, y) :position (x, y)
pendown?
...} = state ...} = state
let first = mult ((0, 1), turtle_radius) let first = mult ((0, 1), turtle_radius)
let (x1, y1) = first let (x1, y1) = first
@ -1128,7 +1129,7 @@ fn render_turtle! () -> {
add_call! ((:endShape)) add_call! ((:endShape))
& there's a happy bug here: the stroke will be the same width as the pen width. Keep this for now. Consider also showing the pen colour here? & there's a happy bug here: the stroke will be the same width as the pen width. Keep this for now. Consider also showing the pen colour here?
add_call! ((:stroke, pen_r, pen_g, pen_b, pen_a)) add_call! ((:stroke, pen_r, pen_g, pen_b, pen_a))
add_call! ((:line, 0, 0, x1, y1)) if pendown? then add_call! ((:line, 0, 0, x1, y1)) else nil
add_call! ((:pop)) add_call! ((:pop))
:ok :ok
} }