mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
cmd/ebitenmobile: bug fix: graceful shutdown on context lost
Closes #3097
This commit is contained in:
parent
4b1ae72f59
commit
c077ad70fd
@ -29,13 +29,12 @@ import {{.JavaPkg}}.ebitenmobileview.Renderer;
|
|||||||
import {{.JavaPkg}}.{{.PrefixLower}}.EbitenView;
|
import {{.JavaPkg}}.{{.PrefixLower}}.EbitenView;
|
||||||
|
|
||||||
class EbitenSurfaceView extends GLSurfaceView implements Renderer {
|
class EbitenSurfaceView extends GLSurfaceView implements Renderer {
|
||||||
|
// 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 class EbitenRenderer implements GLSurfaceView.Renderer {
|
||||||
|
|
||||||
private boolean errored_ = false;
|
|
||||||
private boolean onceSurfaceCreated_ = false;
|
|
||||||
private boolean contextLost_ = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDrawFrame(GL10 gl) {
|
public void onDrawFrame(GL10 gl) {
|
||||||
if (errored_) {
|
if (errored_) {
|
||||||
@ -107,7 +106,7 @@ class EbitenSurfaceView extends GLSurfaceView implements Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onContextLost() {
|
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).
|
// TODO: Relaunch this application for better UX (#805).
|
||||||
Runtime.getRuntime().exit(0);
|
Runtime.getRuntime().exit(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user