cmd/ebitenmobile: call setPreserveEGLContextOnPause(true) whatever the option is

We found that an app freezes for a little while when resuming it.
In order to improve user experience, always use
setPreserveEGLContextOnPause(true) whichever StrictContextRestoration is
true or false.
This commit is contained in:
Hajime Hoshi
2024-09-09 15:20:04 +09:00
parent 6a51e5b003
commit fcef0a7c29
2 changed files with 9 additions and 6 deletions
@@ -96,6 +96,7 @@ class EbitenSurfaceView extends GLSurfaceView implements Renderer {
private void initialize() {
setEGLContextClientVersion(3);
setEGLConfigChooser(8, 8, 8, 8, 0, 0);
setPreserveEGLContextOnPause(true);
// setRenderer must be called before setRenderRequester.
// Or, the application crashes.
setRenderer(new EbitenRenderer());
@@ -125,7 +126,6 @@ class EbitenSurfaceView extends GLSurfaceView implements Renderer {
@Override
public synchronized void setStrictContextRestoration(boolean strictContextRestoration) {
strictContextRestoration_ = strictContextRestoration;
setPreserveEGLContextOnPause(!strictContextRestoration);
}
private synchronized boolean hasStrictContextRestoration() {