Added delay for position update. This fixes fps issue. #story[1311]

main
zwu18 8 years ago
parent 0b02727bf1
commit 64ae01113a

@ -71,6 +71,8 @@ public class RaceViewController extends Controller {
private ObservableList<Subject3D> viewSubjects; private ObservableList<Subject3D> viewSubjects;
private Gauge gauge; private Gauge gauge;
private FGauge fGauge; private FGauge fGauge;
private long positionDelay = 1000;
private long positionTime = 0;
/** /**
* Arrow pointing to next mark in third person * Arrow pointing to next mark in third person
@ -762,12 +764,14 @@ public class RaceViewController extends Controller {
try { try {
gauge.setValue(raceState.getBoat(raceState.getPlayerBoatID()).getCurrentSpeed()); gauge.setValue(raceState.getBoat(raceState.getPlayerBoatID()).getCurrentSpeed());
fGauge.getGauge().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()){ for (VisualiserBoat boat : boatInfoTable.getItems()) {
if(raceState.getPlayerBoatID()==boat.getSourceID()){ if (raceState.getPlayerBoatID() == boat.getSourceID()) {
gauge.setTitle("Position: " + (boatInfoTable.getItems().indexOf(boat)+1)); gauge.setTitle("Position: " + (boatInfoTable.getItems().indexOf(boat) + 1));
fGauge.getGauge().setTitle("Position: " + (boatInfoTable.getItems().indexOf(boat)+1)); fGauge.getGauge().setTitle("Position: " + (boatInfoTable.getItems().indexOf(boat) + 1));
}
} }
positionTime = System.currentTimeMillis();
} }
} catch (BoatNotFoundException e) { } catch (BoatNotFoundException e) {
e.printStackTrace(); e.printStackTrace();

Loading…
Cancel
Save