From: JC Date: Mon, 31 Jul 2023 01:32:51 +0000 (-0500) Subject: Allow swapping between running and editing X-Git-Url: https://git.jacobcasper.com/?a=commitdiff_plain;h=73162a56fe2a21ec0874835e57af4dfb523fabf4;p=life-pd.git Allow swapping between running and editing Also make display refresh rate less epilepsy inducing during runtime --- 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