v0.7.4b: fixed errors with android lifecycle management

This commit is contained in:
Evan Debenham 2019-08-06 21:01:16 -04:00
parent 214bba922f
commit 019970b3e4

View File

@ -29,6 +29,8 @@ import com.watabou.glwrap.Blending;
import com.watabou.glwrap.Vertexbuffer; import com.watabou.glwrap.Vertexbuffer;
import com.watabou.input.InputHandler; import com.watabou.input.InputHandler;
import com.watabou.input.KeyEvent; import com.watabou.input.KeyEvent;
import com.watabou.noosa.audio.Music;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PlatformSupport; import com.watabou.utils.PlatformSupport;
import com.watabou.utils.SystemTime; import com.watabou.utils.SystemTime;
@ -84,17 +86,6 @@ public class Game implements ApplicationListener {
this.platform = platform; this.platform = platform;
} }
/*@Override
protected void onCreate( Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
//FIXME shouldn't have a reference to the view here, remove things which access this
view = (GLSurfaceView)graphics.getView();
//so first call to onstart/onresume calls correct logic.
//paused = true;
}*/
private boolean paused; private boolean paused;
public boolean isPaused(){ public boolean isPaused(){
@ -159,11 +150,7 @@ public class Game implements ApplicationListener {
scene.onPause(); scene.onPause();
} }
//view.onPause();
Script.reset(); Script.reset();
//Music.INSTANCE.pause();
//Sample.INSTANCE.pause();
} }
@Override @Override
@ -171,10 +158,6 @@ public class Game implements ApplicationListener {
paused = false; paused = false;
now = 0; now = 0;
//view.onResume();
//Music.INSTANCE.resume();
//Sample.INSTANCE.resume();
} }
public void finish(){ public void finish(){
@ -183,19 +166,14 @@ public class Game implements ApplicationListener {
@Override @Override
public void dispose() { public void dispose() {
destroyGame();
//Music.INSTANCE.mute();
//Sample.INSTANCE.reset();
}
protected void destroyGame() {
if (scene != null) { if (scene != null) {
scene.destroy(); scene.destroy();
scene = null; scene = null;
} }
//instance = null; sceneClass = null;
Music.INSTANCE.stop();
Sample.INSTANCE.reset();
} }
public static void resetScene() { public static void resetScene() {