Lar libgdx ta seg av avslutting av spillet

This commit is contained in:
Kristian Knarvik 2020-04-07 23:26:17 +02:00
parent 24b8f4812b
commit 81e43c65a7

View File

@ -47,12 +47,13 @@ public class StartMenuScreen extends AbstractScreen {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
try {
roboRallyWrapper.server = new RoboRallyServer();
roboRallyWrapper.client = new RoboRallyClient("127.0.0.1",roboRallyWrapper);
roboRallyWrapper.client = new RoboRallyClient("127.0.0.1", roboRallyWrapper);
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getUsernameScreen(roboRallyWrapper));
} catch (IOException e) {
e.printStackTrace();
//Hard fail
System.exit(1);
Gdx.app.error("Server error", "Server could not be started");
Gdx.app.exit();
}
return true;
}
@ -80,7 +81,7 @@ public class StartMenuScreen extends AbstractScreen {
quitButton.addListener(new InputListener() {
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
System.exit(0);
Gdx.app.exit();
return true;
}
});