Updating screen on gameWillPause

,

Hello!

On gameWillResume I show a countdown before resuming the game, using a different setDitherPattern() on every tick before fully resuming the game. My issue is that since this countdown + dithering gets set on gameWillResume, when the menu closes, it looks like the normal game for a split second, before the countdown + dithering gets shown.

I tried to use gameWillPause to add the dithering before pausing:

function playdate.gameWillPause()
gfx.setColor(gfx.kColorBlack)
gfx.setDitherPattern(0.3)
gfx.fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)
end

But this seems to have no effect, maybe the screen never gets updated after gameWillPause is called? Does anybody know?

If you log something in the fuction, is it correctly logged into console (just in case the issue could be simple typo)?

If so, my guess would be that you’re manipulating the drawing origin with playdate.graphics.setDrawOffset(x, y).

Hi Jan, thanks for the reply!

Yes that’s just what I had tried, and a print in that function does get logged, I just can’t seem to update the screen - I tried different ways e.g. with drawText, fillRect but I can never update the screen from gameWillPause.
And no the offset isn’t the issue either, if I draw something in the update it works fine.

1 Like

What happens if you call playdate.display.flush() at the end?

Yea I tried that too, but nope :frowning:

Hello!

I've been working with the system menu too lately and I might have an answer for you.

GameWillPause takes in information when called, but the updated will not apply until the system menu is closed.

I recommend creating a local image during gameWillPause that covers your screen or system menu (depending on what you’re doing). That way it’s already drawn when you close the menu.

local tempMenuDisplay = gfx.image.new(“images/yourPreDrawnMenuImage”)

gfx.pushContext(tempMenuDisplay)

-- or make a new image and draw to it

gfx.popContext()

pd.setMenuImage(tempMenuDisplay, 0)

*Another Option is to use setMenuImage and use the offset option in the second condition. You can push the “screenshot” it takes of your game when you pause off further to the left. This creates a bouncy slide animation as it moves your image out of the way.

These two posts helped me out with this:
Menu Image
Resuming from Pause

Let me know if this cleared things up. This is my first time responding trying to help out so apologies if I’m not making sense.

1 Like