Merge branch 'Development' into new_issue#19
# Conflicts: # racevisionGame/src/main/java/visualiser/Controllers/RaceController.java # racevisionGame/src/main/java/visualiser/app/App.java
This commit is contained in:
@@ -65,6 +65,11 @@ public class RaceController extends Controller {
|
||||
*/
|
||||
private Sparkline sparkline;
|
||||
|
||||
/**
|
||||
* state of the info table
|
||||
*/
|
||||
private boolean infoTableShow;
|
||||
|
||||
/**
|
||||
* The arrow controller.
|
||||
*/
|
||||
@@ -109,10 +114,14 @@ public class RaceController extends Controller {
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
KeyFactory keyFactory = KeyFactory.getFactory();
|
||||
infoTableShow = true;
|
||||
|
||||
// Initialise keyboard handler
|
||||
race.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
|
||||
String codeString = event.getCode().toString();
|
||||
|
||||
if (codeString.equals("TAB")){toggleTable();}
|
||||
|
||||
ControlKey controlKey = keyFactory.getKey(codeString);
|
||||
if(controlKey != null) {
|
||||
try {
|
||||
@@ -473,4 +482,23 @@ public class RaceController extends Controller {
|
||||
}.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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import javafx.scene.control.Button;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.Modality;
|
||||
import javafx.stage.Stage;
|
||||
import visualiser.app.App;
|
||||
|
||||
@@ -82,4 +83,25 @@ public class TitleController extends Controller {
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when control button is pressed. New pop up window displaying controls
|
||||
*/
|
||||
public void controlBtnPressed(){
|
||||
FXMLLoader loader = new FXMLLoader();
|
||||
loader.setLocation(getClass().getResource("/visualiser/scenes/controls.fxml"));
|
||||
Parent layout;
|
||||
try {
|
||||
layout = loader.load();
|
||||
Scene scene = new Scene(layout);
|
||||
Stage popupStage = new Stage();
|
||||
popupStage.setTitle("Game Controls");
|
||||
popupStage.initModality(Modality.WINDOW_MODAL);
|
||||
popupStage.setScene(scene);
|
||||
popupStage.showAndWait();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user