From d84a930073a520b9f8f8206ffe9ff3b957e85c31 Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Wed, 5 Jun 2024 23:23:47 -0400 Subject: [PATCH] bring in and update postlude --- janet/ludus.janet | 5 +++++ janet/postlude.ld | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 janet/postlude.ld diff --git a/janet/ludus.janet b/janet/ludus.janet index 175aeda..82b048f 100644 --- a/janet/ludus.janet +++ b/janet/ludus.janet @@ -57,4 +57,9 @@ This new scene will have to return a JSON POJSO: (-> source run) ) +(comment +Next up: +* postlude! +* testing turtle graphics +) diff --git a/janet/postlude.ld b/janet/postlude.ld new file mode 100644 index 0000000..356adbe --- /dev/null +++ b/janet/postlude.ld @@ -0,0 +1,25 @@ +& this file runs after any given interpretation +& even if the original interpretation panics +& the goal is to output any global state held in Ludus +& this does not have base loaded into it, only prelude: must be pure Ludus + +if turtle_state () :visible? then render_turtle! () else nil + +reset_turtle! () + +let console_msgs = flush! () + +let (r, g, b, a) = unbox (bgcolor) +make! (bgcolor, colors :black) + +let draw_calls = unbox (p5_calls) +store! (p5_calls, []) + +#{ + & :result result is provided elsewhere + & :errors [] & if we get here there are no errors + :console console_msgs + :draw concat ( + [(:background, r, g, b, a), (:stroke, 255, 255, 255, 255)] + draw_calls) +}