|
|
|
@ -10,7 +10,6 @@ import javafx.collections.transformation.SortedList;
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
import javafx.scene.chart.LineChart;
|
|
|
|
import javafx.scene.chart.LineChart;
|
|
|
|
import javafx.scene.control.*;
|
|
|
|
import javafx.scene.control.*;
|
|
|
|
import javafx.scene.control.Label;
|
|
|
|
|
|
|
|
import javafx.scene.input.KeyEvent;
|
|
|
|
import javafx.scene.input.KeyEvent;
|
|
|
|
import javafx.scene.layout.AnchorPane;
|
|
|
|
import javafx.scene.layout.AnchorPane;
|
|
|
|
import javafx.scene.layout.GridPane;
|
|
|
|
import javafx.scene.layout.GridPane;
|
|
|
|
@ -23,7 +22,6 @@ import visualiser.gameController.ControllerClient;
|
|
|
|
import visualiser.gameController.Keys.ControlKey;
|
|
|
|
import visualiser.gameController.Keys.ControlKey;
|
|
|
|
import visualiser.gameController.Keys.KeyFactory;
|
|
|
|
import visualiser.gameController.Keys.KeyFactory;
|
|
|
|
import visualiser.model.*;
|
|
|
|
import visualiser.model.*;
|
|
|
|
import visualiser.network.ServerConnection;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.util.ResourceBundle;
|
|
|
|
import java.util.ResourceBundle;
|
|
|
|
@ -62,6 +60,11 @@ public class RaceController extends Controller {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private Sparkline sparkline;
|
|
|
|
private Sparkline sparkline;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* state of the info table
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private boolean infoTableShow;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The arrow controller.
|
|
|
|
* The arrow controller.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -106,10 +109,14 @@ public class RaceController extends Controller {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void initialize(URL location, ResourceBundle resources) {
|
|
|
|
public void initialize(URL location, ResourceBundle resources) {
|
|
|
|
KeyFactory keyFactory = KeyFactory.getFactory();
|
|
|
|
KeyFactory keyFactory = KeyFactory.getFactory();
|
|
|
|
|
|
|
|
infoTableShow = true;
|
|
|
|
|
|
|
|
|
|
|
|
// Initialise keyboard handler
|
|
|
|
// Initialise keyboard handler
|
|
|
|
race.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
|
|
|
|
race.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
|
|
|
|
String codeString = event.getCode().toString();
|
|
|
|
String codeString = event.getCode().toString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (codeString.equals("TAB")){toggleTable();}
|
|
|
|
|
|
|
|
|
|
|
|
ControlKey controlKey = keyFactory.getKey(codeString);
|
|
|
|
ControlKey controlKey = keyFactory.getKey(codeString);
|
|
|
|
if(controlKey != null) {
|
|
|
|
if(controlKey != null) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
@ -437,4 +444,23 @@ public class RaceController extends Controller {
|
|
|
|
}.start();
|
|
|
|
}.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void toggleTable() {
|
|
|
|
|
|
|
|
if (infoTableShow){
|
|
|
|
|
|
|
|
race.setDividerPositions(0.4);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arrowPane.setScaleX(0.5);
|
|
|
|
|
|
|
|
arrowPane.setScaleY(0.5);
|
|
|
|
|
|
|
|
arrowPane.setTranslateX(0 + (arrowPane.getScene().getWidth()/4)*0.4);
|
|
|
|
|
|
|
|
arrowPane.setTranslateY(0 - arrowPane.getScene().getHeight()/4);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
race.setDividerPositions(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arrowPane.setScaleX(1);
|
|
|
|
|
|
|
|
arrowPane.setScaleY(1);
|
|
|
|
|
|
|
|
arrowPane.setTranslateX(0);
|
|
|
|
|
|
|
|
arrowPane.setTranslateY(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
infoTableShow = !infoTableShow;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|