mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
cmd/ebitenmobile: bug fix: graceful shutdown on context lost
Closes #3097
This commit is contained in:
parent
dc5869f607
commit
a3fa7df1f3
@ -29,13 +29,12 @@ import {{.JavaPkg}}.ebitenmobileview.RenderRequester;
|
||||
import {{.JavaPkg}}.{{.PrefixLower}}.EbitenView;
|
||||
|
||||
class EbitenSurfaceView extends GLSurfaceView implements RenderRequester {
|
||||
// As GLSurfaceView can be recreated, the states must be static (#3097).
|
||||
static private boolean errored_ = false;
|
||||
static private boolean onceSurfaceCreated_ = false;
|
||||
static private boolean contextLost_ = false;
|
||||
|
||||
private class EbitenRenderer implements GLSurfaceView.Renderer {
|
||||
|
||||
private boolean errored_ = false;
|
||||
private boolean onceSurfaceCreated_ = false;
|
||||
private boolean contextLost_ = false;
|
||||
|
||||
@Override
|
||||
public void onDrawFrame(GL10 gl) {
|
||||
if (errored_) {
|
||||
@ -100,7 +99,7 @@ class EbitenSurfaceView extends GLSurfaceView implements RenderRequester {
|
||||
}
|
||||
|
||||
private void onContextLost() {
|
||||
Log.v("Go", "Kill the application due to a context lost");
|
||||
Log.e("Go", "The application was killed due to context loss");
|
||||
// TODO: Relaunch this application for better UX (#805).
|
||||
Runtime.getRuntime().exit(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user