Implementing a dynamic image to use for a menu image

You can do this! The key is to create a new image in gameWillPause and then pass it into pushContext. When you do that, all drawing calls you make render into your new image instead of the screen:

function playdate.gameWillPause()
    local img = playdate.graphics.image.new(400,240)
    playdate.graphics.pushContext(img)
    -- draw image content based on game state
    playdate.graphics.popContext()
    playdate.setMenuImage(img)
end

(Untested, but should give you the idea)

3 Likes