Added ArrowController. This is the controller for arrow.fxml.
Removed arrow control stuff from ResizableRaceCanvas. Added a wind speed label to arrow.fxml. Also created an outer GridPane to lay things out. #story[1093]
This commit is contained in:
@@ -5,7 +5,6 @@ import javafx.animation.AnimationTimer;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.chart.LineChart;
|
||||
import javafx.scene.control.*;
|
||||
@@ -24,10 +23,8 @@ import visualiser.gameController.Keys.ControlKey;
|
||||
import visualiser.gameController.Keys.KeyFactory;
|
||||
import visualiser.model.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
@@ -60,6 +57,11 @@ public class RaceController extends Controller {
|
||||
*/
|
||||
private Sparkline sparkline;
|
||||
|
||||
/**
|
||||
* The arrow controller.
|
||||
*/
|
||||
@FXML private ArrowController arrowController;
|
||||
|
||||
/**
|
||||
* Service for sending keystrokes to server
|
||||
*/
|
||||
@@ -67,8 +69,18 @@ public class RaceController extends Controller {
|
||||
|
||||
|
||||
@FXML private GridPane canvasBase;
|
||||
@FXML private Pane arrow;
|
||||
|
||||
|
||||
@FXML private SplitPane race;
|
||||
|
||||
/**
|
||||
* This is the root node of the arrow control.
|
||||
*/
|
||||
@FXML private Pane arrow;
|
||||
|
||||
/**
|
||||
* This is the pane we place the actual arrow control inside of.
|
||||
*/
|
||||
@FXML private StackPane arrowPane;
|
||||
@FXML private Label timer;
|
||||
@FXML private Label FPS;
|
||||
@@ -118,15 +130,15 @@ public class RaceController extends Controller {
|
||||
//Fps display.
|
||||
initialiseFps(this.visualiserRace);
|
||||
|
||||
//Need to add the included arrow pane to the arrowPane container.
|
||||
initialiseArrow();
|
||||
|
||||
//Information table.
|
||||
initialiseInfoTable(this.visualiserRace);
|
||||
|
||||
//Sparkline.
|
||||
initialiseSparkline(this.visualiserRace);
|
||||
|
||||
//Arrow.
|
||||
initialiseArrow(this.visualiserRace);
|
||||
|
||||
//Race canvas.
|
||||
initialiseRaceCanvas(this.visualiserRace);
|
||||
|
||||
@@ -294,7 +306,7 @@ public class RaceController extends Controller {
|
||||
private void initialiseRaceCanvas(VisualiserRace race) {
|
||||
|
||||
//Create canvas.
|
||||
raceCanvas = new ResizableRaceCanvas(race, arrow.getChildren().get(0));
|
||||
raceCanvas = new ResizableRaceCanvas(race);
|
||||
|
||||
//Set properties.
|
||||
raceCanvas.setMouseTransparent(true);
|
||||
@@ -367,10 +379,10 @@ public class RaceController extends Controller {
|
||||
|
||||
|
||||
/**
|
||||
* Adds the included arrow pane (see arrow.fxml) to the arrowPane (see race.fxml).
|
||||
* Initialises the arrow controller with data from the race to observe.
|
||||
*/
|
||||
private void initialiseArrow() {
|
||||
arrowPane.getChildren().add(arrow);
|
||||
private void initialiseArrow(VisualiserRace race) {
|
||||
arrowController.setWindProperty(race.windProperty());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user