mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-24 01:42:05 +01:00
examples/isometric: Recreate the offscreen when the screen size changes
This commit is contained in:
parent
0f363615b7
commit
3c8c17eace
@ -193,6 +193,14 @@ func (g *Game) renderLevel(screen *ebiten.Image) {
|
|||||||
// When zooming in, tiles can have slight bleeding edges.
|
// When zooming in, tiles can have slight bleeding edges.
|
||||||
// To avoid them, render the result on an offscreen first and then scale it later.
|
// To avoid them, render the result on an offscreen first and then scale it later.
|
||||||
if scaleLater {
|
if scaleLater {
|
||||||
|
if g.offscreen != nil {
|
||||||
|
w, h := g.offscreen.Size()
|
||||||
|
sw, sh := screen.Size()
|
||||||
|
if w != sw || h != sh {
|
||||||
|
g.offscreen.Dispose()
|
||||||
|
g.offscreen = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
if g.offscreen == nil {
|
if g.offscreen == nil {
|
||||||
g.offscreen = ebiten.NewImage(screen.Size())
|
g.offscreen = ebiten.NewImage(screen.Size())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user