Skip to content
Snippets Groups Projects
Commit 13237406 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

Fixed #9

parent 9addc660
Branches
Tags
No related merge requests found
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?> <?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?> <?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?> <?import javafx.scene.control.MenuItem?>
...@@ -9,6 +10,7 @@ ...@@ -9,6 +10,7 @@
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?> <?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.deadlocker8.roadgame.ui.Controller"> <AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.deadlocker8.roadgame.ui.Controller">
<children> <children>
...@@ -26,6 +28,22 @@ ...@@ -26,6 +28,22 @@
<Insets top="14.0" /> <Insets top="14.0" />
</VBox.margin> </VBox.margin>
</Button> </Button>
<Label text="Tiles remaining:">
<font>
<Font name="System Bold" size="12.0" />
</font>
<VBox.margin>
<Insets top="30.0" />
</VBox.margin>
</Label>
<Label fx:id="labelTilesRemaining" text="120">
<font>
<Font name="System Bold" size="18.0" />
</font>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</Label>
</children> </children>
</VBox> </VBox>
</children> </children>
......
...@@ -29,6 +29,11 @@ public class Board ...@@ -29,6 +29,11 @@ public class Board
} }
} }
public TilePack getTilePack()
{
return tilePack;
}
public ArrayList<Tile> getTiles() public ArrayList<Tile> getTiles()
{ {
return tiles; return tiles;
......
...@@ -29,6 +29,8 @@ public class Main extends Application ...@@ -29,6 +29,8 @@ public class Main extends Application
((Controller)loader.getController()).init(stage); ((Controller)loader.getController()).init(stage);
stage.setResizable(true); stage.setResizable(true);
stage.setMinWidth(800);
stage.setMinHeight(600);
stage.getIcons().add(new Image("de/deadlocker8/roadgame/resources/icon.png")); stage.getIcons().add(new Image("de/deadlocker8/roadgame/resources/icon.png"));
stage.setTitle("RoadGame"); stage.setTitle("RoadGame");
stage.setScene(scene); stage.setScene(scene);
......
...@@ -38,6 +38,7 @@ public class Controller ...@@ -38,6 +38,7 @@ public class Controller
@FXML private AnchorPane anchorPaneGame; @FXML private AnchorPane anchorPaneGame;
@FXML private StackPane stackPaneCurrentTile; @FXML private StackPane stackPaneCurrentTile;
@FXML private Button buttonRotate; @FXML private Button buttonRotate;
@FXML private Label labelTilesRemaining;
private Stage stage; private Stage stage;
private Image icon = new Image("de/deadlocker8/roadgame/resources/icon.png"); private Image icon = new Image("de/deadlocker8/roadgame/resources/icon.png");
...@@ -56,6 +57,8 @@ public class Controller ...@@ -56,6 +57,8 @@ public class Controller
anchorPaneGame.setStyle("-fx-border-color: #333333; -fx-border-width: 2px"); anchorPaneGame.setStyle("-fx-border-color: #333333; -fx-border-width: 2px");
stackPaneCurrentTile.setStyle("-fx-border-color: #333333; -fx-border-width: 2px"); stackPaneCurrentTile.setStyle("-fx-border-color: #333333; -fx-border-width: 2px");
labelTilesRemaining.setText("0");
grid = new GridPane(); grid = new GridPane();
grid.setFocusTraversable(false); grid.setFocusTraversable(false);
...@@ -310,7 +313,6 @@ public class Controller ...@@ -310,7 +313,6 @@ public class Controller
{ {
game.setCurrentTile(null); game.setCurrentTile(null);
stackPaneCurrentTile.getChildren().clear(); stackPaneCurrentTile.getChildren().clear();
//TODO
updateGrid(game.getBoard(), null); updateGrid(game.getBoard(), null);
return; return;
} }
...@@ -320,6 +322,8 @@ public class Controller ...@@ -320,6 +322,8 @@ public class Controller
stackPaneCurrentTile.getChildren().clear(); stackPaneCurrentTile.getChildren().clear();
stackPaneCurrentTile.getChildren().add(createStackPaneForTile(game.getCurrentTile(), false, 0, 0)); stackPaneCurrentTile.getChildren().add(createStackPaneForTile(game.getCurrentTile(), false, 0, 0));
labelTilesRemaining.setText(String.valueOf(game.getBoard().getTilePack().getNumberOfTiles()));
updateGrid(game.getBoard(), game.getPossibleLocations(game.getCurrentTile())); updateGrid(game.getBoard(), game.getPossibleLocations(game.getCurrentTile()));
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?> <?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?> <?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?> <?import javafx.scene.control.MenuItem?>
...@@ -9,6 +10,7 @@ ...@@ -9,6 +10,7 @@
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?> <?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.deadlocker8.roadgame.ui.Controller"> <AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.deadlocker8.roadgame.ui.Controller">
<children> <children>
...@@ -26,6 +28,22 @@ ...@@ -26,6 +28,22 @@
<Insets top="14.0" /> <Insets top="14.0" />
</VBox.margin> </VBox.margin>
</Button> </Button>
<Label text="Tiles remaining:">
<font>
<Font name="System Bold" size="12.0" />
</font>
<VBox.margin>
<Insets top="30.0" />
</VBox.margin>
</Label>
<Label fx:id="labelTilesRemaining" text="120">
<font>
<Font name="System Bold" size="18.0" />
</font>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</Label>
</children> </children>
</VBox> </VBox>
</children> </children>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment