Layout changes to speedometer UI. #story[1311]
This commit is contained in:
@@ -2,6 +2,7 @@ package visualiser.Controllers;
|
|||||||
|
|
||||||
import com.interactivemesh.jfx.importer.stl.StlMeshImporter;
|
import com.interactivemesh.jfx.importer.stl.StlMeshImporter;
|
||||||
import eu.hansolo.medusa.*;
|
import eu.hansolo.medusa.*;
|
||||||
|
import eu.hansolo.medusa.events.UpdateEvent;
|
||||||
import javafx.animation.AnimationTimer;
|
import javafx.animation.AnimationTimer;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
@@ -97,6 +98,7 @@ public class RaceViewController extends Controller {
|
|||||||
private @FXML AnchorPane infoWrapper;
|
private @FXML AnchorPane infoWrapper;
|
||||||
private @FXML AnchorPane lineChartWrapper;
|
private @FXML AnchorPane lineChartWrapper;
|
||||||
private @FXML StackPane speedPane;
|
private @FXML StackPane speedPane;
|
||||||
|
private @FXML AnchorPane raceAnchorPane;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a specified race.
|
* Displays a specified race.
|
||||||
@@ -106,6 +108,7 @@ public class RaceViewController extends Controller {
|
|||||||
* @param isHost is user a host
|
* @param isHost is user a host
|
||||||
*/
|
*/
|
||||||
public void startRace(VisualiserRaceEvent visualiserRace, ControllerClient controllerClient, Boolean isHost) {
|
public void startRace(VisualiserRaceEvent visualiserRace, ControllerClient controllerClient, Boolean isHost) {
|
||||||
|
|
||||||
this.visualiserRace = visualiserRace;
|
this.visualiserRace = visualiserRace;
|
||||||
this.raceState = visualiserRace.getVisualiserRaceState();
|
this.raceState = visualiserRace.getVisualiserRaceState();
|
||||||
this.controllerClient = controllerClient;
|
this.controllerClient = controllerClient;
|
||||||
@@ -208,7 +211,7 @@ public class RaceViewController extends Controller {
|
|||||||
* Create speedometer
|
* Create speedometer
|
||||||
*/
|
*/
|
||||||
private void initialiseSpeedometer() {
|
private void initialiseSpeedometer() {
|
||||||
gauge = GaugeBuilder.create().title("Speedometer").subTitle("Speed").unit("Knots").skinType(Gauge.SkinType.FLAT).build();
|
gauge = GaugeBuilder.create().prefSize(200, 200).title("Speedometer").subTitle("Speed").unit("Knots").skinType(Gauge.SkinType.FLAT).build();
|
||||||
gauge.setValueColor(Color.WHITE);
|
gauge.setValueColor(Color.WHITE);
|
||||||
gauge.setTitleColor(Color.WHITE);
|
gauge.setTitleColor(Color.WHITE);
|
||||||
gauge.setSubTitleColor(Color.WHITE);
|
gauge.setSubTitleColor(Color.WHITE);
|
||||||
@@ -216,6 +219,7 @@ public class RaceViewController extends Controller {
|
|||||||
gauge.setUnitColor(Color.WHITE);
|
gauge.setUnitColor(Color.WHITE);
|
||||||
gauge.setMaxValue(40);
|
gauge.setMaxValue(40);
|
||||||
fGauge = FGaugeBuilder.create()
|
fGauge = FGaugeBuilder.create()
|
||||||
|
.prefSize(200, 200)
|
||||||
.gauge(gauge)
|
.gauge(gauge)
|
||||||
.gaugeDesign(GaugeDesign.METAL)
|
.gaugeDesign(GaugeDesign.METAL)
|
||||||
.gaugeBackground(GaugeDesign.GaugeBackground.CARBON)
|
.gaugeBackground(GaugeDesign.GaugeBackground.CARBON)
|
||||||
@@ -642,6 +646,11 @@ public class RaceViewController extends Controller {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
gauge.setValue(raceState.getBoat(raceState.getPlayerBoatID()).getCurrentSpeed());
|
gauge.setValue(raceState.getBoat(raceState.getPlayerBoatID()).getCurrentSpeed());
|
||||||
|
for (VisualiserBoat boat : boatInfoTable.getItems()){
|
||||||
|
if(raceState.getPlayerBoatID()==boat.getSourceID()){
|
||||||
|
gauge.setTitle("Position: " + boatInfoTable.getItems().indexOf(boat)+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (BoatNotFoundException e) {
|
} catch (BoatNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<items>
|
<items>
|
||||||
<StackPane fx:id="newPane" prefHeight="150.0" prefWidth="200.0">
|
<StackPane fx:id="newPane" prefHeight="150.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
<AnchorPane focusTraversable="true">
|
<AnchorPane fx:id="raceAnchorPane" focusTraversable="true">
|
||||||
<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>
|
||||||
@@ -109,7 +109,10 @@
|
|||||||
</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" />
|
||||||
<StackPane fx:id="speedPane" prefHeight="150.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
<StackPane fx:id="speedPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="20.0">
|
||||||
|
<padding>
|
||||||
|
<Insets right="20.0" />
|
||||||
|
</padding></StackPane>
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
<AnchorPane fx:id="infoWrapper" focusTraversable="true" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" visible="false">
|
<AnchorPane fx:id="infoWrapper" focusTraversable="true" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" visible="false">
|
||||||
|
|||||||
Reference in New Issue
Block a user