commit
a8701d8a1f
@ -0,0 +1,86 @@
|
||||
package visualiser.Controllers;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.Stage;
|
||||
import mock.app.Event;
|
||||
import shared.exceptions.InvalidBoatDataException;
|
||||
import shared.exceptions.InvalidRaceDataException;
|
||||
import shared.exceptions.InvalidRegattaDataException;
|
||||
import shared.exceptions.XMLReaderException;
|
||||
import visualiser.model.RaceConnection;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.URL;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Controller for Hosting a game.
|
||||
*/
|
||||
public class HostController extends Controller {
|
||||
|
||||
|
||||
@FXML
|
||||
TextField gameNameField;
|
||||
|
||||
@FXML
|
||||
TextField hostNameField;
|
||||
|
||||
@FXML
|
||||
AnchorPane hostWrapper;
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Hosts a game
|
||||
* @throws IOException if socket cannot be connected to
|
||||
*/
|
||||
public void hostGamePressed() throws IOException{
|
||||
try {
|
||||
Event game = Event.getEvent();
|
||||
game.start();
|
||||
connectSocket("localhost", 4942);
|
||||
} catch (InvalidRaceDataException e) {
|
||||
e.printStackTrace();
|
||||
} catch (XMLReaderException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidBoatDataException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidRegattaDataException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a socket
|
||||
* @param address address of the server
|
||||
* @param port port that the server is run off
|
||||
*/
|
||||
public void connectSocket(String address, int port) {
|
||||
try{
|
||||
Socket socket = new Socket(address, port);
|
||||
hostWrapper.setVisible(false);
|
||||
parent.enterLobby(socket);
|
||||
} catch (IOException e) { /* Never reached */ }
|
||||
}
|
||||
|
||||
public AnchorPane startWrapper(){
|
||||
return hostWrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hosts a game.
|
||||
*/
|
||||
public void hostGame(){
|
||||
hostWrapper.setVisible(true);
|
||||
System.out.println("Reacted hostGame");
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,128 @@
|
||||
package visualiser.Controllers;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import visualiser.model.RaceConnection;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Controller for the Lobby for entering games
|
||||
*/
|
||||
public class LobbyController extends Controller {
|
||||
|
||||
@FXML
|
||||
AnchorPane lobbyWrapper;
|
||||
@FXML
|
||||
private TableView<RaceConnection> lobbyTable;
|
||||
@FXML
|
||||
private TableColumn<RaceConnection, String> gameNameColumn;
|
||||
@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;
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
connections = FXCollections.observableArrayList();
|
||||
//connections.add(new RaceConnection("localhost", 4942, "Local Game"));
|
||||
|
||||
lobbyTable.setItems(connections);
|
||||
|
||||
gameNameColumn.setCellValueFactory(cellData -> cellData.getValue().gamenameProperty());
|
||||
hostNameColumn.setCellValueFactory(cellData -> cellData.getValue().hostnameProperty());
|
||||
statusColumn.setCellValueFactory(cellData -> cellData.getValue().statusProperty());
|
||||
|
||||
lobbyTable.getSelectionModel().selectedItemProperty().addListener((obs, prev, curr) -> {
|
||||
if (curr != null && curr.statusProperty().getValue().equals("Ready")) {
|
||||
joinGameBtn.setDisable(false);
|
||||
}
|
||||
else {
|
||||
joinGameBtn.setDisable(true);
|
||||
System.out.println(curr.statusProperty().getValue());
|
||||
}
|
||||
});
|
||||
joinGameBtn.setDisable(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes the connections in the lobby
|
||||
*/
|
||||
public void refreshBtnPressed(){
|
||||
for(RaceConnection connection: connections) {
|
||||
connection.check();
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (lobbyTable.getSelectionModel().getSelectedItem().statusProperty().getValue().equals("Ready")) {
|
||||
joinGameBtn.setDisable(false);
|
||||
} else {
|
||||
joinGameBtn.setDisable(true);
|
||||
}
|
||||
} catch (Exception e){}
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a connection.
|
||||
*/
|
||||
public void connectSocket() {
|
||||
try{
|
||||
RaceConnection connection = lobbyTable.getSelectionModel().getSelectedItem();
|
||||
Socket socket = new Socket(connection.getHostname(), connection.getPort());
|
||||
lobbyWrapper.setVisible(false);
|
||||
parent.enterLobby(socket);
|
||||
} catch (IOException e) { /* Never reached */
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* adds a new connection
|
||||
*/
|
||||
public void addConnectionPressed(){
|
||||
String hostName = addressFld.getText();
|
||||
String portString = portFld.getText();
|
||||
try{
|
||||
int port = Integer.parseInt(portString);
|
||||
connections.add(new RaceConnection(hostName, port, "Boat Game"));
|
||||
addressFld.clear();
|
||||
portFld.clear();
|
||||
}catch(NumberFormatException e){
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package visualiser.Controllers;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.Stage;
|
||||
import visualiser.app.App;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Controller for the opening title window.
|
||||
* Has two initial buttons for a user to decide how to play their game. Has a
|
||||
* burger-boat and comic sans styling to allure and entice users into playing
|
||||
* the game.
|
||||
*/
|
||||
public class TitleController extends Controller {
|
||||
@FXML
|
||||
Button btnJoin;
|
||||
@FXML
|
||||
AnchorPane titleWrapper;
|
||||
@FXML
|
||||
RadioButton dayModeRD;
|
||||
@FXML
|
||||
RadioButton nightModeRD;
|
||||
|
||||
/**
|
||||
* Method called when the 'host a game' button is pressed.
|
||||
* Opens the next window allowing a user to host their own game.
|
||||
* Currently used to run the RaceVision mock.
|
||||
* @throws IOException if main has problems
|
||||
*/
|
||||
public void hostAGame() throws IOException {
|
||||
titleWrapper.setVisible(false);
|
||||
parent.hostGame();
|
||||
App.getStage().setResizable(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch the scene to the title page.
|
||||
*/
|
||||
public void enterTitle(){
|
||||
titleWrapper.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* To be implemented at a later date- will open the next scene displaying
|
||||
* games a player can join. Place holder method for now!
|
||||
*/
|
||||
public void joinAGame() {
|
||||
titleWrapper.setVisible(false);
|
||||
parent.enterLobby();
|
||||
App.getStage().setResizable(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches the css of the program to day mode theme
|
||||
*/
|
||||
public void setDayMode(){
|
||||
dayModeRD.getScene().getStylesheets().clear();
|
||||
dayModeRD.getScene().getStylesheets().add("/css/dayMode.css");
|
||||
nightModeRD.setSelected(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches the css of the program to night mode theme
|
||||
*/
|
||||
public void setNightMode(){
|
||||
nightModeRD.getScene().getStylesheets().clear();
|
||||
nightModeRD.getScene().getStylesheets().add("/css/nightMode.css");
|
||||
dayModeRD.setSelected(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package visualiser.model;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
|
||||
/**
|
||||
* Created by David on 26/07/2017.
|
||||
*/
|
||||
public class Ping implements Runnable {
|
||||
|
||||
private final String hostname;
|
||||
private final int port;
|
||||
private final RaceConnection rc;
|
||||
|
||||
public Ping(String hostname, int port, RaceConnection rc){
|
||||
this.hostname = hostname;
|
||||
this.port = port;
|
||||
this.rc = rc;
|
||||
}
|
||||
|
||||
public boolean pingPort(){
|
||||
//TODO the connection needs to be moved to its own thread, so it doesn't block fx thread.
|
||||
InetSocketAddress i = new InetSocketAddress(hostname, port);
|
||||
try (Socket s = new Socket()){
|
||||
s.connect(i, 750);//TODO this should be at least a second or two, once moved to its own thread
|
||||
s.shutdownInput();
|
||||
s.shutdownOutput();
|
||||
s.close();
|
||||
rc.statusProperty().set("Ready");
|
||||
//System.out.println(String.valueOf(s.isClosed()));
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
rc.statusProperty().set("Offline");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
pingPort();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
.root {
|
||||
-fx-base: rgb(215, 232, 218);
|
||||
-fx-background: rgb(242, 242, 242);
|
||||
|
||||
/* make controls (buttons, thumb, etc.) slightly lighter */
|
||||
-fx-color: derive(-fx-base, 2.5%);
|
||||
|
||||
/* text fields and table rows background */
|
||||
-fx-control-inner-background: rgb(200, 200, 200);
|
||||
/* version of -fx-control-inner-background for alternative rows */
|
||||
-fx-control-inner-background-alt: derive(-fx-control-inner-background, 10%);
|
||||
|
||||
/* text colors depending on background's brightness */
|
||||
-fx-light-text-color: rgb(80, 80, 80);
|
||||
-fx-mid-text-color: rgb(20, 20, 20);
|
||||
-fx-dark-text-color: rgb(0, 0, 0);
|
||||
|
||||
/*highlighting/accenting objects. */
|
||||
-fx-accent: rgb(128, 128, 128);
|
||||
|
||||
/* color of non-focused yet selected elements */
|
||||
-fx-selection-bar-non-focused: rgb(50, 50, 50);
|
||||
|
||||
/*Focus colour*/
|
||||
-fx-focus-color: rgb(128, 128, 128);
|
||||
}
|
||||
|
||||
/* Fix derived prompt color for text fields */
|
||||
.text-input {
|
||||
-fx-prompt-text-fill: derive(-fx-control-inner-background, +0%);
|
||||
-fx-background-color: #a9a9a9, black, grey;
|
||||
}
|
||||
|
||||
/* Keep prompt invisible when focused (above color fix overrides it) */
|
||||
.text-input:focused {
|
||||
-fx-prompt-text-fill: transparent;
|
||||
}
|
||||
|
||||
/* Fix scroll bar buttons arrows colors */
|
||||
.scroll-bar > .increment-button > .increment-arrow,
|
||||
.scroll-bar > .decrement-button > .decrement-arrow {
|
||||
-fx-background-color: -fx-mark-highlight-color, rgb(255, 255, 255);
|
||||
}
|
||||
|
||||
.scroll-bar > .increment-button:hover > .increment-arrow,
|
||||
.scroll-bar > .decrement-button:hover > .decrement-arrow {
|
||||
-fx-background-color: -fx-mark-highlight-color, rgb(255, 255, 255);
|
||||
}
|
||||
|
||||
.scroll-bar > .increment-button:pressed > .increment-arrow,
|
||||
.scroll-bar > .decrement-button:pressed > .decrement-arrow {
|
||||
-fx-background-color: -fx-mark-highlight-color, rgb(255, 255, 255);
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
.root {
|
||||
-fx-base: rgb(20, 20, 20);
|
||||
-fx-background: rgb(50, 50, 50);
|
||||
|
||||
/* make controls (buttons, thumb, etc.) slightly lighter */
|
||||
-fx-color: derive(-fx-base, 10%);
|
||||
|
||||
/* text fields and table rows background */
|
||||
-fx-control-inner-background: rgb(50, 50, 50);
|
||||
/* version of -fx-control-inner-background for alternative rows */
|
||||
-fx-control-inner-background-alt: derive(-fx-control-inner-background, 2.5%);
|
||||
|
||||
/* text colors depending on background's brightness */
|
||||
-fx-light-text-color: rgb(220, 220, 220);
|
||||
-fx-mid-text-color: rgb(100, 100, 100);
|
||||
-fx-dark-text-color: rgb(20, 20, 20);
|
||||
|
||||
/*highlighting/accenting objects. */
|
||||
-fx-accent: rgb(128, 128, 128);
|
||||
|
||||
/* color of non-focused yet selected elements */
|
||||
-fx-selection-bar-non-focused: rgb(100, 100, 100);
|
||||
|
||||
/*Focus colour*/
|
||||
-fx-focus-color: rgb(100, 100, 100);
|
||||
}
|
||||
|
||||
/* Fix derived prompt color for text fields */
|
||||
.text-input {
|
||||
-fx-prompt-text-fill: derive(-fx-control-inner-background, +0%);
|
||||
-fx-background-color: #a9a9a9 , grey, grey;
|
||||
|
||||
}
|
||||
|
||||
/* Keep prompt invisible when focused (above color fix overrides it) */
|
||||
.text-input:focused {
|
||||
-fx-prompt-text-fill: transparent;
|
||||
}
|
||||
|
||||
/* Fix scroll bar buttons arrows colors */
|
||||
.scroll-bar > .increment-button > .increment-arrow,
|
||||
.scroll-bar > .decrement-button > .decrement-arrow {
|
||||
-fx-background-color: -fx-mark-highlight-color, rgb(255, 255, 255);
|
||||
}
|
||||
|
||||
.scroll-bar > .increment-button:hover > .increment-arrow,
|
||||
.scroll-bar > .decrement-button:hover > .decrement-arrow {
|
||||
-fx-background-color: -fx-mark-highlight-color, rgb(255, 255, 255);
|
||||
}
|
||||
|
||||
.scroll-bar > .increment-button:pressed > .increment-arrow,
|
||||
.scroll-bar > .decrement-button:pressed > .decrement-arrow {
|
||||
-fx-background-color: -fx-mark-highlight-color, rgb(255, 255, 255);
|
||||
}
|
||||
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?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" fx:controller="visualiser.Controllers.HostController">
|
||||
<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>
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane fx:id="lobbyWrapper" 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" fx:controller="visualiser.Controllers.LobbyController">
|
||||
<children>
|
||||
<GridPane fx:id="connection" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="600.0" minWidth="10.0" prefWidth="600.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="600.0" minWidth="10.0" prefWidth="600.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="182.0" minHeight="10.0" prefHeight="182.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="434.0" minHeight="10.0" prefHeight="434.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="174.0" minHeight="10.0" prefHeight="174.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<TableView fx:id="lobbyTable" prefHeight="200.0" prefWidth="1080.0" GridPane.columnSpan="2" GridPane.rowIndex="1">
|
||||
<columns>
|
||||
<TableColumn fx:id="gameNameColumn" prefWidth="223.0" text="Game Name" />
|
||||
<TableColumn fx:id="hostNameColumn" prefWidth="280.0" text="Host Name" />
|
||||
<TableColumn fx:id="statusColumn" prefWidth="176.0" text="Status" />
|
||||
</columns>
|
||||
<GridPane.margin>
|
||||
<Insets left="50.0" right="50.0" />
|
||||
</GridPane.margin>
|
||||
</TableView>
|
||||
<Label text="Available Games" GridPane.columnSpan="2" GridPane.halignment="CENTER">
|
||||
<font>
|
||||
<Font size="36.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Button fx:id="joinGameBtn" mnemonicParsing="false" onAction="#connectSocket" text="Connect to Game" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2">
|
||||
<GridPane.margin>
|
||||
<Insets right="50.0" />
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
<Button mnemonicParsing="false" onAction="#refreshBtnPressed" text="Refresh" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2">
|
||||
<GridPane.margin>
|
||||
<Insets left="120.0" />
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
<TextField fx:id="addressFld" promptText="Address" GridPane.rowIndex="2">
|
||||
<GridPane.margin>
|
||||
<Insets left="50.0" right="150.0" />
|
||||
</GridPane.margin>
|
||||
</TextField>
|
||||
<TextField fx:id="portFld" promptText="Port Number" GridPane.rowIndex="2">
|
||||
<GridPane.margin>
|
||||
<Insets left="270.0" />
|
||||
</GridPane.margin>
|
||||
</TextField>
|
||||
<Button mnemonicParsing="false" onAction="#addConnectionPressed" text="Add" GridPane.columnIndex="1" GridPane.rowIndex="2">
|
||||
<GridPane.margin>
|
||||
<Insets left="40.0" />
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
@ -1,11 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<AnchorPane fx:id="main" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.MainController">
|
||||
|
||||
<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="hostgame.fxml" />
|
||||
<fx:include fx:id="title" source="titleScreen.fxml" />
|
||||
<fx:include fx:id="lobby" source="lobby.fxml" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<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">
|
||||
<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="hostGameTitleBtn" maxWidth="204.0" mnemonicParsing="false" text="Host Game" GridPane.halignment="LEFT" GridPane.rowIndex="1">
|
||||
<font>
|
||||
<Font size="20.0" />
|
||||
</font>
|
||||
<GridPane.margin>
|
||||
<Insets left="50.0" />
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
<Button fx:id="connectGameBtn" maxWidth="204.0" mnemonicParsing="false" text="Connect to Game" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="1">
|
||||
<font>
|
||||
<Font size="20.0" />
|
||||
</font>
|
||||
<GridPane.margin>
|
||||
<Insets right="50.0" />
|
||||
</GridPane.margin>
|
||||
</Button>
|
||||
<RadioButton fx:id="nightRadioBtn" mnemonicParsing="false" text="Night Mode" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2">
|
||||
<padding>
|
||||
<Insets bottom="-50.0" />
|
||||
</padding>
|
||||
<GridPane.margin>
|
||||
<Insets left="80.0" />
|
||||
</GridPane.margin>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="dayRadioBtn" mnemonicParsing="false" text="Day Mode" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2">
|
||||
<padding>
|
||||
<Insets top="-50.0" />
|
||||
</padding>
|
||||
<GridPane.margin>
|
||||
<Insets left="80.0" />
|
||||
</GridPane.margin>
|
||||
</RadioButton>
|
||||
<Label text="Game" textAlignment="CENTER" GridPane.columnIndex="1" GridPane.halignment="CENTER">
|
||||
<font>
|
||||
<Font size="60.0" />
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
<?import javafx.scene.text.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.Controllers.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" />
|
||||
</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…
Reference in new issue