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 eu.hansolo.medusa.*;
|
||||
import eu.hansolo.medusa.events.UpdateEvent;
|
||||
import javafx.animation.AnimationTimer;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
@@ -97,6 +98,7 @@ public class RaceViewController extends Controller {
|
||||
private @FXML AnchorPane infoWrapper;
|
||||
private @FXML AnchorPane lineChartWrapper;
|
||||
private @FXML StackPane speedPane;
|
||||
private @FXML AnchorPane raceAnchorPane;
|
||||
|
||||
/**
|
||||
* Displays a specified race.
|
||||
@@ -106,6 +108,7 @@ public class RaceViewController extends Controller {
|
||||
* @param isHost is user a host
|
||||
*/
|
||||
public void startRace(VisualiserRaceEvent visualiserRace, ControllerClient controllerClient, Boolean isHost) {
|
||||
|
||||
this.visualiserRace = visualiserRace;
|
||||
this.raceState = visualiserRace.getVisualiserRaceState();
|
||||
this.controllerClient = controllerClient;
|
||||
@@ -208,7 +211,7 @@ public class RaceViewController extends Controller {
|
||||
* Create speedometer
|
||||
*/
|
||||
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.setTitleColor(Color.WHITE);
|
||||
gauge.setSubTitleColor(Color.WHITE);
|
||||
@@ -216,6 +219,7 @@ public class RaceViewController extends Controller {
|
||||
gauge.setUnitColor(Color.WHITE);
|
||||
gauge.setMaxValue(40);
|
||||
fGauge = FGaugeBuilder.create()
|
||||
.prefSize(200, 200)
|
||||
.gauge(gauge)
|
||||
.gaugeDesign(GaugeDesign.METAL)
|
||||
.gaugeBackground(GaugeDesign.GaugeBackground.CARBON)
|
||||
@@ -642,6 +646,11 @@ public class RaceViewController extends Controller {
|
||||
|
||||
try {
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<items>
|
||||
<StackPane fx:id="newPane" prefHeight="150.0" prefWidth="200.0">
|
||||
<children>
|
||||
<AnchorPane focusTraversable="true">
|
||||
<AnchorPane fx:id="raceAnchorPane" focusTraversable="true">
|
||||
<children>
|
||||
<GridPane fx:id="canvasBase" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<columnConstraints>
|
||||
@@ -109,7 +109,10 @@
|
||||
</children>
|
||||
</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" />
|
||||
<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>
|
||||
</AnchorPane>
|
||||
<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