diff --git a/src/ludus/postlude.ld b/src/ludus/postlude.ld index 6350e58..261ce3c 100644 --- a/src/ludus/postlude.ld +++ b/src/ludus/postlude.ld @@ -3,9 +3,18 @@ if turtle_state() :visible? then render_turtle! () else nil +let console_msgs = deref (console) +set! (console, []) + +let (r, g, b, a) = deref (bgcolor) +set! (bgcolor, colors :black) + +let draw_calls = deref (p5_calls) +set! (p5_calls, []) + #{ & :result result is provided elsewhere - :errors [] & if we get here there are no errors - :console deref (console) - :draw deref (p5_calls) + & :errors [] & if we get here there are no errors + :console console_msgs + :draw concat ([(:background, r, g, b, a)], draw_calls) } \ No newline at end of file diff --git a/src/ludus/prelude.ld b/src/ludus/prelude.ld index 21f27f0..d6dab87 100644 --- a/src/ludus/prelude.ld +++ b/src/ludus/prelude.ld @@ -658,12 +658,13 @@ fn range { &&& Turtle & other graphics let colors = @{ - :white (255, 255, 255) - :light_gray (150, 150, 150) - :dark_gray (50, 50, 50) - :red (255, 0, 0) - :green (0, 255, 0) - :blue (0, 0, 255) + :white (255, 255, 255, 255) + :light_gray (150, 150, 150, 255) + :dark_gray (50, 50, 50, 255) + :red (255, 0, 0, 255) + :green (0, 255, 0, 255) + :blue (0, 0, 255, 255) + :black (0, 0, 0, 255) } & the initial turtle state @@ -683,11 +684,9 @@ ref turtle_commands = [] & and a list of turtle states ref turtle_states = [turtle_init] -ref p5_calls = [ - (:background, 0) -] +ref p5_calls = [] -ref bgcolor = (0, 0, 0, 255) +ref bgcolor = colors :black fn add_call! (call) -> update! (p5_calls, append (_, call))