v0.8.0: tweaked lifecycle managment, actor thread is now allowed to end

This commit is contained in:
Evan Debenham
2019-10-28 23:34:56 -04:00
parent df3a0a010b
commit f038bde5cc
4 changed files with 25 additions and 4 deletions

View File

@@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.WelcomeScene;
import com.watabou.noosa.Game;
@@ -224,7 +225,13 @@ public class ShatteredPixelDungeon extends Game {
updateDisplaySize();
}
@Override
public void destroy(){
super.destroy();
GameScene.endActorThread();
}
public void updateDisplaySize(){
platform.updateDisplaySize();
}

View File

@@ -204,6 +204,8 @@ public abstract class Actor implements Bundlable {
return current != null;
}
public static boolean keepActorThreadAlive = true;
public static void process() {
boolean doNext;
@@ -284,7 +286,7 @@ public abstract class Actor implements Bundlable {
}
}
} while (true);
} while (keepActorThreadAlive);
}
public static void add( Actor actor ) {

View File

@@ -505,6 +505,13 @@ public class GameScene extends PixelScene {
super.destroy();
}
public static void endActorThread(){
if (actorThread.isAlive()){
Actor.keepActorThreadAlive = false;
actorThread.interrupt();
}
}
@Override
public synchronized void onPause() {
try {