mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Updated wind direction on race view controller so it responds to the stream.
#story[818]
This commit is contained in:
@@ -69,11 +69,11 @@ public class RaceViewController extends Thread{
|
||||
includedCanvasController.initializeCanvas();
|
||||
initializeTimer();
|
||||
initializeSettings();
|
||||
|
||||
initialiseWindDirection();
|
||||
//set wind direction!!!!!!! can't find another place to put my code --haoming
|
||||
double windDirection = new ConfigParser("/config/config.xml").getWindDirection();
|
||||
windDirectionText.setText(String.format("%.1f°", windDirection));
|
||||
windArrowText.setRotate(windDirection);
|
||||
// double windDirection = new ConfigParser("/config/config.xml").getWindDirection();
|
||||
// windDirectionText.setText(String.format("%.1f°", windDirection));
|
||||
// windArrowText.setRotate(windDirection);
|
||||
includedCanvasController.timer.start();
|
||||
}
|
||||
|
||||
@@ -145,6 +145,19 @@ public class RaceViewController extends Thread{
|
||||
timerTimeline.playFromStart();
|
||||
}
|
||||
|
||||
private void initialiseWindDirection() {
|
||||
Timeline windDirTimeline = new Timeline();
|
||||
windDirTimeline.setCycleCount(Timeline.INDEFINITE);
|
||||
windDirTimeline.getKeyFrames().add(
|
||||
new KeyFrame(Duration.seconds(1),
|
||||
event -> {
|
||||
windDirectionText.setText(String.format("%.1f°", StreamParser.getWindDirection()));
|
||||
windArrowText.setRotate(StreamParser.getWindDirection());
|
||||
})
|
||||
);
|
||||
windDirTimeline.playFromStart();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates time line for each boat, and stores time time into timelineInfos hash map
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user