diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java b/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java index 33e65841d487e944f45a4ffe03c854abcc5a4c6a..1306fe7c02c0dcc3288dd8e0278686de31d610da 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Controller/GameSceneController.java @@ -23,10 +23,7 @@ import javafx.scene.canvas.GraphicsContext; import javafx.scene.control.Label; import javafx.scene.control.Slider; -import javafx.scene.layout.BorderPane; -import javafx.scene.layout.Pane; -import javafx.scene.layout.StackPane; -import javafx.scene.layout.VBox; +import javafx.scene.layout.*; import javafx.scene.shape.Rectangle; import javafx.scene.text.Font; import javafx.scene.text.Text; @@ -50,7 +47,7 @@ public class GameSceneController implements Initializable { @FXML private Pane playerPane, enemyPane; @FXML - private Label playerHp, enemyHp; + private Label playerHp, enemyHp, time, round; @FXML private StackPane stackPane; Screen screen = Screen.getPrimary(); @@ -108,13 +105,11 @@ public class GameSceneController implements Initializable { enemyHp.setFont(Font.loadFont(getClass().getResourceAsStream("/fonts/StarshipShadow.ttf"), 55)); playerHp.setText("100%"); playerHp.setMinWidth(120); + playerHp.setMaxWidth(120); enemyHp.setText("100%"); enemyHp.setMinWidth(120); // stopping the VBox from shrinking when health bar gets smaller -// healthVBox.setMinWidth(healthBarWidth); -// healthVBox.setMaxWidth(healthBarWidth); -// hpVBox.setMinWidth(110); playerPane.setMinWidth(healthBarWidth); playerPane.setMaxWidth(healthBarWidth); enemyPane.setMinWidth(healthBarWidth); @@ -125,8 +120,8 @@ public class GameSceneController implements Initializable { // make it responsive if (ScreenClasses.inRange((int) diagonalInches) == ScreenClasses.INCH27) { - canvas2D.setScaleX(1.2); - canvas2D.setScaleY(1.2); + canvas2D.setScaleX(1.5); + canvas2D.setScaleY(1.5); } else if (ScreenClasses.inRange((int) diagonalInches) == ScreenClasses.INCH13_SURFACE) { // TODO: make a enum for MacBook screens } else { diff --git a/src/main/resources/fxml/GameScene.fxml b/src/main/resources/fxml/GameScene.fxml index 48025acc51bc51251137d7124003f4670900035e..6d70dc666e6853e4ab00cbc6f775eed560ad16dc 100644 --- a/src/main/resources/fxml/GameScene.fxml +++ b/src/main/resources/fxml/GameScene.fxml @@ -28,24 +28,26 @@ <Pane prefHeight="50.0" VBox.vgrow="ALWAYS" /> <HBox alignment="CENTER" spacing="30.0"> <children> - <HBox alignment="CENTER_RIGHT" spacing="10.0"> + <HBox alignment="CENTER_RIGHT" fillHeight="false" spacing="10.0"> <children> - <Pane fx:id="playerPane" HBox.hgrow="ALWAYS"> + <Label text="Player HP" /> + <Pane fx:id="playerPane" nodeOrientation="RIGHT_TO_LEFT"> <children> - <Rectangle fx:id="playerHealth" arcHeight="5.0" arcWidth="5.0" fill="#c92c1a" height="70.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" width="900.0" /> + <Rectangle fx:id="playerHealth" arcHeight="5.0" arcWidth="5.0" fill="#c92c1a" height="50.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" width="900.0" /> </children> </Pane> <Label fx:id="playerHp" alignment="CENTER_RIGHT" /> </children> </HBox> - <HBox spacing="10.0"> + <HBox alignment="CENTER_LEFT" fillHeight="false" spacing="10.0"> <children> <Label fx:id="enemyHp" /> <Pane fx:id="enemyPane" HBox.hgrow="ALWAYS"> <children> - <Rectangle fx:id="enemyHealth" arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="70.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" width="900.0" /> + <Rectangle fx:id="enemyHealth" arcHeight="5.0" arcWidth="5.0" fill="DODGERBLUE" height="50.0" stroke="BLACK" strokeType="INSIDE" strokeWidth="0.0" width="900.0" /> </children> </Pane> + <Label text="Enemy HP" /> </children> </HBox> </children> @@ -54,7 +56,7 @@ </VBox> </top> <left> - <VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER"> + <VBox alignment="CENTER" prefHeight="200.0" prefWidth="300.0" BorderPane.alignment="CENTER"> <children> <Slider fx:id="slider" orientation="VERTICAL" value="100.0" /> <Slider fx:id="slider2" orientation="VERTICAL" value="100.0" /> @@ -62,6 +64,21 @@ </VBox> </left> <right> - <VBox prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER" /> + <HBox BorderPane.alignment="CENTER"> + <children> + <VBox prefHeight="200.0"> + <children> + <Pane VBox.vgrow="ALWAYS" /> + <Label text="Time:" /> + <Label fx:id="time" text="00:30" /> + <Pane VBox.vgrow="ALWAYS" /> + <Label text="Round:" /> + <Label fx:id="round" text="1/3" /> + <Pane VBox.vgrow="ALWAYS" /> + </children> + </VBox> + <Pane prefWidth="200.0" HBox.hgrow="ALWAYS" /> + </children> + </HBox> </right> </BorderPane> diff --git a/src/main/resources/styles/style.css b/src/main/resources/styles/style.css index 938f7693c3a76d53bf9a90102efe2633d34cfb66..c6d0d1c3446bc10e5bdcf9c19cc7c6d94fb33bce 100644 --- a/src/main/resources/styles/style.css +++ b/src/main/resources/styles/style.css @@ -44,7 +44,7 @@ } #gameScene { - -fx-background-image: url("../textures/images/test.jpg"); + -fx-background-image: url("../textures/images/game_scene_backgorund.jpg"); -fx-background-size: cover; } diff --git a/src/main/resources/textures/images/game_scene_backgorund.jpg b/src/main/resources/textures/images/game_scene_backgorund.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4582a8a16813744f793a6f78424321548071ca01 Binary files /dev/null and b/src/main/resources/textures/images/game_scene_backgorund.jpg differ