Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion header.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ math.randomseed(os.time())
local font = playdate.graphics.font.new("fonts/Phozon/Phozon")
playdate.graphics.setFont(font)

local updateCoroutine

function love.draw()
-- must be changed at start of frame when canvas is not active
local newCanvasWidth, newCanvasHeight = playbit.graphics.getCanvasSize()
Expand Down Expand Up @@ -86,7 +88,14 @@ function love.draw()
love.graphics.translate(playbit.graphics.drawOffset.x, playbit.graphics.drawOffset.y)

-- main update
playdate.update()
if not updateCoroutine or coroutine.status(updateCoroutine) == "dead" then
updateCoroutine = coroutine.create(playdate.update)
end

local ok, err = coroutine.resume(updateCoroutine)
if not ok then
error(err)
end

-- debug draw
if playdate.debugDraw then
Expand Down