mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
examples/contextlost: Skip Draw when the context lost happens
Updates #1314
This commit is contained in:
parent
7329880f40
commit
6718cd32a6
@ -102,6 +102,13 @@ func (g *Game) Update(screen *ebiten.Image) error {
|
||||
}
|
||||
|
||||
func (g *Game) Draw(screen *ebiten.Image) {
|
||||
if g.lost {
|
||||
// When the context is lost, skip rendering. Usually this logic should not be required, but when the
|
||||
// context lost happens by the API explicitly, Draw can be called even after the data in GPU is
|
||||
// disappered.
|
||||
return
|
||||
}
|
||||
|
||||
w, h := gophersImage.Size()
|
||||
op := &ebiten.DrawImageOptions{}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user