Merge remote-tracking branch 'remotes/origin/temp77' into story77
# Conflicts: # racevisionGame/src/main/java/visualiser/Controllers/InGameLobbyController.java # racevisionGame/src/main/resources/visualiser/scenes/gameLobby.fxml # racevisionGame/src/main/resources/visualiser/scenes/hostgame.fxml
This commit is contained in:
@@ -3,19 +3,16 @@ package visualiser.app;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.application.Application;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.ReadOnlyObjectProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.Worker;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.geometry.Rectangle2D;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import javafx.scene.effect.DropShadow;
|
||||
import javafx.scene.image.Image;
|
||||
@@ -26,25 +23,22 @@ import javafx.scene.paint.Color;
|
||||
import javafx.stage.Screen;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.StageStyle;
|
||||
import javafx.stage.WindowEvent;
|
||||
import javafx.util.Duration;
|
||||
import visualiser.Controllers.MainController;
|
||||
import visualiser.gameController.Keys.KeyFactory;
|
||||
import mock.app.Event;
|
||||
|
||||
public class App extends Application {
|
||||
|
||||
private static Stage stage;
|
||||
public static Event game;
|
||||
public static Boolean dayMode = true;
|
||||
public static Integer gameType = 0;
|
||||
private Pane splashLayout;
|
||||
private ProgressBar loadProgress;
|
||||
private Label progressText;
|
||||
private static final int SPLASH_WIDTH = 676;
|
||||
private static final int SPLASH_HEIGHT = 227;
|
||||
public static KeyFactory keyFactory = new KeyFactory();
|
||||
public static App app;
|
||||
|
||||
/**
|
||||
* Entry point for running the programme
|
||||
*
|
||||
* @param args for starting the programme
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
@@ -53,9 +47,6 @@ public class App extends Application {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
// load the user's personalised key bindings
|
||||
keyFactory.load();
|
||||
|
||||
ImageView splash = new ImageView(new Image(
|
||||
getClass().getClassLoader().getResourceAsStream("images/splashScreen.png")
|
||||
));
|
||||
@@ -81,15 +72,15 @@ public class App extends Application {
|
||||
|
||||
/**
|
||||
* Method that sets up and displays the splash screen
|
||||
* @param initStage the inital stage
|
||||
* @param stage the initial stage
|
||||
* @throws Exception if something wrong with title screen.
|
||||
*/
|
||||
public void start(Stage initStage) throws Exception {
|
||||
public void start(Stage stage) throws Exception {
|
||||
final Task<ObservableList<String>> boatTask = new Task<ObservableList<String>>() {
|
||||
@Override
|
||||
protected ObservableList<String> call() throws InterruptedException {
|
||||
ObservableList<String> addedFilling =
|
||||
FXCollections.<String>observableArrayList();
|
||||
FXCollections.observableArrayList();
|
||||
ObservableList<String> burgerFilling =
|
||||
FXCollections.observableArrayList(
|
||||
"Buns", "Patties", "Lettuce", "Onions", "Tomato",
|
||||
@@ -107,69 +98,49 @@ public class App extends Application {
|
||||
}
|
||||
Thread.sleep(100);
|
||||
updateMessage("Burger's done!");
|
||||
|
||||
return addedFilling;
|
||||
}
|
||||
};
|
||||
|
||||
showSplash(
|
||||
initStage,
|
||||
stage,
|
||||
boatTask,
|
||||
() -> {
|
||||
try {
|
||||
showMainStage(new Stage());
|
||||
loadTitleScreen();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
);
|
||||
new Thread(boatTask).start();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get main stage
|
||||
* @return main stage
|
||||
* Get the main stage to be shared for all regular game play scenes.
|
||||
* @return shared stage
|
||||
*/
|
||||
public static Stage getStage() {
|
||||
return App.stage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set main stage
|
||||
* @param stage stage to set main stage
|
||||
* Loads the title screen for the first time on app start.
|
||||
* @throws Exception if there is a problem with a resource loaded
|
||||
*/
|
||||
public static void setStage(Stage stage) {
|
||||
App.stage = stage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the main stage after the splash screen
|
||||
* @param stage main stage for application
|
||||
* @throws Exception Throws an exception on error
|
||||
*/
|
||||
public void showMainStage(Stage stage) throws Exception {
|
||||
App.stage = stage;
|
||||
App.app = this;
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/visualiser/scenes/main.fxml"));
|
||||
private void loadTitleScreen() throws Exception {
|
||||
stage = new Stage();
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource
|
||||
("/visualiser/scenes/title.fxml"));
|
||||
Parent root = loader.load();
|
||||
stage.setResizable(false);
|
||||
MainController mc = (MainController) loader.getController();
|
||||
mc.enterTitle();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
stage.setScene(scene);
|
||||
stage.setTitle("RaceVision - Team 7");
|
||||
stage.setTitle("The Boat Game - Burgers & Boats");
|
||||
stage.getIcons().add(new Image(getClass().getClassLoader().getResourceAsStream("images/SailIcon.png")));
|
||||
mc.startCss();
|
||||
setStage(stage);
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
|
||||
@Override
|
||||
public void handle(WindowEvent event) {
|
||||
Platform.exit();
|
||||
System.exit(0);
|
||||
}
|
||||
stage.setOnCloseRequest(event -> {
|
||||
Platform.exit();
|
||||
System.exit(0);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package visualiser.app;
|
||||
|
||||
/**
|
||||
* Created by hba56 on 13/09/17.
|
||||
*/
|
||||
public class MatchBrowserSingleton {
|
||||
}
|
||||
Reference in New Issue
Block a user