mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
cmd/ebitenmobile: Use an explict way to detect context lost on Android
Fixes #1176
This commit is contained in:
parent
d48770cb1c
commit
71e65fa1b7
@ -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
19
internal/restorable/const_android.go
Normal file
19
internal/restorable/const_android.go
Normal 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
|
@ -12,6 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build !android
|
||||
// +build !js
|
||||
|
||||
package restorable
|
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user