Compare commits
No commits in common. "70e8b1ede8ffff8c718fb4ecb7e258eec124d587" and "fe5b196404fd29be7ae02165df3be8d53add1e03" have entirely different histories.
70e8b1ede8
...
fe5b196404
19
prelude.ld
19
prelude.ld
|
@ -1111,8 +1111,7 @@ fn render_turtle! () -> {
|
||||||
add_call! ((:fill, r, g, b, a))
|
add_call! ((:fill, r, g, b, a))
|
||||||
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
|
||||||
|
@ -1129,7 +1128,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))
|
||||||
if pendown? then add_call! ((:line, 0, 0, x1, y1)) else nil
|
add_call! ((:line, 0, 0, x1, y1))
|
||||||
add_call! ((:pop))
|
add_call! ((:pop))
|
||||||
:ok
|
:ok
|
||||||
}
|
}
|
||||||
|
@ -1252,16 +1251,6 @@ fn setheading! {
|
||||||
(heading as :number) -> add_command! ((:setheading, heading))
|
(heading as :number) -> add_command! ((:setheading, heading))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn showturtle! {
|
|
||||||
"If the turtle is hidden, shows the turtle. If the turtle is already visible, does nothing."
|
|
||||||
() -> add_command! ((:show))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn hideturtle! {
|
|
||||||
"If the turtle is visible, hides it. If the turtle is already hidden, does nothing."
|
|
||||||
() -> add_command! ((:hide))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn heading/vector {
|
fn heading/vector {
|
||||||
"Takes a turtle heading, and returns a unit vector of that heading."
|
"Takes a turtle heading, and returns a unit vector of that heading."
|
||||||
(heading) -> {
|
(heading) -> {
|
||||||
|
@ -1298,8 +1287,6 @@ fn apply_command {
|
||||||
(:penwidth, pixels) -> assoc (state, :penwidth, pixels)
|
(:penwidth, pixels) -> assoc (state, :penwidth, pixels)
|
||||||
(:pencolor, color) -> assoc (state, :pencolor, color)
|
(:pencolor, color) -> assoc (state, :pencolor, color)
|
||||||
(:setheading, heading) -> assoc (state, :heading, heading)
|
(:setheading, heading) -> assoc (state, :heading, heading)
|
||||||
(:show) -> assoc (state, :visible?, true)
|
|
||||||
(:hide) -> assoc (state, :visible?, false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1408,7 +1395,6 @@ pkg Prelude {
|
||||||
gte? & math
|
gte? & math
|
||||||
heading & turtles
|
heading & turtles
|
||||||
heading/vector & math
|
heading/vector & math
|
||||||
hideturtle! & turtles
|
|
||||||
home! & turtles
|
home! & turtles
|
||||||
inc & math
|
inc & math
|
||||||
inv & math
|
inv & math
|
||||||
|
@ -1478,7 +1464,6 @@ pkg Prelude {
|
||||||
set? & sets
|
set? & sets
|
||||||
setheading! & turtles
|
setheading! & turtles
|
||||||
show & strings
|
show & strings
|
||||||
showturtle! & turtles
|
|
||||||
sin & math
|
sin & math
|
||||||
slice & lists tuples strings
|
slice & lists tuples strings
|
||||||
some & values
|
some & values
|
||||||
|
|
|
@ -52,11 +52,7 @@
|
||||||
(comment
|
(comment
|
||||||
# (do
|
# (do
|
||||||
(def source `
|
(def source `
|
||||||
hideturtle! ()
|
butlast ([1, 2, 3])
|
||||||
showturtle! ()
|
|
||||||
penup! ()
|
|
||||||
pendown! ()
|
|
||||||
pencolor! (colors :red)
|
|
||||||
`)
|
`)
|
||||||
(def out (-> source
|
(def out (-> source
|
||||||
ludus
|
ludus
|
||||||
|
|
Loading…
Reference in New Issue
Block a user