updated race view that does not use a split pane
This commit is contained in:
@@ -250,7 +250,7 @@ public class InGameLobbyController extends Controller {
|
|||||||
visualiserRaceEvent.getVisualiserRaceState().getBoats().removeListener(lobbyUpdateListener);
|
visualiserRaceEvent.getVisualiserRaceState().getBoats().removeListener(lobbyUpdateListener);
|
||||||
|
|
||||||
RaceViewController rvc = (RaceViewController)
|
RaceViewController rvc = (RaceViewController)
|
||||||
loadScene("raceView.fxml");
|
loadScene("newRaceView.fxml");
|
||||||
rvc.startRace(visualiserRaceEvent, controllerClient,
|
rvc.startRace(visualiserRaceEvent, controllerClient,
|
||||||
isHost);
|
isHost);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import javafx.scene.chart.LineChart;
|
|||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
import javafx.scene.input.KeyEvent;
|
import javafx.scene.input.KeyEvent;
|
||||||
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.shape.MeshView;
|
import javafx.scene.shape.MeshView;
|
||||||
@@ -64,7 +65,7 @@ public class RaceViewController extends Controller {
|
|||||||
// note: it says it's not used but it is! do not remove :)
|
// note: it says it's not used but it is! do not remove :)
|
||||||
private @FXML ArrowController arrowController;
|
private @FXML ArrowController arrowController;
|
||||||
private @FXML GridPane canvasBase;
|
private @FXML GridPane canvasBase;
|
||||||
private @FXML SplitPane racePane;
|
private @FXML AnchorPane newRacePane;
|
||||||
private @FXML StackPane arrowPane;
|
private @FXML StackPane arrowPane;
|
||||||
private @FXML Label timer;
|
private @FXML Label timer;
|
||||||
private @FXML Label FPS;
|
private @FXML Label FPS;
|
||||||
@@ -77,6 +78,7 @@ public class RaceViewController extends Controller {
|
|||||||
private @FXML TableColumn<VisualiserBoat, Number> boatSpeedColumn;
|
private @FXML TableColumn<VisualiserBoat, Number> boatSpeedColumn;
|
||||||
private @FXML LineChart<Number, Number> sparklineChart;
|
private @FXML LineChart<Number, Number> sparklineChart;
|
||||||
private @FXML Label tutorialText;
|
private @FXML Label tutorialText;
|
||||||
|
private @FXML AnchorPane infoWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a specified race.
|
* Displays a specified race.
|
||||||
@@ -125,7 +127,7 @@ public class RaceViewController extends Controller {
|
|||||||
* Sets up the listener and actions that occur when a key is pressed.
|
* Sets up the listener and actions that occur when a key is pressed.
|
||||||
*/
|
*/
|
||||||
private void initKeypressHandler() {
|
private void initKeypressHandler() {
|
||||||
racePane.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
|
newRacePane.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
|
||||||
String codeString = event.getCode().toString();
|
String codeString = event.getCode().toString();
|
||||||
|
|
||||||
// tab key
|
// tab key
|
||||||
@@ -255,7 +257,7 @@ public class RaceViewController extends Controller {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Bind zooming to keypress (Z/X default)
|
// Bind zooming to keypress (Z/X default)
|
||||||
racePane.addEventFilter(KeyEvent.KEY_PRESSED, e -> {
|
newRacePane.addEventFilter(KeyEvent.KEY_PRESSED, e -> {
|
||||||
ControlKey key = keyFactory.getKey(e.getCode().toString());
|
ControlKey key = keyFactory.getKey(e.getCode().toString());
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
switch (key.toString()) {
|
switch (key.toString()) {
|
||||||
@@ -442,23 +444,7 @@ public class RaceViewController extends Controller {
|
|||||||
* toggles if the info table is shown
|
* toggles if the info table is shown
|
||||||
*/
|
*/
|
||||||
private void toggleTable() {
|
private void toggleTable() {
|
||||||
double tablePercent = 1 - (boatPlacingColumn.getPrefWidth() +
|
infoWrapper.setVisible(infoTableShow);
|
||||||
boatTeamColumn.getPrefWidth() + boatMarkColumn.getPrefWidth()
|
|
||||||
+ boatSpeedColumn.getPrefWidth())/racePane.getWidth();
|
|
||||||
|
|
||||||
if (infoTableShow) {
|
|
||||||
racePane.setDividerPositions(tablePercent);
|
|
||||||
arrowPane.setScaleX(0.5);
|
|
||||||
arrowPane.setScaleY(0.5);
|
|
||||||
arrowPane.setTranslateX(0 + (arrowPane.getScene().getWidth()/4)*tablePercent);
|
|
||||||
arrowPane.setTranslateY(0 - arrowPane.getScene().getHeight()/4);
|
|
||||||
} else {
|
|
||||||
racePane.setDividerPositions(1);
|
|
||||||
arrowPane.setScaleX(1);
|
|
||||||
arrowPane.setScaleY(1);
|
|
||||||
arrowPane.setTranslateX(0);
|
|
||||||
arrowPane.setTranslateY(0);
|
|
||||||
}
|
|
||||||
boatInfoTable.refresh();
|
boatInfoTable.refresh();
|
||||||
infoTableShow = !infoTableShow;
|
infoTableShow = !infoTableShow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.chart.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import javafx.scene.chart.LineChart?>
|
||||||
|
<?import javafx.scene.chart.NumberAxis?>
|
||||||
<?import javafx.scene.control.Accordion?>
|
<?import javafx.scene.control.Accordion?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.CheckBox?>
|
<?import javafx.scene.control.CheckBox?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.control.RadioButton?>
|
<?import javafx.scene.control.RadioButton?>
|
||||||
<?import javafx.scene.control.Separator?>
|
<?import javafx.scene.control.Separator?>
|
||||||
|
<?import javafx.scene.control.SplitPane?>
|
||||||
<?import javafx.scene.control.TableColumn?>
|
<?import javafx.scene.control.TableColumn?>
|
||||||
<?import javafx.scene.control.TableView?>
|
<?import javafx.scene.control.TableView?>
|
||||||
<?import javafx.scene.control.TitledPane?>
|
<?import javafx.scene.control.TitledPane?>
|
||||||
@@ -19,7 +28,11 @@
|
|||||||
<?import javafx.scene.layout.StackPane?>
|
<?import javafx.scene.layout.StackPane?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="364.0" prefWidth="522.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceViewController">
|
<AnchorPane fx:id="newRacePane" prefHeight="431.0" prefWidth="610.0" visible="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceViewController">
|
||||||
|
<children>
|
||||||
|
<StackPane fx:id="newPane" prefHeight="150.0" prefWidth="200.0">
|
||||||
|
<children>
|
||||||
|
<AnchorPane>
|
||||||
<children>
|
<children>
|
||||||
<GridPane fx:id="canvasBase" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane fx:id="canvasBase" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
@@ -96,9 +109,22 @@
|
|||||||
</children>
|
</children>
|
||||||
</StackPane>
|
</StackPane>
|
||||||
<Label fx:id="tutorialText" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" style="-fx-border-color: orange; -fx-border-radius: 5px; -fx-background-color: #ffffcc; -fx-text-fill: #3399ff; -fx-border-width: 3; -fx-border-insets: -3;" text="This is the tutorial text" visible="false" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="150.0" AnchorPane.topAnchor="100.0" />
|
<Label fx:id="tutorialText" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" style="-fx-border-color: orange; -fx-border-radius: 5px; -fx-background-color: #ffffcc; -fx-text-fill: #3399ff; -fx-border-width: 3; -fx-border-insets: -3;" text="This is the tutorial text" visible="false" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="150.0" AnchorPane.topAnchor="100.0" />
|
||||||
<AnchorPane layoutX="450.0" maxWidth="475.0" minHeight="0.0" minWidth="472.0" prefHeight="224.0" prefWidth="472.0" AnchorPane.bottomAnchor="70.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="30.0" AnchorPane.topAnchor="70.0" GridPane.columnIndex="1">
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
</children>
|
||||||
|
</StackPane>
|
||||||
|
<AnchorPane fx:id="infoWrapper" layoutX="450.0" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" visible="false" AnchorPane.bottomAnchor="20.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="20.0" AnchorPane.topAnchor="20.0" GridPane.columnIndex="1">
|
||||||
<children>
|
<children>
|
||||||
<TableView fx:id="boatInfoTable" layoutX="-2.0" minWidth="475.0" prefHeight="265.0" prefWidth="475.0" AnchorPane.bottomAnchor="164.0" AnchorPane.topAnchor="0.0">
|
<GridPane layoutX="50.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints maxHeight="369.0" minHeight="10.0" prefHeight="228.0" vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints maxHeight="250.0" minHeight="10.0" prefHeight="163.0" vgrow="SOMETIMES" />
|
||||||
|
</rowConstraints>
|
||||||
|
<children>
|
||||||
|
<TableView fx:id="boatInfoTable" layoutX="-2.0" maxWidth="475.0" minWidth="475.0" prefWidth="475.0" AnchorPane.bottomAnchor="126.0" AnchorPane.leftAnchor="50.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="0.0" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
|
||||||
<columns>
|
<columns>
|
||||||
<TableColumn fx:id="boatPlacingColumn" prefWidth="50.0" text="Place" />
|
<TableColumn fx:id="boatPlacingColumn" prefWidth="50.0" text="Place" />
|
||||||
<TableColumn fx:id="boatTeamColumn" prefWidth="200.0" text="Team" />
|
<TableColumn fx:id="boatTeamColumn" prefWidth="200.0" text="Team" />
|
||||||
@@ -106,7 +132,7 @@
|
|||||||
<TableColumn fx:id="boatSpeedColumn" prefWidth="75.0" text="Speed" />
|
<TableColumn fx:id="boatSpeedColumn" prefWidth="75.0" text="Speed" />
|
||||||
</columns>
|
</columns>
|
||||||
</TableView>
|
</TableView>
|
||||||
<AnchorPane layoutY="265.0" prefHeight="167.0" prefWidth="178.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
|
<AnchorPane prefHeight="167.0" prefWidth="178.0" GridPane.rowIndex="1">
|
||||||
<children>
|
<children>
|
||||||
<LineChart fx:id="sparklineChart" layoutX="-211.0" layoutY="-186.0" mouseTransparent="true" prefHeight="167.0" prefWidth="178.0" titleSide="LEFT" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<LineChart fx:id="sparklineChart" layoutX="-211.0" layoutY="-186.0" mouseTransparent="true" prefHeight="167.0" prefWidth="178.0" titleSide="LEFT" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<xAxis>
|
<xAxis>
|
||||||
@@ -119,6 +145,8 @@
|
|||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</children>
|
</children>
|
||||||
|
</GridPane>
|
||||||
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|||||||
Reference in New Issue
Block a user