From 12f1a85e277897a0a7af4c3c4a0e464c1ab4c767 Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Sun, 20 Oct 2024 14:39:36 -0400 Subject: [PATCH] fix p5 call push/pop errors --- build/ludus.mjs | 4 ++-- build/p5_test.mjs | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/build/ludus.mjs b/build/ludus.mjs index a6c4631..602863a 100644 --- a/build/ludus.mjs +++ b/build/ludus.mjs @@ -191,10 +191,10 @@ const turtle_angle = 0.385 const turtle_color = [255, 255, 255, 150] const p5_call_root = [ + ["background", ...resolve_color(background_color)], ["push"], ["rotate", Math.PI], ["scale", -1, 1], - ["background", ...resolve_color(background_color)], ["stroke", ...resolve_color(turtle_init.pencolor)], ] @@ -357,10 +357,10 @@ export function p5 (commands) { for (const call of calls) { p5_calls.push(call) } - p5_calls.push(["pop"]) } p5_calls[0] = ["background", ...resolve_color(background_color)] p5_render_turtle(states[states.length - 1], p5_calls) + p5_calls.push(["pop"]) return p5_calls } diff --git a/build/p5_test.mjs b/build/p5_test.mjs index c188b8b..10b0d9d 100644 --- a/build/p5_test.mjs +++ b/build/p5_test.mjs @@ -3,13 +3,8 @@ import {run, p5} from "./ludus.mjs" const code = ` print! ("Hello, world!") pencolor! (colors :white) -repeat 10 { - repeat 4 { - fd! (500) - rt! (0.25) - } - rt! (0.1) -}` +fd! (50) +` const result = run(code)