Added toggle for fps #story[463]

This commit is contained in:
Peter
2017-03-27 16:45:02 +13:00
parent 65ac864bf2
commit 6fc55bb82c
2 changed files with 17 additions and 7 deletions
@@ -45,7 +45,7 @@ public class CanvasController {
@FXML
private BoatPositionController teamPositionsController;
@FXML
private CheckBox toggleAnnotation;
private CheckBox toggleAnnotation, toggleFps;
private Race race;
private GraphicsContext gc;
@@ -61,6 +61,7 @@ public class CanvasController {
private final int SCALE = 16000;
private boolean annotationCheck = true;
private boolean displayFps = true;
///test
private HashSet<Integer> headingTest = new HashSet<>();
@@ -149,6 +150,12 @@ public class CanvasController {
annotationCheck = !annotationCheck;
}
});
toggleFps.selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
displayFps = !displayFps;
}
});
//set wind direction!!!!!!! can't find another place to put my code --haoming
double windDirection = new ConfigParser("/config.xml").getWindDirection();
@@ -267,10 +274,12 @@ public class CanvasController {
}
private void drawFps(int fps){
gc.setFill(Color.BLACK);
gc.setFont(new Font(14));
gc.setLineWidth(3);
gc.fillText(fps + " FPS", 5, 20);
if (displayFps){
gc.setFill(Color.BLACK);
gc.setFont(new Font(14));
gc.setLineWidth(3);
gc.fillText(fps + " FPS", 5, 20);
}
}
/**