ebiten: Bug fix: Ignore the outside size when they are 0 at Layout

Closes #1589
This commit is contained in:
Hajime Hoshi 2021-04-18 23:02:29 +09:00
parent fd80583dd0
commit 5cc8d8476b

View File

@ -56,6 +56,11 @@ func (c *uiContext) setError(err error) {
} }
func (c *uiContext) Layout(outsideWidth, outsideHeight float64) { func (c *uiContext) Layout(outsideWidth, outsideHeight float64) {
// The given outside size can be 0 e.g. just after restoring from the fullscreen mode on Windows (#1589)
// Just ignore such cases. Otherwise, creating a zero-sized framebuffer causes a panic.
if outsideWidth == 0 || outsideHeight == 0 {
return
}
c.outsideSizeUpdated = true c.outsideSizeUpdated = true
c.outsideWidth = outsideWidth c.outsideWidth = outsideWidth
c.outsideHeight = outsideHeight c.outsideHeight = outsideHeight