Added delay for position update. This fixes fps issue. #story[1311]
This commit is contained in:
@@ -71,6 +71,8 @@ public class RaceViewController extends Controller {
|
||||
private ObservableList<Subject3D> viewSubjects;
|
||||
private Gauge gauge;
|
||||
private FGauge fGauge;
|
||||
private long positionDelay = 1000;
|
||||
private long positionTime = 0;
|
||||
|
||||
/**
|
||||
* Arrow pointing to next mark in third person
|
||||
@@ -762,13 +764,15 @@ public class RaceViewController extends Controller {
|
||||
try {
|
||||
gauge.setValue(raceState.getBoat(raceState.getPlayerBoatID()).getCurrentSpeed());
|
||||
fGauge.getGauge().setValue(raceState.getBoat(raceState.getPlayerBoatID()).getCurrentSpeed());
|
||||
//Thread.sleep(50);
|
||||
if(System.currentTimeMillis() > positionTime+positionDelay) {
|
||||
for (VisualiserBoat boat : boatInfoTable.getItems()) {
|
||||
if (raceState.getPlayerBoatID() == boat.getSourceID()) {
|
||||
gauge.setTitle("Position: " + (boatInfoTable.getItems().indexOf(boat) + 1));
|
||||
fGauge.getGauge().setTitle("Position: " + (boatInfoTable.getItems().indexOf(boat) + 1));
|
||||
}
|
||||
}
|
||||
positionTime = System.currentTimeMillis();
|
||||
}
|
||||
} catch (BoatNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user