diff --git a/src/main/java/it/polimi/ingsw/gc14/ClientLauncherGUI.java b/src/main/java/it/polimi/ingsw/gc14/ClientLauncherGUI.java index 35db3ca..9757dc2 100644 --- a/src/main/java/it/polimi/ingsw/gc14/ClientLauncherGUI.java +++ b/src/main/java/it/polimi/ingsw/gc14/ClientLauncherGUI.java @@ -9,6 +9,7 @@ public class ClientLauncherGUI { public static void main(String[] args) { System.setProperty("glass.win.uiScale", "1.0"); + System.setProperty("glass.gtk.uiScale", "1.0"); Application.launch(GUIApp.class, args); } diff --git a/src/main/java/it/polimi/ingsw/gc14/View/GUI/GUI.java b/src/main/java/it/polimi/ingsw/gc14/View/GUI/GUI.java index 550d582..e757382 100644 --- a/src/main/java/it/polimi/ingsw/gc14/View/GUI/GUI.java +++ b/src/main/java/it/polimi/ingsw/gc14/View/GUI/GUI.java @@ -62,23 +62,21 @@ public class GUI extends Application implements IView { loaderMain = new FXMLLoader(getClass().getResource("/GUIScene/main.fxml")); - loaderMain.setControllerFactory(clazz -> { - MainFXMLController controllerMain = new MainFXMLController(); - controllerMain.setController(controller); - return controllerMain; - }); + mainScene = new Scene(loaderMain.load()); + controllerMain = loaderMain.getController(); + controllerMain.setController(controller); loaderLeaderboard = new FXMLLoader(getClass().getResource("/GUIScene/standing.fxml")); leaderboardScene = new Scene(loaderLeaderboard.load()); controllerLeaderboard = loaderLeaderboard.getController(); controllerLeaderboard.setController(controller,primaryStage,loginScene); - mainScene = new Scene(loaderMain.load()); - controllerMain = loaderMain.getController(); - showLogin(); + + primaryStage.setScene(loginScene); + primaryStage.setMaximized(true); primaryStage.setTitle("Mesos"); primaryStage.setOnCloseRequest(e -> { Platform.exit(); @@ -87,10 +85,6 @@ public class GUI extends Application implements IView { primaryStage.show(); } - public void showLogin() throws IOException { - primaryStage.setScene(loginScene); - } - @Override public void setModel(MiniModel miniModel) { @@ -105,20 +99,20 @@ public class GUI extends Application implements IView { Platform.runLater(() -> { synchronized (miniModel) { if (controller.miniModel.currentState.getGameStage() == TOTEM_CHOICE) { - primaryStage.setScene(totemScene); controllerTotem.render(); + primaryStage.setScene(totemScene); } else if (controller.miniModel.currentState.getGameStage() == ENDED) { - primaryStage.setScene(leaderboardScene); controllerLeaderboard.render(); + primaryStage.setScene(leaderboardScene); } else { double w = primaryStage.getWidth(); double h = primaryStage.getHeight(); - primaryStage.setScene(mainScene); primaryStage.setWidth(w); primaryStage.setHeight(h); primaryStage.setMinHeight(h); primaryStage.setMinWidth(w); primaryStage.setResizable(false); + primaryStage.setScene(mainScene); controllerMain.render(); } } @@ -136,6 +130,7 @@ public class GUI extends Application implements IView { synchronized (miniModel) { controllerMain.isError = true; controllerMain.render(); + System.out.println("ERRORE PORCODIDODODODOD"); } }); } diff --git a/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java b/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java index 3c6efce..6649d81 100644 --- a/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java +++ b/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java @@ -75,6 +75,7 @@ public class MainFXMLController { public void initialize() { Font.loadFont(getClass().getResourceAsStream("/Fonts/InknutAntiqua-Regular.ttf"), 14); + popup = new Popup(); mainHBox.sceneProperty().addListener((obs, oldScene, newScene) -> { if (newScene != null) { @@ -282,7 +283,7 @@ public class MainFXMLController { private void renderPlayer(Player player,VBox target) { VBox card = new VBox(3); - VBox.setMargin(card, new Insets(8,15,8,15)); + VBox.setMargin(card, new Insets(15,15,0,15)); card.getStyleClass().add("player-card"); card.setPadding(new Insets(4)); @@ -291,6 +292,8 @@ public class MainFXMLController { scaleUp.setToX(1.1); scaleUp.setToY(1.1); scaleUp.play(); + + card.setStyle("-fx-effect: dropshadow(gaussian, #fff8dc, 15, 0.10, 0, 0)"); } @@ -303,8 +306,9 @@ public class MainFXMLController { totem.setPreserveRatio(true); Label usernameLabel = new Label(player.getUserName()); usernameLabel.getStyleClass().add("label-medium"); + usernameLabel.setStyle("-fx-text-fill: #711423;"); if (player.getUserName().equals(controller.myUsername)) { - usernameLabel.setStyle("-fx-text-fill: #9d0208"); + usernameLabel.setText(usernameLabel.getText() + " (you)"); if(isError) { TranslateTransition tt = new TranslateTransition(Duration.millis(50), card); diff --git a/src/main/java/it/polimi/ingsw/gc14/View/GUI/TotemFXMLController.java b/src/main/java/it/polimi/ingsw/gc14/View/GUI/TotemFXMLController.java index c9bd7b9..ff98b03 100644 --- a/src/main/java/it/polimi/ingsw/gc14/View/GUI/TotemFXMLController.java +++ b/src/main/java/it/polimi/ingsw/gc14/View/GUI/TotemFXMLController.java @@ -36,9 +36,9 @@ public class TotemFXMLController { public void initialize() { Image img = new Image(getClass().getResourceAsStream("/GUIImages/Background.png")); backgroundImage.setImage(img); - Rectangle2D screenBounds = Screen.getPrimary().getBounds(); - backgroundImage.setFitWidth(screenBounds.getWidth()); - backgroundImage.setFitHeight(screenBounds.getHeight()); + //Rectangle2D screenBounds = Screen.getPrimary().getBounds(); + //backgroundImage.setFitWidth(screenBounds.getWidth()); + //backgroundImage.setFitHeight(screenBounds.getHeight()); } public void render() { diff --git a/src/main/resources/GUIScene/styles.css b/src/main/resources/GUIScene/styles.css index 84733f9..8962330 100644 --- a/src/main/resources/GUIScene/styles.css +++ b/src/main/resources/GUIScene/styles.css @@ -35,11 +35,11 @@ } .player-card { - -fx-border-color: #6a040f; + -fx-border-color: #711423; -fx-border-width: 2; -fx-border-radius: 15; -fx-background-radius: 15; - -fx-background-color: #f48c06; + -fx-background-color: #f18f1c; } .frame {