Merge branch 'story27' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into story27
This commit is contained in:
@@ -25,10 +25,8 @@ public class App extends Application {
|
|||||||
|
|
||||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/scenes/main.fxml"));
|
FXMLLoader loader = new FXMLLoader(getClass().getResource("/scenes/main.fxml"));
|
||||||
Parent root = loader.load();
|
Parent root = loader.load();
|
||||||
Scene scene = new Scene(root, 1050, 835);
|
Scene scene = new Scene(root, 1200, 800);
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setMinHeight(800);
|
|
||||||
stage.setMinWidth(1200);
|
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ import java.util.ResourceBundle;
|
|||||||
* Created by fwy13 on 15/03/2017.
|
* Created by fwy13 on 15/03/2017.
|
||||||
*/
|
*/
|
||||||
public abstract class Controller implements Initializable {
|
public abstract class Controller implements Initializable {
|
||||||
protected Controller parent;
|
protected MainController parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the parent of the application
|
* Sets the parent of the application
|
||||||
*
|
*
|
||||||
* @param parent controller
|
* @param parent controller
|
||||||
*/
|
*/
|
||||||
public void setParent(Controller parent) {
|
public void setParent(MainController parent) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ public class MainController extends Controller {
|
|||||||
@FXML RaceController raceController;
|
@FXML RaceController raceController;
|
||||||
|
|
||||||
|
|
||||||
|
public void beginRace(int scaleFactor) {
|
||||||
|
raceController.startRace(scaleFactor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,11 +25,7 @@ public class RaceController extends Controller {
|
|||||||
GridPane canvasBase;
|
GridPane canvasBase;
|
||||||
|
|
||||||
ResizableRaceCanvas raceMap;
|
ResizableRaceCanvas raceMap;
|
||||||
|
@FXML SplitPane race;
|
||||||
@FXML
|
|
||||||
GridPane startScreen;
|
|
||||||
@FXML
|
|
||||||
SplitPane racepane;
|
|
||||||
@FXML
|
@FXML
|
||||||
CheckBox showFPS;
|
CheckBox showFPS;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -99,7 +95,7 @@ public class RaceController extends Controller {
|
|||||||
*
|
*
|
||||||
* @param scaleFactor scale value of race
|
* @param scaleFactor scale value of race
|
||||||
*/
|
*/
|
||||||
private void startRace(int scaleFactor) {
|
public void startRace(int scaleFactor) {
|
||||||
RaceXMLReader raceXMLReader = null;
|
RaceXMLReader raceXMLReader = null;
|
||||||
try {
|
try {
|
||||||
raceXMLReader = new RaceXMLReader("raceXML/bermuda_AC35.xml");
|
raceXMLReader = new RaceXMLReader("raceXML/bermuda_AC35.xml");
|
||||||
@@ -120,12 +116,12 @@ public class RaceController extends Controller {
|
|||||||
|
|
||||||
|
|
||||||
ArrayList<Leg> legs = raceXMLReader.getLegs();
|
ArrayList<Leg> legs = raceXMLReader.getLegs();
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(boats, legs, this, scaleFactor);
|
ConstantVelocityRace newRace = new ConstantVelocityRace(boats, legs, this, scaleFactor);
|
||||||
race.initialiseBoats();
|
newRace.initialiseBoats();
|
||||||
|
|
||||||
BoatInRace[] startingBoats = new BoatInRace[race.getStartingBoats().size()];
|
BoatInRace[] startingBoats = new BoatInRace[newRace.getStartingBoats().size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (BoatInRace boat : race.getStartingBoats()) {
|
for (BoatInRace boat : newRace.getStartingBoats()) {
|
||||||
startingBoats[i] = boat;
|
startingBoats[i] = boat;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -140,14 +136,13 @@ public class RaceController extends Controller {
|
|||||||
raceMap.setVisible(true);
|
raceMap.setVisible(true);
|
||||||
|
|
||||||
canvasBase.getChildren().add(raceMap);
|
canvasBase.getChildren().add(raceMap);
|
||||||
startScreen.setVisible(false);
|
race.setVisible(true);
|
||||||
racepane.setVisible(true);
|
|
||||||
|
|
||||||
|
|
||||||
initializeFPS();
|
initializeFPS();
|
||||||
initializeAnnotations();
|
initializeAnnotations();
|
||||||
|
|
||||||
new Thread((race)).start();
|
new Thread((newRace)).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package seng302.Controllers;
|
package seng302.Controllers;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
@@ -8,6 +11,7 @@ import java.util.ResourceBundle;
|
|||||||
*/
|
*/
|
||||||
public class StartController extends Controller {
|
public class StartController extends Controller {
|
||||||
|
|
||||||
|
@FXML private GridPane start;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Begins the race with a scale factor of 15
|
* Begins the race with a scale factor of 15
|
||||||
@@ -31,7 +35,8 @@ public class StartController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startRace(Integer raceScale){
|
private void startRace(Integer raceScale){
|
||||||
|
start.setVisible(false);
|
||||||
|
parent.beginRace(raceScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -39,5 +44,4 @@ public class StartController extends Controller {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user