Created new start screen and implemented switching from start to race map
#implement #story[16]
This commit is contained in:
@@ -12,6 +12,7 @@ import javafx.scene.control.TableColumn;
|
|||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.util.Callback;
|
import javafx.util.Callback;
|
||||||
import org.geotools.referencing.GeodeticCalculator;
|
import org.geotools.referencing.GeodeticCalculator;
|
||||||
@@ -33,6 +34,9 @@ public class RaceController extends Controller{
|
|||||||
@FXML
|
@FXML
|
||||||
AnchorPane canvasBase;
|
AnchorPane canvasBase;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
GridPane startScreen;
|
||||||
|
|
||||||
ResizableRaceCanvas raceMap;
|
ResizableRaceCanvas raceMap;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@@ -80,8 +84,9 @@ public class RaceController extends Controller{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
@FXML
|
||||||
|
public void startRace() {
|
||||||
|
|
||||||
BoatInRace[] boats = generateAC35Competitors();
|
BoatInRace[] boats = generateAC35Competitors();
|
||||||
|
|
||||||
@@ -92,13 +97,22 @@ public class RaceController extends Controller{
|
|||||||
raceMap.drawRaceMap();
|
raceMap.drawRaceMap();
|
||||||
|
|
||||||
canvasBase.getChildren().add(raceMap);
|
canvasBase.getChildren().add(raceMap);
|
||||||
|
startScreen.setVisible(false);
|
||||||
|
|
||||||
ArrayList<Leg> legs = generateBermudaCourseLegs();
|
ArrayList<Leg> legs = generateBermudaCourseLegs();
|
||||||
ConstantVelocityRace race = new ConstantVelocityRace(boats, legs, this);
|
ConstantVelocityRace race = new ConstantVelocityRace(boats, legs, this);
|
||||||
|
raceMap.setVisible(true);
|
||||||
(new Thread(race)).start();
|
(new Thread(race)).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function for the Bermuda Race.
|
* Function for the Bermuda Race.
|
||||||
* @return legs in the Bermuda Race.
|
* @return legs in the Bermuda Race.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
<?import javafx.scene.canvas.*?>
|
<?import javafx.scene.canvas.*?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import java.lang.*?>
|
<?import java.lang.*?>
|
||||||
@@ -9,13 +10,28 @@
|
|||||||
<children>
|
<children>
|
||||||
<SplitPane dividerPositions="0.65" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<SplitPane dividerPositions="0.65" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<items>
|
<items>
|
||||||
<AnchorPane fx:id="canvasBase">
|
<AnchorPane fx:id="canvasBase" prefHeight="581.0" prefWidth="537.0">
|
||||||
<children>
|
<children>
|
||||||
<Label fx:id="timer" layoutX="45.0" layoutY="146.0" text="0:0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
<Label fx:id="timer" layoutX="45.0" layoutY="146.0" text="0:0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||||
|
<GridPane fx:id="startScreen" prefHeight="600.0" prefWidth="780.0">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints maxHeight="241.0" minHeight="10.0" prefHeight="215.0" vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints maxHeight="213.0" minHeight="10.0" prefHeight="213.0" vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
|
</rowConstraints>
|
||||||
|
<children>
|
||||||
|
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Select Your Race Duration" />
|
||||||
|
<Button mnemonicParsing="false" onAction="#startRace" text="1 min" GridPane.rowIndex="1" />
|
||||||
|
</children>
|
||||||
|
</GridPane>
|
||||||
</children></AnchorPane>
|
</children></AnchorPane>
|
||||||
<AnchorPane layoutX="450.0" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" GridPane.columnIndex="1">
|
<AnchorPane layoutX="450.0" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||||
<children>
|
<children>
|
||||||
<TableView fx:id="boatInfoTable" prefHeight="400.0" prefWidth="300.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<TableView fx:id="boatInfoTable" layoutX="-2.0" prefHeight="600.0" prefWidth="264.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="-2.0" AnchorPane.rightAnchor="-62.0" AnchorPane.topAnchor="0.0">
|
||||||
<columns>
|
<columns>
|
||||||
<TableColumn fx:id="boatPlacingColumn" prefWidth="50.0" text="Place" />
|
<TableColumn fx:id="boatPlacingColumn" prefWidth="50.0" text="Place" />
|
||||||
<TableColumn fx:id="boatTeamColumn" prefWidth="100.0" text="Team" />
|
<TableColumn fx:id="boatTeamColumn" prefWidth="100.0" text="Team" />
|
||||||
|
|||||||
Reference in New Issue
Block a user