Adding back lost changes and finishing splitting last controllers.

- renamed fxml and their controllers to match
- removed old controllers
- finished lobby and lobbyhost controllers

#story[1261]
main
Jessica Syder 8 years ago
parent a5d3434a70
commit a5050b8ea8

@ -2,14 +2,14 @@ package mock.app;
import mock.dataInput.PolarParser; import mock.dataInput.PolarParser;
import mock.exceptions.EventConstructionException; import mock.exceptions.EventConstructionException;
import mock.model.*; import mock.model.MockRace;
import mock.model.Polars;
import mock.model.RaceLogic;
import mock.model.SourceIdAllocator;
import mock.model.commandFactory.CompositeCommand; import mock.model.commandFactory.CompositeCommand;
import mock.model.wind.RandomWindGenerator;
import mock.model.wind.ShiftingWindGenerator; import mock.model.wind.ShiftingWindGenerator;
import mock.model.wind.WindGenerator; import mock.model.wind.WindGenerator;
import mock.xml.RaceXMLCreator;
import network.Messages.LatestMessages; import network.Messages.LatestMessages;
import org.xml.sax.SAXException;
import shared.dataInput.*; import shared.dataInput.*;
import shared.enums.XMLFileType; import shared.enums.XMLFileType;
import shared.exceptions.InvalidBoatDataException; import shared.exceptions.InvalidBoatDataException;
@ -19,17 +19,10 @@ import shared.exceptions.XMLReaderException;
import shared.model.Bearing; import shared.model.Bearing;
import shared.model.Constants; import shared.model.Constants;
import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**

@ -3,7 +3,7 @@ package shared.model;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty; import javafx.beans.property.StringProperty;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import visualiser.Controllers2.StartController; import visualiser.Controllers.RaceStartController;
import visualiser.model.ResizableRaceCanvas; import visualiser.model.ResizableRaceCanvas;
import java.time.Duration; import java.time.Duration;
@ -16,8 +16,8 @@ import java.util.Date;
* This class is used to implement a clock which keeps track of and * This class is used to implement a clock which keeps track of and
* displays times relevant to a race. This is displayed on the * displays times relevant to a race. This is displayed on the
* {@link ResizableRaceCanvas} via the * {@link ResizableRaceCanvas} via the
* {@link visualiser.Controllers.RaceController} and the * {@link visualiser.Controllers.RaceViewController} and the
* {@link StartController}. * {@link RaceStartController}.
*/ */
public class RaceClock { public class RaceClock {

@ -1,4 +1,4 @@
package visualiser.Controllers2; package visualiser.Controllers;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.property.Property; import javafx.beans.property.Property;

@ -5,43 +5,24 @@ import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import mock.app.Event;
import org.xml.sax.SAXException;
import shared.exceptions.InvalidBoatDataException;
import shared.exceptions.InvalidRaceDataException;
import shared.exceptions.InvalidRegattaDataException;
import shared.exceptions.XMLReaderException;
import visualiser.model.RaceConnection; import visualiser.model.RaceConnection;
import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.soap.Text;
import java.io.IOException; import java.io.IOException;
import java.net.Socket; import java.net.Socket;
import java.net.URL; import java.net.URL;
import java.net.UnknownHostException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
//TODO it appears this view/controller was replaced by Lobby.fxml. Remove? //TODO it appears this view/controller was replaced by Lobby.fxml. Remove?
/** /**
* Controls the connection that the VIsualiser can connect to. * Controls the connection that the VIsualiser can connect to.
*/ */
public class ConnectionController extends Controller { public class ConnectionController extends Controller2 {
@FXML @FXML AnchorPane connectionWrapper;
private AnchorPane connectionWrapper; @FXML TableView<RaceConnection> connectionTable;
@FXML @FXML TableColumn<RaceConnection, String> hostnameColumn;
private TableView<RaceConnection> connectionTable; @FXML TableColumn<RaceConnection, String> statusColumn;
@FXML @FXML Button connectButton;
private TableColumn<RaceConnection, String> hostnameColumn; @FXML TextField urlField;
@FXML @FXML TextField portField;
private TableColumn<RaceConnection, String> statusColumn;
@FXML
private Button connectButton;
@FXML
private TextField urlField;
@FXML
private TextField portField;
/*Title Screen fxml items*/ /*Title Screen fxml items*/
@ -87,7 +68,6 @@ public class ConnectionController extends Controller {
@Override
public void initialize(URL location, ResourceBundle resources) { public void initialize(URL location, ResourceBundle resources) {
// TODO - replace with config file // TODO - replace with config file
connections = FXCollections.observableArrayList(); connections = FXCollections.observableArrayList();
@ -143,5 +123,4 @@ public class ConnectionController extends Controller {
} }
} }
} }

@ -1,32 +0,0 @@
package visualiser.Controllers;
import javafx.fxml.Initializable;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Controller parent for app controllers.
* Created by fwy13 on 15/03/2017.
*/
public abstract class Controller implements Initializable {
protected MainController parent;
/**
* Sets the parent of the application
*
* @param parent controller
*/
public void setParent(MainController parent) {
this.parent = parent;
}
/**
* Initialisation class that is run on start up.
*
* @param location resources location
* @param resources resources bundle
*/
@Override
public abstract void initialize(URL location, ResourceBundle resources);
}

@ -1,4 +1,4 @@
package visualiser.Controllers2; package visualiser.Controllers;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;
@ -7,13 +7,25 @@ import javafx.scene.image.Image;
import javafx.stage.Modality; import javafx.stage.Modality;
import javafx.stage.Stage; import javafx.stage.Stage;
import visualiser.app.App; import visualiser.app.App;
import java.io.IOException; import java.io.IOException;
/** /**
* Abstract controller class to give each subclass the functionality to load * Abstract controller class to give each subclass the functionality to load
* a new scene into the existing stage, or create a new popup window. * a new scene into the existing stage, or create a new popup window.
*/ */
public class Controller2 { public abstract class Controller2 {
Stage stage = App.getStage();
protected void loadTitleScreen() throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/visualiser/scenes/title.fxml"));
Parent root = loader.load();
stage.setResizable(false);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
/** /**
* Used to load a new scene in the currently open stage. * Used to load a new scene in the currently open stage.
@ -34,12 +46,13 @@ public class Controller2 {
Double stageWidth = stage.getWidth(); Double stageWidth = stage.getWidth();
// set new scene into existing window // set new scene into existing window
Scene scene = new Scene(root); Scene scene = new Scene(root, stageWidth, stageHeight);
stage.setScene(scene); stage.setScene(scene);
stage.setResizable(true); stage.setResizable(true);
stage.show(); stage.show();
stage.setHeight(stageHeight); stage.setHeight(stageHeight);
stage.setWidth(stageWidth); stage.setWidth(stageWidth);
stage.sizeToScene();
// return controller for the loaded fxml scene // return controller for the loaded fxml scene
return loader.getController(); return loader.getController();

@ -1,4 +1,4 @@
package visualiser.Controllers2; package visualiser.Controllers;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.event.EventHandler; import javafx.event.EventHandler;

@ -7,9 +7,6 @@ import javafx.scene.control.Button;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import visualiser.Controllers2.Controller2;
import visualiser.Controllers2.StartController;
import visualiser.model.RaceConnection; import visualiser.model.RaceConnection;
import java.io.IOException; import java.io.IOException;
@ -19,34 +16,21 @@ import java.net.Socket;
* Controller for the Lobby for entering games * Controller for the Lobby for entering games
*/ */
public class LobbyController extends Controller2 { public class LobbyController extends Controller2 {
private @FXML TableView<RaceConnection> lobbyTable;
@FXML private @FXML TableColumn<RaceConnection, String> gameNameColumn;
private AnchorPane lobbyWrapper; private @FXML TableColumn<RaceConnection, String> hostNameColumn;
@FXML private @FXML TableColumn<RaceConnection, String> statusColumn;
private TableView<RaceConnection> lobbyTable; private @FXML Button joinGameBtn;
@FXML private @FXML TextField addressFld;
private TableColumn<RaceConnection, String> gameNameColumn; private @FXML TextField portFld;
@FXML
private TableColumn<RaceConnection, String> hostNameColumn;
@FXML
private TableColumn<RaceConnection, String> statusColumn;
@FXML
private Button joinGameBtn;
@FXML
private TextField addressFld;
@FXML
private TextField portFld;
private ObservableList<RaceConnection> connections; private ObservableList<RaceConnection> connections;
// @Override
public void initialize() { public void initialize() {
// set up the connection table
connections = FXCollections.observableArrayList(); connections = FXCollections.observableArrayList();
//connections.add(new RaceConnection("localhost", 4942, "Local Game")); //connections.add(new RaceConnection("localhost", 4942, "Local Game"));
lobbyTable.setItems(connections); lobbyTable.setItems(connections);
gameNameColumn.setCellValueFactory(cellData -> cellData.getValue().gamenameProperty()); gameNameColumn.setCellValueFactory(cellData -> cellData.getValue().gamenameProperty());
hostNameColumn.setCellValueFactory(cellData -> cellData.getValue().hostnameProperty()); hostNameColumn.setCellValueFactory(cellData -> cellData.getValue().hostnameProperty());
statusColumn.setCellValueFactory(cellData -> cellData.getValue().statusProperty()); statusColumn.setCellValueFactory(cellData -> cellData.getValue().statusProperty());
@ -54,8 +38,7 @@ public class LobbyController extends Controller2 {
lobbyTable.getSelectionModel().selectedItemProperty().addListener((obs, prev, curr) -> { lobbyTable.getSelectionModel().selectedItemProperty().addListener((obs, prev, curr) -> {
if (curr != null && curr.statusProperty().getValue().equals("Ready")) { if (curr != null && curr.statusProperty().getValue().equals("Ready")) {
joinGameBtn.setDisable(false); joinGameBtn.setDisable(false);
} } else {
else {
joinGameBtn.setDisable(true); joinGameBtn.setDisable(true);
} }
}); });
@ -81,23 +64,15 @@ public class LobbyController extends Controller2 {
/** /**
* Connect to a connection. * Connect to a connection.
*/ */
public void connectSocket() { public void connectSocket() throws IOException {
try{ RaceConnection connection = lobbyTable.getSelectionModel().getSelectedItem();
RaceConnection connection = lobbyTable.getSelectionModel().getSelectedItem(); Socket socket = new Socket(connection.getHostname(), connection.getPort());
Socket socket = new Socket(connection.getHostname(), connection.getPort()); RaceStartController rsc = (RaceStartController)loadScene("raceStart.fxml");
lobbyWrapper.setVisible(false); rsc.enterLobby(socket, false);
// parent.enterLobby(socket, false);
StartController sc = (StartController)loadScene(
"/visualiser/scenes/start.fxml");
sc.enterLobby(socket, false);
} catch (IOException e) { /* Never reached */
e.printStackTrace();
}
} }
public void menuBtnPressed() throws IOException { public void menuBtnPressed() throws IOException {
// parent.enterTitle(); loadScene("title.fxml");
loadScene("titleScreen.fxml");
} }
/** /**
@ -106,24 +81,14 @@ public class LobbyController extends Controller2 {
public void addConnectionPressed(){ public void addConnectionPressed(){
String hostName = addressFld.getText(); String hostName = addressFld.getText();
String portString = portFld.getText(); String portString = portFld.getText();
try{ try {
int port = Integer.parseInt(portString); int port = Integer.parseInt(portString);
connections.add(new RaceConnection(hostName, port, "Boat Game")); connections.add(new RaceConnection(hostName, port, "Boat Game"));
addressFld.clear(); addressFld.clear();
portFld.clear(); portFld.clear();
}catch(NumberFormatException e){ } catch (NumberFormatException e) {
System.err.println("Port number entered is not a number"); System.err.println("Port number entered is not a number");
} }
} }
public AnchorPane startWrapper(){ }
return lobbyWrapper;
}
/**
* Enter the lobby page.
*/
public void enterLobby(){
lobbyWrapper.setVisible(true);
}
}

@ -2,14 +2,9 @@ package visualiser.Controllers;
import com.interactivemesh.jfx.importer.stl.StlMeshImporter; import com.interactivemesh.jfx.importer.stl.StlMeshImporter;
import javafx.animation.AnimationTimer; import javafx.animation.AnimationTimer;
import javafx.application.Platform;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType; import javafx.scene.control.ButtonType;
import javafx.scene.control.SplitPane; import javafx.scene.control.SplitPane;
@ -17,12 +12,8 @@ import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane; import javafx.scene.layout.GridPane;
import javafx.scene.shape.MeshView; import javafx.scene.shape.MeshView;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import mock.app.Event; import mock.app.Event;
import mock.exceptions.EventConstructionException; import mock.exceptions.EventConstructionException;
import visualiser.Controllers2.Controller2;
import visualiser.Controllers2.StartController;
import visualiser.app.App; import visualiser.app.App;
import visualiser.layout.Subject3D; import visualiser.layout.Subject3D;
import visualiser.layout.View3D; import visualiser.layout.View3D;
@ -37,13 +28,12 @@ import java.util.logging.Logger;
/** /**
* Controller for Hosting a game. * Controller for Hosting a game.
*/ */
public class HostController extends Controller2 { public class LobbyHostingController extends Controller2 {
private @FXML ImageView imageView; private @FXML ImageView imageView;
private @FXML AnchorPane imagePane; private @FXML AnchorPane imagePane;
private @FXML SplitPane splitPane; private @FXML SplitPane splitPane;
private @FXML AnchorPane specPane; private @FXML AnchorPane specPane;
private @FXML GridPane playerContainer; private @FXML GridPane playerContainer;
private Event game;
private View3D view3D; private View3D view3D;
public void initialize() { public void initialize() {
@ -54,7 +44,7 @@ public class HostController extends Controller2 {
view3D.setItems(subjects); view3D.setItems(subjects);
playerContainer.add(view3D, 0,0); playerContainer.add(view3D, 0,0);
URL asset = HostController.class.getClassLoader().getResource("assets/V1.2 Complete Boat.stl"); URL asset = LobbyHostingController.class.getClassLoader().getResource("assets/V1.2 Complete Boat.stl");
StlMeshImporter importer = new StlMeshImporter(); StlMeshImporter importer = new StlMeshImporter();
importer.read(asset); importer.read(asset);
@ -81,30 +71,25 @@ public class HostController extends Controller2 {
*/ */
public void hostGamePressed() { public void hostGamePressed() {
try { try {
this.game = new Event(false); App.game = new Event(false);
connectSocket("localhost", 4942); connectSocket("localhost", 4942);
} catch (EventConstructionException e) { } catch (EventConstructionException e) {
Logger.getGlobal().log(Level.SEVERE, "Could not create Event.", e); Logger.getGlobal().log(Level.SEVERE, "Could not create Event.", e);
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (IOException e) {
e.printStackTrace();
} }
} }
public void endEvent() throws IOException {
game.endEvent();
}
/** /**
* Connect to a socket * Connect to a socket
* @param address address of the server * @param address address of the server
* @param port port that the server is run off * @param port port that the server is run off
*/ */
public void connectSocket(String address, int port) { public void connectSocket(String address, int port) throws IOException {
try{ Socket socket = new Socket(address, port);
Socket socket = new Socket(address, port); RaceStartController rsc = (RaceStartController)loadScene("raceStart.fxml");
StartController sc = (StartController)loadScene rsc.enterLobby(socket, true);
("start.fxml");
sc.enterLobby(socket, true);
} catch (IOException e) { /* Never reached */ }
} }
/** /**
@ -115,34 +100,21 @@ public class HostController extends Controller2 {
splitPane.lookupAll(".split-pane-divider").stream().forEach(div -> div.setMouseTransparent(true)); splitPane.lookupAll(".split-pane-divider").stream().forEach(div -> div.setMouseTransparent(true));
imageView.fitWidthProperty().bind(imagePane.widthProperty()); imageView.fitWidthProperty().bind(imagePane.widthProperty());
imageView.fitHeightProperty().bind(imagePane.heightProperty()); imageView.fitHeightProperty().bind(imagePane.heightProperty());
// hostWrapper.setVisible(true); tick
} }
/** /**
* Menu button pressed. Prompt alert then return to menu * Menu button pressed. Prompt alert then return to menu
*/ */
public void menuBtnPressed() throws IOException { public void menuBtnPressed() throws Exception {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Quitting race"); alert.setTitle("Quitting race");
alert.setContentText("Do you wish to quit the race?"); alert.setContentText("Do you wish to quit the race?");
alert.setHeaderText("You are about to quit the race"); alert.setHeaderText("You are about to quit the race");
Optional<ButtonType> result = alert.showAndWait(); Optional<ButtonType> result = alert.showAndWait();
if(result.get() == ButtonType.OK){ if(result.get() == ButtonType.OK){
// hostWrapper.setVisible(false); // getStage().close();
Stage stage = App.getStage(); // App.app.loadTitleScreen();
FXMLLoader loader = new FXMLLoader(getClass().getResource("/visualiser/scenes/main.fxml")); loadTitleScreen();
Parent root = loader.load();
stage.setResizable(false);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override public void handle(WindowEvent event) {
Platform.exit();
System.exit(0);
}
});
// parent.enterTitle(); tick
} }
} }

@ -1,135 +0,0 @@
package visualiser.Controllers;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.layout.AnchorPane;
import visualiser.Controllers2.FinishController;
import visualiser.Controllers2.StartController;
import visualiser.Controllers2.TitleController;
import visualiser.gameController.ControllerClient;
import visualiser.model.VisualiserBoat;
import visualiser.model.VisualiserRaceEvent;
import java.io.IOException;
import java.net.Socket;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Controller that everything is overlayed onto. This makes it so that changing scenes does not resize your stage.
*/
public class MainController extends Controller {
@FXML private StartController startController;
@FXML private RaceController raceController;
@FXML private ConnectionController connectionController;
@FXML private FinishController finishController;
@FXML private TitleController titleController;
@FXML private HostController hostController;
@FXML private LobbyController lobbyController;
/**
* Ctor.
*/
public MainController() {
}
/**
* Transitions from the StartController screen (displays pre-race information) to the RaceController (displays the actual race).
* @param visualiserRace The object modelling the race.
* @param controllerClient Socket Client that manipulates the controller.
* @param isHost if the client is the host of a race or not.
*/
public void beginRace(VisualiserRaceEvent visualiserRace, ControllerClient controllerClient, Boolean isHost) {
raceController.startRace(visualiserRace, controllerClient, isHost);
}
public void endEvent() throws IOException { hostController.endEvent(); }
/**
* Transitions from the server selection screen to the pre-race lobby for a given server.
* @param socket The server to read data from.
* @param isHost is connection a host
*/
public void enterLobby(Socket socket, Boolean isHost) {
startController.enterLobby(socket, isHost);
}
/**
* Transitions from the {@link RaceController} screen to the {@link FinishController} screen.
* @param boats The boats to display on the finish screen.
*/
public void enterFinish(ObservableList<VisualiserBoat> boats) {
finishController.loadFinish(boats);
}
// /**
// * Transitions into the title screen
// */
// public void enterTitle() {
// titleController.enterTitle();
// }
/**
* Transitions into lobby screen
*/
public void enterLobby(){ lobbyController.enterLobby(); }
/**
* Transitions into host game screen
*/
public void hostGame(){ hostController.hostGame(); }
/**
* Sets up the css for the start of the program
*/
public void startCss(){titleController.setDayMode();}
/**
* Main Controller for the applications will house the menu and the displayed pane.
*
* @param location of resources
* @param resources bundle
*/
@Override
public void initialize(URL location, ResourceBundle resources) {
// startController.setParent(this);
// raceController.setParent(this);
// connectionController.setParent(this);
// finishController.setParent(this);
// titleController.setParent(this);
// hostController.setParent(this);
// lobbyController.setParent(this);
// AnchorPane.setTopAnchor(startController.startWrapper(), 0.0);
// AnchorPane.setBottomAnchor(startController.startWrapper(), 0.0);
// AnchorPane.setLeftAnchor(startController.startWrapper(), 0.0);
// AnchorPane.setRightAnchor(startController.startWrapper(), 0.0);
AnchorPane.setTopAnchor(lobbyController.startWrapper(), 0.0);
AnchorPane.setBottomAnchor(lobbyController.startWrapper(), 0.0);
AnchorPane.setLeftAnchor(lobbyController.startWrapper(), 0.0);
AnchorPane.setRightAnchor(lobbyController.startWrapper(), 0.0);
// AnchorPane.setTopAnchor(hostController.startWrapper(), 0.0);
// AnchorPane.setBottomAnchor(hostController.startWrapper(), 0.0);
// AnchorPane.setLeftAnchor(hostController.startWrapper(), 0.0);
// AnchorPane.setRightAnchor(hostController.startWrapper(), 0.0);
// AnchorPane.setTopAnchor(finishController.finishWrapper, 0.0);
// AnchorPane.setBottomAnchor(finishController.finishWrapper, 0.0);
// AnchorPane.setLeftAnchor(finishController.finishWrapper, 0.0);
// AnchorPane.setRightAnchor(finishController.finishWrapper, 0.0);
// AnchorPane.setTopAnchor(titleController.titleWrapper, 0.0);
// AnchorPane.setBottomAnchor(titleController.titleWrapper, 0.0);
// AnchorPane.setLeftAnchor(titleController.titleWrapper, 0.0);
// AnchorPane.setRightAnchor(titleController.titleWrapper, 0.0);
}
}

@ -1,4 +1,4 @@
package visualiser.Controllers2; package visualiser.Controllers;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Label; import javafx.scene.control.Label;

@ -1,4 +1,4 @@
package visualiser.Controllers2; package visualiser.Controllers;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
@ -10,7 +10,7 @@ import visualiser.model.VisualiserBoat;
/** /**
* Finish Screen for when the race finishes. * Finish Screen for when the race finishes.
*/ */
public class FinishController extends Controller2 { public class RaceFinishController extends Controller2 {
private @FXML TableView<VisualiserBoat> boatInfoTable; private @FXML TableView<VisualiserBoat> boatInfoTable;
private @FXML TableColumn<VisualiserBoat, String> boatRankColumn; private @FXML TableColumn<VisualiserBoat, String> boatRankColumn;
private @FXML TableColumn<VisualiserBoat, String> boatNameColumn; private @FXML TableColumn<VisualiserBoat, String> boatNameColumn;

@ -1,4 +1,4 @@
package visualiser.Controllers2; package visualiser.Controllers;
import javafx.animation.AnimationTimer; import javafx.animation.AnimationTimer;
import javafx.application.Platform; import javafx.application.Platform;
@ -9,7 +9,6 @@ import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import network.Messages.Enums.RaceStatusEnum; import network.Messages.Enums.RaceStatusEnum;
import network.Messages.Enums.RequestToJoinEnum; import network.Messages.Enums.RequestToJoinEnum;
import visualiser.Controllers.RaceController;
import visualiser.gameController.ControllerClient; import visualiser.gameController.ControllerClient;
import visualiser.model.VisualiserBoat; import visualiser.model.VisualiserBoat;
import visualiser.model.VisualiserRaceEvent; import visualiser.model.VisualiserRaceEvent;
@ -23,7 +22,7 @@ import java.util.logging.Logger;
/** /**
* Controller to for waiting for the race to start. * Controller to for waiting for the race to start.
*/ */
public class StartController extends Controller2 { public class RaceStartController extends Controller2 {
private @FXML Label raceTitleLabel; private @FXML Label raceTitleLabel;
private @FXML Label raceStartLabel; private @FXML Label raceStartLabel;
private @FXML Label timeZoneTime; private @FXML Label timeZoneTime;
@ -127,8 +126,10 @@ public class StartController extends Controller2 {
stop(); // stop this timer stop(); // stop this timer
// load up the race scene // load up the race scene
try { try {
RaceController rc = (RaceController)loadScene("race.fxml"); RaceViewController rvc = (RaceViewController)
rc.startRace(visualiserRaceEvent, controllerClient, isHost); loadScene("raceView.fxml");
rvc.startRace(visualiserRaceEvent, controllerClient,
isHost);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

@ -17,9 +17,6 @@ import javafx.scene.layout.StackPane;
import javafx.util.Callback; import javafx.util.Callback;
import network.Messages.Enums.RaceStatusEnum; import network.Messages.Enums.RaceStatusEnum;
import shared.model.Leg; import shared.model.Leg;
import visualiser.Controllers2.ArrowController;
import visualiser.Controllers2.Controller2;
import visualiser.Controllers2.FinishController;
import visualiser.app.App; import visualiser.app.App;
import visualiser.gameController.ControllerClient; import visualiser.gameController.ControllerClient;
import visualiser.gameController.Keys.ControlKey; import visualiser.gameController.Keys.ControlKey;
@ -35,13 +32,12 @@ import java.util.logging.Logger;
/** /**
* Controller used to display a running race. * Controller used to display a running race.
*/ */
public class RaceController extends Controller2 { public class RaceViewController extends Controller2 {
private VisualiserRaceEvent visualiserRace; private VisualiserRaceEvent visualiserRace;
private VisualiserRaceState raceState; private VisualiserRaceState raceState;
private ControllerClient controllerClient; private ControllerClient controllerClient;
private ResizableRaceCanvas raceCanvas; private ResizableRaceCanvas raceCanvas;
private KeyFactory keyFactory; private KeyFactory keyFactory = new KeyFactory();
private boolean infoTableShow = true; // shown or hidden private boolean infoTableShow = true; // shown or hidden
private boolean isHost; private boolean isHost;
@ -87,9 +83,10 @@ public class RaceController extends Controller2 {
race.addEventFilter(KeyEvent.KEY_PRESSED, event -> { race.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
String codeString = event.getCode().toString(); String codeString = event.getCode().toString();
// tab key
if (codeString.equals("TAB")){toggleTable();} if (codeString.equals("TAB")){toggleTable();}
// valid key pressed // any key pressed
ControlKey controlKey = keyFactory.getKey(codeString); ControlKey controlKey = keyFactory.getKey(codeString);
if(controlKey != null) { if(controlKey != null) {
try { try {
@ -98,13 +95,12 @@ public class RaceController extends Controller2 {
event.consume(); event.consume();
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
Logger.getGlobal().log(Level.WARNING, "RaceController was interrupted on thread: " + Thread.currentThread() + "while sending: " + controlKey, e); Logger.getGlobal().log(Level.WARNING, "RaceViewController was interrupted on thread: " + Thread.currentThread() + "while sending: " + controlKey, e);
} }
} }
// escape key // escape key
if(event.getCode() == KeyCode.ESCAPE) { if(event.getCode() == KeyCode.ESCAPE) {
try { try {
if (isHost) { if (isHost) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
@ -112,10 +108,8 @@ public class RaceController extends Controller2 {
alert.setContentText("Do you wish to quit the race? You are the host"); alert.setContentText("Do you wish to quit the race? You are the host");
Optional<ButtonType> result = alert.showAndWait(); Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) { if (result.get() == ButtonType.OK) {
HostController hc = (HostController)loadScene( App.game.endEvent();
"hostgame.fxml"); loadTitleScreen();
hc.endEvent();
App.app.loadTitleScreen();
} }
} else { } else {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
@ -123,7 +117,7 @@ public class RaceController extends Controller2 {
alert.setContentText("Do you wish to quit the race?"); alert.setContentText("Do you wish to quit the race?");
Optional<ButtonType> result = alert.showAndWait(); Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) { if (result.get() == ButtonType.OK) {
App.app.loadTitleScreen(); loadTitleScreen();
} }
} }
} catch (IOException e) { } catch (IOException e) {
@ -170,10 +164,8 @@ public class RaceController extends Controller2 {
showFPS.selectedProperty().addListener((ov, old_val, new_val) -> { showFPS.selectedProperty().addListener((ov, old_val, new_val) -> {
if (showFPS.isSelected()) { if (showFPS.isSelected()) {
FPS.setVisible(true); FPS.setVisible(true);
} else { } else {
FPS.setVisible(false); FPS.setVisible(false);
} }
}); });
@ -260,8 +252,6 @@ public class RaceController extends Controller2 {
private void initialiseRaceCanvas() { private void initialiseRaceCanvas() {
//Create canvas. //Create canvas.
raceCanvas = new ResizableRaceCanvas(raceState); raceCanvas = new ResizableRaceCanvas(raceState);
//Set properties.
raceCanvas.setMouseTransparent(true); raceCanvas.setMouseTransparent(true);
raceCanvas.widthProperty().bind(canvasBase.widthProperty()); raceCanvas.widthProperty().bind(canvasBase.widthProperty());
raceCanvas.heightProperty().bind(canvasBase.heightProperty()); raceCanvas.heightProperty().bind(canvasBase.heightProperty());
@ -288,8 +278,8 @@ public class RaceController extends Controller2 {
* Transition from the race view to the finish view. * Transition from the race view to the finish view.
*/ */
public void finishRace() throws IOException { public void finishRace() throws IOException {
FinishController fc = RaceFinishController fc =
(FinishController)loadScene("/visualiser/scenes/finish.fxml"); (RaceFinishController)loadScene("raceFinish.fxml");
fc.loadFinish(raceState.getBoats()); fc.loadFinish(raceState.getBoats());
} }
@ -317,7 +307,7 @@ public class RaceController extends Controller2 {
//Return to main screen if we lose connection. //Return to main screen if we lose connection.
if (!visualiserRace.getServerConnection().isAlive()) { if (!visualiserRace.getServerConnection().isAlive()) {
try { try {
App.app.loadTitleScreen(); loadTitleScreen();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

@ -1,4 +1,4 @@
package visualiser.Controllers2; package visualiser.Controllers;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.RadioButton; import javafx.scene.control.RadioButton;
@ -23,7 +23,7 @@ public class TitleController extends Controller2 {
* @throws IOException if main has problems * @throws IOException if main has problems
*/ */
public void hostAGame() throws IOException { public void hostAGame() throws IOException {
loadScene("hostLobby.fxml"); loadScene("lobbyHosting.fxml");
} }
/** /**

@ -26,6 +26,7 @@ import javafx.stage.Stage;
import javafx.stage.StageStyle; import javafx.stage.StageStyle;
import javafx.stage.WindowEvent; import javafx.stage.WindowEvent;
import javafx.util.Duration; import javafx.util.Duration;
import mock.app.Event;
import visualiser.gameController.Keys.KeyFactory; import visualiser.gameController.Keys.KeyFactory;
public class App extends Application { public class App extends Application {
@ -36,8 +37,9 @@ public class App extends Application {
private Label progressText; private Label progressText;
private static final int SPLASH_WIDTH = 676; private static final int SPLASH_WIDTH = 676;
private static final int SPLASH_HEIGHT = 227; private static final int SPLASH_HEIGHT = 227;
public static KeyFactory keyFactory = new KeyFactory(); public static KeyFactory keyFactory;
public static App app; public static App app = new App();
public static Event game;
/** /**
* Entry point for running the programme * Entry point for running the programme
@ -50,6 +52,7 @@ public class App extends Application {
@Override @Override
public void init() { public void init() {
// load the user's personalised key bindings // load the user's personalised key bindings
keyFactory = new KeyFactory();
keyFactory.load(); keyFactory.load();
ImageView splash = new ImageView(new Image( ImageView splash = new ImageView(new Image(
@ -103,11 +106,9 @@ public class App extends Application {
} }
Thread.sleep(100); Thread.sleep(100);
updateMessage("Burger's done!"); updateMessage("Burger's done!");
return addedFilling; return addedFilling;
} }
}; };
showSplash( showSplash(
stage, stage,
boatTask, boatTask,
@ -120,7 +121,6 @@ public class App extends Application {
} }
); );
new Thread(boatTask).start(); new Thread(boatTask).start();
} }
/** /**
@ -134,7 +134,7 @@ public class App extends Application {
public void loadTitleScreen() throws Exception { public void loadTitleScreen() throws Exception {
stage = new Stage(); stage = new Stage();
FXMLLoader loader = new FXMLLoader(getClass().getResource FXMLLoader loader = new FXMLLoader(getClass().getResource
("/visualiser/scenes/titleScreen.fxml")); ("/visualiser/scenes/title.fxml"));
Parent root = loader.load(); Parent root = loader.load();
stage.setResizable(false); stage.setResizable(false);
Scene scene = new Scene(root); Scene scene = new Scene(root);

@ -8,8 +8,8 @@ import shared.model.GPSCoordinate;
* {@link VisualiserBoat Boat} has travelled in a race. <br> * {@link VisualiserBoat Boat} has travelled in a race. <br>
* TrackPoints are displayed on a * TrackPoints are displayed on a
* {@link ResizableRaceCanvas}, via the * {@link ResizableRaceCanvas}, via the
* {@link visualiser.Controllers.RaceController}. <br> * {@link visualiser.Controllers.RaceViewController}. <br>
* Track points can be made visible or hidden via the RaceController's * Track points can be made visible or hidden via the RaceViewController's
* {@link Annotations}. * {@link Annotations}.
*/ */
public class TrackPoint { public class TrackPoint {

@ -17,7 +17,7 @@ import java.util.List;
* This class is used to represent and store information about a boat which may * This class is used to represent and store information about a boat which may
* travel around in a race. It is displayed on the * travel around in a race. It is displayed on the
* {@link ResizableRaceCanvas ResizableRaceCanvas} via the * {@link ResizableRaceCanvas ResizableRaceCanvas} via the
* {@link visualiser.Controllers.RaceController RaceController}. * {@link visualiser.Controllers.RaceViewController RaceViewController}.
*/ */
public class VisualiserBoat extends Boat { public class VisualiserBoat extends Boat {

@ -66,7 +66,7 @@ public class VisualiserRaceEvent {
this.serverConnection = new ServerConnection(socket, visualiserRaceState, raceCommands, requestType); this.serverConnection = new ServerConnection(socket, visualiserRaceState, raceCommands, requestType);
this.serverConnectionThread = new Thread(serverConnection, "StartController.enterLobby()->serverConnection thread " + serverConnection); this.serverConnectionThread = new Thread(serverConnection, "RaceStartController.enterLobby()->serverConnection thread " + serverConnection);
this.serverConnectionThread.start(); this.serverConnectionThread.start();

@ -7,14 +7,12 @@ import network.MessageRouters.MessageRouter;
import network.Messages.AC35Data; import network.Messages.AC35Data;
import network.Messages.Enums.MessageType; import network.Messages.Enums.MessageType;
import network.Messages.Enums.RequestToJoinEnum; import network.Messages.Enums.RequestToJoinEnum;
import network.Messages.LatestMessages;
import network.StreamRelated.MessageDeserialiser; import network.StreamRelated.MessageDeserialiser;
import network.StreamRelated.MessageSerialiser; import network.StreamRelated.MessageSerialiser;
import shared.model.RunnableWithFramePeriod; import shared.model.RunnableWithFramePeriod;
import visualiser.model.VisualiserRaceEvent;
import visualiser.model.VisualiserRaceController;
import visualiser.enums.ConnectionToServerState; import visualiser.enums.ConnectionToServerState;
import visualiser.gameController.ControllerClient; import visualiser.gameController.ControllerClient;
import visualiser.model.VisualiserRaceController;
import visualiser.model.VisualiserRaceState; import visualiser.model.VisualiserRaceState;
import java.io.IOException; import java.io.IOException;
@ -310,7 +308,7 @@ public class ServerConnection implements RunnableWithFramePeriod {
} }
//TODO create input controller here. RaceController should query for it, if it exists. //TODO create input controller here. RaceViewController should query for it, if it exists.
private void createPlayerInputController() { private void createPlayerInputController() {
this.messageRouter.addRoute(MessageType.BOATACTION, messageSerialiser.getMessagesToSend()); this.messageRouter.addRoute(MessageType.BOATACTION, messageSerialiser.getMessagesToSend());

@ -8,7 +8,7 @@
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.shape.Circle?> <?import javafx.scene.shape.Circle?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<GridPane fx:id="arrowGridPane" maxHeight="-Infinity" maxWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers2.ArrowController"> <GridPane fx:id="arrowGridPane" maxHeight="-Infinity" maxWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.ArrowController">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints> </columnConstraints>

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.image.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="350.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<ImageView fitHeight="385.0" fitWidth="600.0" layoutY="-2.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="-1.9456787109375" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="-2.0">
<image>
<Image url="@../images/game_controls.png" />
</image>
</ImageView>
</children>
</AnchorPane>

@ -1,44 +0,0 @@
<!--<?xml version="1.0" encoding="UTF-8"?>-->
<!--<?import java.lang.*?>-->
<!--<?import javafx.scene.control.*?>-->
<!--<?import javafx.scene.text.*?>-->
<!--<?import javafx.scene.control.Button?>-->
<!--<?import javafx.scene.control.Label?>-->
<!--<?import javafx.scene.layout.*?>-->
<!--<?import javafx.scene.text.Font?>-->
<!--<AnchorPane fx:id="hostWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" visible="false" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">-->
<!--<children>-->
<!--<GridPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">-->
<!--<columnConstraints>-->
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />-->
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />-->
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />-->
<!--</columnConstraints>-->
<!--<rowConstraints>-->
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />-->
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />-->
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />-->
<!--</rowConstraints>-->
<!--<children>-->
<!--<Button fx:id="hostGameBtn" mnemonicParsing="false" onAction="#hostGamePressed" text="Start Game" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2">-->
<!--<font>-->
<!--<Font size="20.0" />-->
<!--</font>-->
<!--</Button>-->
<!--<Label text="Address: 127.0.0.1" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="TOP">-->
<!--<font>-->
<!--<Font size="17.0" />-->
<!--</font>-->
<!--</Label>-->
<!--<Label text="Port: 4942" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="1">-->
<!--<font>-->
<!--<Font size="17.0" />-->
<!--</font>-->
<!--</Label>-->
<!--<Button mnemonicParsing="false" onAction="#menuBtnPressed" text="Main Menu" GridPane.halignment="CENTER" />-->
<!--</children>-->
<!--</GridPane>-->
<!--</children>-->
<!--</AnchorPane>-->

@ -6,7 +6,7 @@
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<AnchorPane id="anchor" fx:id="anchor" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="471.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers2.KeyBindingsController"> <AnchorPane id="anchor" fx:id="anchor" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="471.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.KeyBindingsController">
<children> <children>
<Label fx:id="lblTitle" layoutX="172.0" layoutY="14.0" text="Key Bindings"> <Label fx:id="lblTitle" layoutX="172.0" layoutY="14.0" text="Key Bindings">
<font> <font>

@ -14,7 +14,7 @@
<?import javafx.scene.layout.RowConstraints?> <?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<AnchorPane fx:id="hostWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.HostController"> <AnchorPane fx:id="hostWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.LobbyHostingController">
<children> <children>
<SplitPane fx:id="splitPane" dividerPositions="0.7724935732647815" layoutX="580.0" layoutY="129.0" prefHeight="160.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <SplitPane fx:id="splitPane" dividerPositions="0.7724935732647815" layoutX="580.0" layoutY="129.0" prefHeight="160.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items> <items>

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane fx:id="main" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.MainController">
<children>
<fx:include fx:id="race" source="race.fxml" />
<fx:include fx:id="start" source="start.fxml" />
<fx:include fx:id="connection" source="connect.fxml" />
<fx:include fx:id="finish" source="finish.fxml" />
<fx:include fx:id="host" source="hostLobby.fxml" />
<fx:include fx:id="title" source="titleScreen.fxml" />
<fx:include fx:id="lobby" source="lobby.fxml" />
</children>
</AnchorPane>

@ -6,7 +6,7 @@
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="100.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers2.NotificationController"> <Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="100.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.NotificationController">
<children> <children>
<Button fx:id="btnOk" layoutX="110.0" layoutY="65.0" mnemonicParsing="false" onAction="#ok" prefWidth="80.0" text="Ok" /> <Button fx:id="btnOk" layoutX="110.0" layoutY="65.0" mnemonicParsing="false" onAction="#ok" prefWidth="80.0" text="Ok" />
<Text fx:id="txtMessage" fill="RED" layoutY="23.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Warning!" textAlignment="CENTER" wrappingWidth="300.0"> <Text fx:id="txtMessage" fill="RED" layoutY="23.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Warning!" textAlignment="CENTER" wrappingWidth="300.0">

@ -9,7 +9,7 @@
<?import javafx.scene.layout.RowConstraints?> <?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<AnchorPane fx:id="finishWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers2.FinishController"> <AnchorPane fx:id="finishWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceFinishController">
<children> <children>
<GridPane fx:id="start" alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <GridPane fx:id="start" alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints> <columnConstraints>

@ -9,7 +9,7 @@
<?import javafx.scene.layout.RowConstraints?> <?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<AnchorPane fx:id="startWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers2.StartController"> <AnchorPane fx:id="startWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceStartController">
<children> <children>
<GridPane fx:id="start" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <GridPane fx:id="start" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints> <columnConstraints>

@ -22,7 +22,11 @@
<?import javafx.scene.layout.StackPane?> <?import javafx.scene.layout.StackPane?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<SplitPane fx:id="race" dividerPositions="1.0" prefHeight="431.0" prefWidth="610.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceController"> <SplitPane fx:id="race" dividerPositions="1.0" prefHeight="431.0"
prefWidth="610.0" AnchorPane.bottomAnchor="0.0"
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0"
xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceViewController">
<items> <items>
<GridPane fx:id="canvasBase"> <GridPane fx:id="canvasBase">
<columnConstraints> <columnConstraints>

@ -1,61 +1,85 @@
<!--<?xml version="1.0" encoding="UTF-8"?>--> <?xml version="1.0" encoding="UTF-8"?>
<!--<?import javafx.geometry.*?>--> <?import javafx.scene.control.Button?>
<!--<?import javafx.scene.control.*?>--> <?import javafx.scene.control.RadioButton?>
<!--<?import javafx.scene.layout.*?>--> <?import javafx.scene.image.*?>
<!--<?import javafx.scene.text.Font?>--> <?import javafx.scene.layout.*?>
<!--<AnchorPane fx:id="connectionWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.ConnectionController">--> <?import javafx.scene.text.*?>
<!--<children>--> <AnchorPane fx:id="titleWrapper" maxHeight="600.0" maxWidth="800.0" minHeight="600.0" minWidth="800.0" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.TitleController">
<!--<GridPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">--> <children>
<!--<columnConstraints>--> <GridPane layoutY="39.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />--> <columnConstraints>
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />--> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />--> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<!--</columnConstraints>--> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<!--<rowConstraints>--> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />--> </columnConstraints>
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />--> <rowConstraints>
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />--> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<!--</rowConstraints>--> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<!--<children>--> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<!--<Button fx:id="hostGameTitleBtn" maxWidth="204.0" mnemonicParsing="false" text="Host Game" GridPane.halignment="LEFT" GridPane.rowIndex="1">--> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<!--<font>--> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<!--<Font size="20.0" />--> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<!--</font>--> </rowConstraints>
<!--<GridPane.margin>--> <children>
<!--<Insets left="50.0" />--> <Pane prefHeight="20.0" prefWidth="20.0" style="-fx-background-color: #0061ff;" GridPane.columnSpan="4" GridPane.rowIndex="4" GridPane.rowSpan="2">
<!--</GridPane.margin>--> <children>
<!--</Button>--> <Text fx:id="txtTitle" layoutX="167.0" layoutY="136.0" strokeType="OUTSIDE" strokeWidth="0.0" text="The Boat Game!">
<!--<Button fx:id="connectGameBtn" maxWidth="204.0" mnemonicParsing="false" text="Connect to Game" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="1">--> <font>
<!--<font>--> <Font name="Comic Sans MS" size="64.0" />
<!--<Font size="20.0" />--> </font>
<!--</font>--> </Text>
<!--<GridPane.margin>--> <Text layoutX="690.0" layoutY="80.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TM">
<!--<Insets right="50.0" />--> <font>
<!--</GridPane.margin>--> <Font name="Comic Sans MS" size="12.0" />
<!--</Button>--> </font>
<!--<RadioButton fx:id="nightRadioBtn" mnemonicParsing="false" text="Night Mode" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2">--> </Text>
<!--<padding>--> <RadioButton fx:id="nightModeRD" layoutX="681.0" layoutY="168.0" mnemonicParsing="false" onAction="#setNightMode" text="Night Mode" />
<!--<Insets bottom="-50.0" />--> <RadioButton fx:id="dayModeRD" layoutX="574.0" layoutY="168.0" mnemonicParsing="false" onAction="#setDayMode" selected="true" text="Day Mode" />
<!--</padding>--> <Button layoutX="28.0" layoutY="152.0" mnemonicParsing="false" onAction="#showControls" text="Controls" />
<!--<GridPane.margin>--> </children>
<!--<Insets left="80.0" />--> </Pane>
<!--</GridPane.margin>--> <Pane prefHeight="20.0" prefWidth="20.0" style="-fx-background-color: #6be6ff;" GridPane.columnSpan="4" GridPane.rowSpan="4">
<!--</RadioButton>--> <children>
<!--<RadioButton fx:id="dayRadioBtn" mnemonicParsing="false" text="Day Mode" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2">--> <ImageView fx:id="imgBoat" fitHeight="404.0" fitWidth="296.0" layoutX="268.0" pickOnBounds="true" preserveRatio="true">
<!--<padding>--> <image>
<!--<Insets top="-50.0" />--> <Image url="@../images/boat.png" />
<!--</padding>--> </image>
<!--<GridPane.margin>--> </ImageView>
<!--<Insets left="80.0" />--> <ImageView fx:id="imgCloud1" fitHeight="291.0" fitWidth="307.0" pickOnBounds="true" preserveRatio="true">
<!--</GridPane.margin>--> <image>
<!--</RadioButton>--> <Image url="@../images/cloud.png" />
<!--<Label text="Game" textAlignment="CENTER" GridPane.columnIndex="1" GridPane.halignment="CENTER">--> </image>
<!--<font>--> </ImageView>
<!--<Font size="60.0" />--> <ImageView fx:id="imgWhale" fitHeight="113.0" fitWidth="98.0" layoutX="69.0" layoutY="302.0" pickOnBounds="true" preserveRatio="true">
<!--</font>--> <image>
<!--</Label>--> <Image url="@../images/whale.png" />
<!--</children>--> </image>
<!--</GridPane>--> </ImageView>
<!--</children>--> <ImageView fx:id="imgCloud2" fitHeight="291.0" fitWidth="307.0" layoutX="501.0" pickOnBounds="true" preserveRatio="true">
<!--</AnchorPane>--> <image>
<Image url="@../images/cloud.png" />
</image>
</ImageView>
<ImageView fx:id="imgSun" fitHeight="154.0" fitWidth="145.0" layoutX="701.0" layoutY="-39.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../images/sun.png" />
</image>
</ImageView>
<Button fx:id="btnJoin" layoutX="78.0" layoutY="149.0" mnemonicParsing="false" onAction="#joinAGame" prefHeight="31.0" prefWidth="130.0" text="Join a Game">
<font>
<Font name="Comic Sans MS Bold" size="16.0" />
</font>
</Button>
<Button layoutX="578.0" layoutY="150.0" mnemonicParsing="false" onAction="#hostAGame" prefHeight="31.0" prefWidth="130.0" text="Host a Game">
<font>
<Font name="Comic Sans MS Bold" size="16.0" />
</font>
</Button>
</children>
</Pane>
</children>
</GridPane>
</children>
</AnchorPane>

@ -1,85 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<AnchorPane fx:id="titleWrapper" maxHeight="600.0" maxWidth="800.0" minHeight="600.0" minWidth="800.0" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers2.TitleController">
<children>
<GridPane layoutY="39.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Pane prefHeight="20.0" prefWidth="20.0" style="-fx-background-color: #0061ff;" GridPane.columnSpan="4" GridPane.rowIndex="4" GridPane.rowSpan="2">
<children>
<Text fx:id="txtTitle" layoutX="167.0" layoutY="136.0" strokeType="OUTSIDE" strokeWidth="0.0" text="The Boat Game!">
<font>
<Font name="Comic Sans MS" size="64.0" />
</font>
</Text>
<Text layoutX="690.0" layoutY="80.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TM">
<font>
<Font name="Comic Sans MS" size="12.0" />
</font>
</Text>
<RadioButton fx:id="nightModeRD" layoutX="681.0" layoutY="168.0" mnemonicParsing="false" onAction="#setNightMode" text="Night Mode" />
<RadioButton fx:id="dayModeRD" layoutX="574.0" layoutY="168.0" mnemonicParsing="false" onAction="#setDayMode" selected="true" text="Day Mode" />
<Button layoutX="28.0" layoutY="152.0" mnemonicParsing="false" onAction="#showControls" text="Controls" />
</children>
</Pane>
<Pane prefHeight="20.0" prefWidth="20.0" style="-fx-background-color: #6be6ff;" GridPane.columnSpan="4" GridPane.rowSpan="4">
<children>
<ImageView fx:id="imgBoat" fitHeight="404.0" fitWidth="296.0" layoutX="268.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../images/boat.png" />
</image>
</ImageView>
<ImageView fx:id="imgCloud1" fitHeight="291.0" fitWidth="307.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../images/cloud.png" />
</image>
</ImageView>
<ImageView fx:id="imgWhale" fitHeight="113.0" fitWidth="98.0" layoutX="69.0" layoutY="302.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../images/whale.png" />
</image>
</ImageView>
<ImageView fx:id="imgCloud2" fitHeight="291.0" fitWidth="307.0" layoutX="501.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../images/cloud.png" />
</image>
</ImageView>
<ImageView fx:id="imgSun" fitHeight="154.0" fitWidth="145.0" layoutX="701.0" layoutY="-39.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../images/sun.png" />
</image>
</ImageView>
<Button fx:id="btnJoin" layoutX="78.0" layoutY="149.0" mnemonicParsing="false" onAction="#joinAGame" prefHeight="31.0" prefWidth="130.0" text="Join a Game">
<font>
<Font name="Comic Sans MS Bold" size="16.0" />
</font>
</Button>
<Button layoutX="578.0" layoutY="150.0" mnemonicParsing="false" onAction="#hostAGame" prefHeight="31.0" prefWidth="130.0" text="Host a Game">
<font>
<Font name="Comic Sans MS Bold" size="16.0" />
</font>
</Button>
</children>
</Pane>
</children>
</GridPane>
</children>
</AnchorPane>
Loading…
Cancel
Save