mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
examples/windowsize: Bug fix: screenScale can be 0 on browsers
This commit is contained in:
parent
812a29bf07
commit
4aa80de34d
@ -115,7 +115,12 @@ func (g *game) Update(screen *ebiten.Image) error {
|
|||||||
screenWidth = g.width
|
screenWidth = g.width
|
||||||
screenHeight = g.height
|
screenHeight = g.height
|
||||||
ww, _ := ebiten.WindowSize()
|
ww, _ := ebiten.WindowSize()
|
||||||
screenScale = float64(ww) / float64(g.width)
|
if ww > 0 {
|
||||||
|
screenScale = float64(ww) / float64(g.width)
|
||||||
|
} else {
|
||||||
|
// ebiten.WindowSize can return (0, 0) on browsers or mobiles.
|
||||||
|
screenScale = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fullscreen := ebiten.IsFullscreen()
|
fullscreen := ebiten.IsFullscreen()
|
||||||
|
Loading…
Reference in New Issue
Block a user