cmd/ebitenmobile: Use an explict way to detect context lost on Android

Fixes #1176
This commit is contained in:
Hajime Hoshi 2020-08-15 01:37:51 +09:00
parent d48770cb1c
commit 71e65fa1b7
6 changed files with 27 additions and 2 deletions

View File

@ -751,6 +751,7 @@ class EbitenSurfaceView extends GLSurfaceView {
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
Ebitenmobileview.onContextLost();
}
@Override

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
// Copyright 2020 The Ebiten Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package restorable
const needsDisposingWhenRestoring = true
const canDetectContextLostExplicitly = true

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// +build !android
// +build !js
package restorable

View File

@ -30,6 +30,7 @@ import (
"sync"
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/internal/restorable"
"github.com/hajimehoshi/ebiten/internal/uidriver/mobile"
)
@ -89,3 +90,7 @@ func Suspend() {
func Resume() {
mobile.Get().SetForeground(true)
}
func OnContextLost() {
restorable.OnContextLost()
}