From 73162a56fe2a21ec0874835e57af4dfb523fabf4 Mon Sep 17 00:00:00 2001 From: JC Date: Sun, 30 Jul 2023 20:32:51 -0500 Subject: [PATCH] Allow swapping between running and editing Also make display refresh rate less epilepsy inducing during runtime --- source/main.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/main.lua b/source/main.lua index ce2c572..cc8aee4 100644 --- a/source/main.lua +++ b/source/main.lua @@ -47,8 +47,12 @@ function draw(cells) end function playdate.update() + if playdate.buttonJustPressed("b") then + running = not running + end if not running then -- automata state setup + pd.display.setRefreshRate(30) draw(cells) if playdate.buttonJustPressed("right") then @@ -61,11 +65,11 @@ function playdate.update() y = math.min(HEIGHT, y + 1) elseif playdate.buttonJustPressed("a") then cells[x][y].live = not cells[x][y].live - elseif playdate.buttonJustPressed("b") then - running = true end else -- running + -- Make running less epileptic while letting interaction remain smooth + pd.display.setRefreshRate(2) draw(cells) cells = generation(cells) end -- 2.20.1