From 17ccce9e6a4528e23e4ce7f0f2dc4d0915813cca Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 1 Jan 2021 17:40:44 -0500 Subject: [PATCH] v0.9.1b: added some logic to improve (measured) loading times on Android --- .../src/main/java/com/watabou/noosa/Game.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/SPD-classes/src/main/java/com/watabou/noosa/Game.java b/SPD-classes/src/main/java/com/watabou/noosa/Game.java index 9a0f1fb97..b95ecab7d 100644 --- a/SPD-classes/src/main/java/com/watabou/noosa/Game.java +++ b/SPD-classes/src/main/java/com/watabou/noosa/Game.java @@ -85,12 +85,11 @@ public class Game implements ApplicationListener { instance = this; this.platform = platform; } - - private boolean paused; - - public boolean isPaused(){ - return paused; - } + + //FIXME this is a temporary workaround to improve start times on android (first frame is 'cheated' and only renders a black screen) + //this is partly to improve stats on google play, and partly to try and diagnose what the cause of slow loading times is + //ultimately once the cause is found it should be fixed and this should no longer be needed + private boolean justResumed = false; @Override public void create() { @@ -147,6 +146,12 @@ public class Game implements ApplicationListener { return; } + if (justResumed){ + Gdx.gl.glClear(Gdx.gl.GL_COLOR_BUFFER_BIT); + justResumed = false; + return; + } + NoosaScript.get().resetCamera(); NoosaScriptNoLighting.get().resetCamera(); Gdx.gl.glDisable(Gdx.gl.GL_SCISSOR_TEST); @@ -160,8 +165,6 @@ public class Game implements ApplicationListener { @Override public void pause() { - paused = true; - PointerEvent.clearPointerEvents(); if (scene != null) { @@ -173,7 +176,7 @@ public class Game implements ApplicationListener { @Override public void resume() { - paused = false; + justResumed = true; } public void finish(){