From 50f0a8343c2b252a3f3f8892297ef97c5af4133e Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 17 Sep 2024 00:57:02 +0900 Subject: [PATCH] internal/ui: bug fix: skipCount should be reset when the outside size changes Closes #3101 --- internal/ui/context.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/ui/context.go b/internal/ui/context.go index 17aea82a8..82e94c8f4 100644 --- a/internal/ui/context.go +++ b/internal/ui/context.go @@ -246,8 +246,13 @@ func (c *context) layoutGame(outsideWidth, outsideHeight float64, deviceScaleFac panic("ui: Layout must return positive numbers") } - c.screenWidth = outsideWidth * deviceScaleFactor - c.screenHeight = outsideHeight * deviceScaleFactor + screenWidth := outsideWidth * deviceScaleFactor + screenHeight := outsideHeight * deviceScaleFactor + if c.screenWidth != screenWidth || c.screenHeight != screenHeight { + c.skipCount = 0 + } + c.screenWidth = screenWidth + c.screenHeight = screenHeight c.offscreenWidth = owf c.offscreenHeight = ohf