Merged in development.

main
David Wu 9 years ago
parent 288979be3b
commit 9f813ab7aa

@ -144,7 +144,7 @@ public class RaceController extends Controller {
if (result.get() == ButtonType.OK) { if (result.get() == ButtonType.OK) {
parent.endEvent(); parent.endEvent();
race.setVisible(false); race.setVisible(false);
App.app.loadStart(App.getStage()); App.app.showMainStage(App.getStage());
} }
} else { } else {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
@ -153,11 +153,13 @@ public class RaceController extends Controller {
Optional<ButtonType> result = alert.showAndWait(); Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) { if (result.get() == ButtonType.OK) {
race.setVisible(false); race.setVisible(false);
App.app.loadStart(App.getStage()); App.app.showMainStage(App.getStage());
} }
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} }
} }
}); });
@ -469,9 +471,11 @@ public class RaceController extends Controller {
race.setVisible(false); race.setVisible(false);
//parent.enterTitle(); //parent.enterTitle();
try { try {
App.app.loadStart(App.getStage()); App.app.showMainStage(App.getStage());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} }
//TODO currently this doesn't work correctly - the title screen remains visible after clicking join game //TODO currently this doesn't work correctly - the title screen remains visible after clicking join game
//TODO we should display an error to the user //TODO we should display an error to the user

@ -116,7 +116,7 @@ public class App extends Application {
boatTask, boatTask,
() -> { () -> {
try { try {
showMainStage(); showMainStage(new Stage());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -146,8 +146,9 @@ public class App extends Application {
* Show the main stage after the splash screen * Show the main stage after the splash screen
* @throws Exception * @throws Exception
*/ */
private void showMainStage() throws Exception { public void showMainStage(Stage stage) throws Exception {
stage = new Stage(StageStyle.DECORATED); App.stage = stage;
App.app = this;
FXMLLoader loader = new FXMLLoader(getClass().getResource("/visualiser/scenes/main.fxml")); FXMLLoader loader = new FXMLLoader(getClass().getResource("/visualiser/scenes/main.fxml"));
Parent root = loader.load(); Parent root = loader.load();
stage.setResizable(false); stage.setResizable(false);

Loading…
Cancel
Save