uidriver/mobile: Bug fix: The context didn't recovered on gomobile-build

Updates #1176
This commit is contained in:
Hajime Hoshi 2020-08-19 23:59:23 +09:00
parent bb50887bae
commit 85d172c673

View File

@ -35,6 +35,7 @@ import (
"github.com/hajimehoshi/ebiten/internal/driver"
"github.com/hajimehoshi/ebiten/internal/graphicsdriver/opengl"
"github.com/hajimehoshi/ebiten/internal/hooks"
"github.com/hajimehoshi/ebiten/internal/restorable"
"github.com/hajimehoshi/ebiten/internal/thread"
)
@ -159,6 +160,7 @@ func (u *UserInterface) appMain(a app.App) {
switch e.Crosses(lifecycle.StageVisible) {
case lifecycle.CrossOn:
u.SetForeground(true)
restorable.OnContextLost()
glctx, _ = e.DrawContext.(gl.Context)
// Assume that glctx is always a same instance.
// Then, only once initializing should be enough.