Game.java changed gui colours

admin: signed F-originality
This commit is contained in:
Justin Ryu 2023-05-09 22:22:29 +10:00
parent 20e6c9e3c1
commit 7fcf6d3a1b
2 changed files with 24 additions and 12 deletions

View File

@ -31,9 +31,9 @@ declaration: >-
# Add as many "url+licence+comment" entries as necessary
# (or remove it altogether if you haven't used any external code)
# code:
# - comment:
# url:
# licence:
# - comment: CSS styling for buttons + comboboxes
# url: http://fxexperience.com/2011/12/styling-fx-buttons-with-css/
# licence: Public Domain
# Use this to list any assets (artwork, sound, etc) that you used.
# Provide a comment explaining your use of that asset and the URL
@ -54,5 +54,5 @@ signatures:
uid: u7156831
- name:
uid:
- name:
uid:
- name: Justin Ryu
uid: u7492895

View File

@ -10,6 +10,8 @@ import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseButton;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
@ -76,7 +78,7 @@ public class Game extends Application {
stage.show();
// Create a new game
newGame(2);
scene.setFill(Color.TRANSPARENT);
scene.setFill(Color.valueOf("#38AEF2"));
}
@ -349,7 +351,7 @@ public class Game extends Application {
scene.setFill(Color.BLACK);
} else {
Scene scene = root.getScene();
scene.setFill(Color.WHITE);
scene.setFill(Color.valueOf("#38AEF2"));
}
@ -359,7 +361,7 @@ public class Game extends Application {
// Add the message
Label messageLabel = new Label(message);
messageLabel.setLayoutX(0);
messageLabel.setLayoutX(35);
messageLabel.setLayoutY(250);
messageLabel.setFont(Font.font("Sans Serif",FontWeight.BOLD, 20));
if (messageError){
@ -389,7 +391,7 @@ public class Game extends Application {
for(int i = 0; i < boardHeight; i++){
for(int j = 0; j < boardHeight - (-1 * i % 2 + 1); j++){
addBoardTile(viewerGrid, boardHeightPx/boardHeight,
String.format("%s,%s", i, j), Color.DARKBLUE);
String.format("%s,%s", i, j), Color.valueOf("#387CFF"));
}
}
@ -411,7 +413,7 @@ public class Game extends Application {
playerId + "\nCurrent Phase: " + currentPhase);
currentStateText.setFont(Font.font("Sans Serif", FontWeight.BOLD, 20));
currentStateText.setX((double) WINDOW_WIDTH / 2 + ((double) WINDOW_WIDTH /5) - 175);
currentStateText.setY(25);
currentStateText.setY(30);
currentStateText.setTextAlignment(TextAlignment.CENTER);
root.getChildren().add(currentStateText);
currentStateText.setFill(Color.GREEN);
@ -419,7 +421,7 @@ public class Game extends Application {
// For each island render the island
for (Island island: currentGame.getIslands()){
for (Coord c: island.getCoords()){
addBoardTile(viewerGrid, tileSize, c.toString(), Color.GREEN);
addBoardTile(viewerGrid, tileSize, c.toString(), Color.valueOf("#64CA00"));
}
}
@ -462,7 +464,7 @@ public class Game extends Application {
Text playerStateText = new Text();
playerStateText.setText(playerData.toString());
playerStateText.setFont(Font.font("Sans Serif", FontWeight.BOLD, 25));
playerStateText.setX(0);
playerStateText.setX(35);
playerStateText.setY(100);
if (darkMode) playerStateText.setFill(Color.WHITE);
@ -497,6 +499,12 @@ public class Game extends Application {
Label stuckLabel = new Label("Stuck?");
Button stuckButton = new Button("Skip my turn");
// Button styling
twoPlayer.setStyle("-fx-padding: 3 10 10 10; -fx-background-insets: 0,0 0 5 0, 0 0 6 0, 0 0 7 0; -fx-background-radius: 8; -fx-background-color: linear-gradient(from 0% 93% to 0% 100%, #69CC00 0%, #83CA00 100%), #69CC00, #83CA00, radial-gradient(center 50% 50%, radius 100%, #83CA00, #A1DF00); -fx-effect: dropshadow( gaussian , rgba(0,0,0,0.75) , 4,0,0,1 ); -fx-font-weight: bold; -fx-font-size: 1.0em;");
threePlayer.setStyle("-fx-padding: 3 10 10 10; -fx-background-insets: 0,0 0 5 0, 0 0 6 0, 0 0 7 0; -fx-background-radius: 8; -fx-background-color: linear-gradient(from 0% 93% to 0% 100%, #69CC00 0%, #83CA00 100%), #69CC00, #83CA00, radial-gradient(center 50% 50%, radius 100%, #83CA00, #A1DF00); -fx-effect: dropshadow( gaussian , rgba(0,0,0,0.75) , 4,0,0,1 ); -fx-font-weight: bold; -fx-font-size: 1.0em;");
fourPlayer.setStyle("-fx-padding: 3 10 10 10; -fx-background-insets: 0,0 0 5 0, 0 0 6 0, 0 0 7 0; -fx-background-radius: 8; -fx-background-color: linear-gradient(from 0% 93% to 0% 100%, #69CC00 0%, #83CA00 100%), #69CC00, #83CA00, radial-gradient(center 50% 50%, radius 100%, #83CA00, #A1DF00); -fx-effect: dropshadow( gaussian , rgba(0,0,0,0.75) , 4,0,0,1 ); -fx-font-weight: bold; -fx-font-size: 1.0em;");
stuckButton.setStyle("-fx-padding: 3 10 10 10; -fx-background-insets: 0,0 0 5 0, 0 0 6 0, 0 0 7 0; -fx-background-radius: 8; -fx-background-color: linear-gradient(from 0% 93% to 0% 100%, #a34313 0%, #903b12 100%), #9d4024, #d86e3a, radial-gradient(center 50% 50%, radius 100%, #d86e3a, #c54e2c); -fx-effect: dropshadow( gaussian , rgba(0,0,0,0.75) , 4,0,0,1 ); -fx-font-weight: bold; -fx-font-size: 1.0em;");
CheckBox darkToggle = new CheckBox("Dark Mode");
darkToggle.setSelected(darkMode);
@ -538,6 +546,10 @@ public class Game extends Application {
mapSelector.getItems().add("Space Invaders");
mapSelector.setPromptText("Default");
// Combobox styling
aiSelector.setStyle("-fx-padding: -1 5 5 5; -fx-background-insets: 0,0 0 5 0, 0 0 6 0, 0 0 7 0; -fx-background-radius: 8; -fx-background-color: linear-gradient(from 0% 93% to 0% 100%, #69CC00 0%, #83CA00 100%), #69CC00, #83CA00, radial-gradient(center 50% 50%, radius 100%, #83CA00, #A1DF00); -fx-effect: dropshadow( gaussian , rgba(0,0,0,0.75) , 4,0,0,1 ); -fx-font-weight: bold; -fx-font-size: 1.0em;");
mapSelector.setStyle("-fx-padding: -1 5 5 5; -fx-background-insets: 0,0 0 5 0, 0 0 6 0, 0 0 7 0; -fx-background-radius: 8; -fx-background-color: linear-gradient(from 0% 93% to 0% 100%, #69CC00 0%, #83CA00 100%), #69CC00, #83CA00, radial-gradient(center 50% 50%, radius 100%, #83CA00, #A1DF00); -fx-effect: dropshadow( gaussian , rgba(0,0,0,0.75) , 4,0,0,1 ); -fx-font-weight: bold; -fx-font-size: 1.0em;");
// Set the map when the map is selected
mapSelector.setOnAction(new EventHandler<ActionEvent>() {
@Override