Merge branch 'story86-3D' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into story86-3D

This commit is contained in:
Fan-Wu Yang
2017-08-29 20:36:15 +12:00
51 changed files with 189 additions and 2047 deletions
@@ -136,12 +136,8 @@ public class ArrowController {
* @param bearing The bearing to use to rotate arrow.
*/
private void updateWindBearing(Bearing bearing) {
//We need to display wind-from, so add 180 degrees.
Bearing fromBearing = Bearing.fromDegrees(bearing.degrees() + 180d);
//Rotate the wind arrow.
arrowStackPane.setRotate(fromBearing.degrees());
arrowStackPane.setRotate(bearing.degrees());
}
@@ -49,7 +49,6 @@ public class HostController extends Controller {
public void hostGamePressed() throws IOException{
try {
this.game = new Event(false);
game.start();
connectSocket("localhost", 4942);
} catch (EventConstructionException e) {
Logger.getGlobal().log(Level.SEVERE, "Could not create Event.", e);
@@ -1,12 +1,18 @@
package visualiser.Controllers;
import javafx.animation.AnimationTimer;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Group;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.RadioButton;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.shape.Box;
import javafx.scene.shape.CullFace;
import javafx.scene.transform.Rotate;
import javafx.stage.Modality;
import javafx.stage.Stage;
import visualiser.app.App;
@@ -32,6 +38,8 @@ public class TitleController extends Controller {
@FXML
RadioButton nightModeRD;
Group group3d;
/**
* Method called when the 'host a game' button is pressed.
* Opens the next window allowing a user to host their own game.
@@ -81,7 +89,31 @@ public class TitleController extends Controller {
@Override
public void initialize(URL location, ResourceBundle resources) {
System.out.println("Initializing...");
Box box = new Box(50,50,50);
box.setTranslateX(100);
box.setTranslateY(100);
box.setCullFace(CullFace.BACK);
Rotate ry = new Rotate(0, 0,0,0, Rotate.Y_AXIS);
Rotate rx = new Rotate(20, 0, 0, 0, Rotate.X_AXIS);
box.getTransforms().add(ry);
box.getTransforms().add(rx);
group3d = new Group(box);
titleWrapper.getChildren().add(0, group3d);
group3d.toFront();
AnimationTimer rotation = new AnimationTimer() {
@Override
public void handle(long now) {
ry.setAngle(ry.getAngle() + 0.1);
}
};
rotation.start();
}
/**
@@ -3,7 +3,6 @@ package visualiser.model;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Paint;
import javafx.scene.text.Font;
import javafx.scene.transform.Rotate;
@@ -13,7 +12,6 @@ import shared.enums.RoundingType;
import shared.model.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
@@ -735,6 +733,9 @@ public class ResizableRaceCanvas extends ResizableCanvas {
gc.save();
gc.setLineWidth(2);
gc.setStroke(Color.MEDIUMAQUAMARINE);
gc.beginPath();
gc.moveTo(startPath.getX(), startPath.getY());
gc.lineTo(endPath.getX(), endPath.getY());
@@ -68,13 +68,7 @@ public class VisualiserRaceService implements RunnableWithFramePeriod {
while (!Thread.interrupted()) {
long currentFrameTime = System.currentTimeMillis();
try {
waitForFramePeriod(previousFrameTime, currentFrameTime, 16);
} catch (Exception e) {
e.printStackTrace();
}
waitForFramePeriod(previousFrameTime, currentFrameTime, 16);
previousFrameTime = currentFrameTime;
@@ -330,11 +330,8 @@ public class ServerConnection implements RunnableWithFramePeriod {
while (!Thread.interrupted()) {
long currentFrameTime = System.currentTimeMillis();
try {
waitForFramePeriod(previousFrameTime, currentFrameTime, 100);
} catch (Exception e) {
e.printStackTrace();
}
waitForFramePeriod(previousFrameTime, currentFrameTime, 100);
previousFrameTime = currentFrameTime;