stop loading stuff when close is requested in splash state

This commit is contained in:
yugecin 2017-01-18 19:44:54 +01:00
parent 8d05a8893b
commit c4560ae9f1

View File

@ -37,6 +37,7 @@ import java.io.File;
import org.newdawn.slick.Color; import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics; import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input; import org.newdawn.slick.Input;
import org.newdawn.slick.util.Log;
import yugecin.opsudance.core.DisplayContainer; import yugecin.opsudance.core.DisplayContainer;
import yugecin.opsudance.core.inject.InstanceContainer; import yugecin.opsudance.core.inject.InstanceContainer;
import yugecin.opsudance.core.state.BaseOpsuState; import yugecin.opsudance.core.state.BaseOpsuState;
@ -182,6 +183,19 @@ public class Splash extends BaseOpsuState {
} }
} }
@Override
public boolean onCloseRequest() {
if (thread != null && thread.isAlive()) {
thread.interrupt();
try {
thread.join();
} catch (InterruptedException e) {
Log.warn("InterruptedException while waiting for splash thread to die", e);
}
}
return true;
}
@Override @Override
public boolean keyPressed(int key, char c) { public boolean keyPressed(int key, char c) {
if (key != Input.KEY_ESCAPE) { if (key != Input.KEY_ESCAPE) {