added and option to swap between css files in the title pane

#pair[zwu18, hba56]
#story[1087]
main
hba56 9 years ago
parent 8bb66bc5e4
commit 64b4aa539a

@ -73,6 +73,11 @@ public class MainController extends Controller {
*/ */
public void hostGame(){ hostController.hostGame(); } public void hostGame(){ hostController.hostGame(); }
/**
* Sets up the css for the start of the program
*/
public void startCss(){titleController.setDayMode();}
/** /**
* Main Controller for the applications will house the menu and the displayed pane. * Main Controller for the applications will house the menu and the displayed pane.
* *

@ -5,6 +5,7 @@ import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.RadioButton;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage; import javafx.stage.Stage;
@ -24,6 +25,10 @@ public class TitleController extends Controller {
Button btnJoin; Button btnJoin;
@FXML @FXML
AnchorPane titleWrapper; AnchorPane titleWrapper;
@FXML
RadioButton dayModeRD;
@FXML
RadioButton nightModeRD;
/** /**
* Method called when the 'host a game' button is pressed. * Method called when the 'host a game' button is pressed.
@ -50,6 +55,18 @@ public class TitleController extends Controller {
parent.enterLobby(); parent.enterLobby();
} }
public void setDayMode(){
dayModeRD.getScene().getStylesheets().clear();
dayModeRD.getScene().getStylesheets().add("/css/dayMode.css");
nightModeRD.setSelected(false);
}
public void setNightMode(){
nightModeRD.getScene().getStylesheets().clear();
nightModeRD.getScene().getStylesheets().add("/css/nightMode.css");
dayModeRD.setSelected(false);
}
@Override @Override
public void initialize(URL location, ResourceBundle resources) { public void initialize(URL location, ResourceBundle resources) {

@ -45,6 +45,7 @@ public class App extends Application {
stage.setScene(scene); stage.setScene(scene);
stage.setTitle("RaceVision - Team 7"); stage.setTitle("RaceVision - Team 7");
stage.getIcons().add(new Image(getClass().getClassLoader().getResourceAsStream("images/SailIcon.png"))); stage.getIcons().add(new Image(getClass().getClassLoader().getResourceAsStream("images/SailIcon.png")));
mc.startCss();
stage.show(); stage.show();
} }
} }

@ -21,8 +21,8 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<TextField fx:id="gameNameField" promptText="Enter game name [DOES NOTHING ATM]" GridPane.columnIndex="1" GridPane.rowIndex="1" GridPane.valignment="TOP" /> <TextField fx:id="gameNameField" disable="true" promptText="Enter game name" GridPane.columnIndex="1" GridPane.rowIndex="1" GridPane.valignment="TOP" />
<TextField fx:id="hostNameField" promptText="Enter host name [DOES NOTHING ATM]" GridPane.columnIndex="1" GridPane.rowIndex="1" GridPane.valignment="BOTTOM" /> <TextField fx:id="hostNameField" disable="true" promptText="Enter host name" GridPane.columnIndex="1" GridPane.rowIndex="1" GridPane.valignment="BOTTOM" />
<Button fx:id="hostGameBtn" mnemonicParsing="false" onAction="#hostGamePressed" text="Host Game" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2"> <Button fx:id="hostGameBtn" mnemonicParsing="false" onAction="#hostGamePressed" text="Host Game" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2">
<font> <font>
<Font size="20.0" /> <Font size="20.0" />

@ -15,7 +15,7 @@
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<AnchorPane fx:id="titleWrapper" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.TitleController"> <AnchorPane fx:id="titleWrapper" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.TitleController">
<children> <children>
<GridPane layoutY="39.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <GridPane layoutY="39.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints> <columnConstraints>
@ -45,6 +45,8 @@
<Font name="Comic Sans MS" size="12.0" /> <Font name="Comic Sans MS" size="12.0" />
</font> </font>
</Text> </Text>
<RadioButton fx:id="nightModeRD" layoutX="681.0" layoutY="168.0" mnemonicParsing="false" onAction="#setNightMode" text="Night Mode" />
<RadioButton fx:id="dayModeRD" layoutX="574.0" layoutY="168.0" mnemonicParsing="false" onAction="#setDayMode" selected="true" text="Day Mode" />
</children> </children>
</Pane> </Pane>
<Pane prefHeight="20.0" prefWidth="20.0" style="-fx-background-color: #6be6ff;" GridPane.columnSpan="4" GridPane.rowSpan="4"> <Pane prefHeight="20.0" prefWidth="20.0" style="-fx-background-color: #6be6ff;" GridPane.columnSpan="4" GridPane.rowSpan="4">
@ -59,7 +61,7 @@
<Image url="@../images/cloud.png" /> <Image url="@../images/cloud.png" />
</image> </image>
</ImageView> </ImageView>
<ImageView fx:id="imgWhale" fitHeight="113.0" fitWidth="98.0" layoutX="68.0" layoutY="257.0" pickOnBounds="true" preserveRatio="true"> <ImageView fx:id="imgWhale" fitHeight="113.0" fitWidth="98.0" layoutX="69.0" layoutY="302.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
<Image url="@../images/whale.png" /> <Image url="@../images/whale.png" />
</image> </image>

Loading…
Cancel
Save