diff --git a/src/main/java/de/hsfulda/onses/App.java b/src/main/java/de/hsfulda/onses/App.java index b1e280a..bda0c20 100644 --- a/src/main/java/de/hsfulda/onses/App.java +++ b/src/main/java/de/hsfulda/onses/App.java @@ -1,7 +1,7 @@ package de.hsfulda.onses; import de.hsfulda.onses.controllers.AppController; -import de.hsfulda.onses.models.Game; +import de.hsfulda.onses.services.GameService; import javafx.application.Application; import javafx.scene.Scene; import javafx.stage.Stage; @@ -9,9 +9,9 @@ import javafx.stage.Stage; public class App extends Application { @Override public void start(Stage stage) throws Exception { - final AppController appController = new AppController(new Game(), stage); + final AppController appController = new AppController(new GameService(), stage); - stage.setTitle("Onses - Uno Game"); + stage.setTitle("Onses - Uno"); stage.setScene(new Scene(appController.render())); stage.show(); } diff --git a/src/main/java/de/hsfulda/onses/controllers/AppController.java b/src/main/java/de/hsfulda/onses/controllers/AppController.java index 0c1e1c2..d2e0b80 100644 --- a/src/main/java/de/hsfulda/onses/controllers/AppController.java +++ b/src/main/java/de/hsfulda/onses/controllers/AppController.java @@ -2,6 +2,7 @@ package de.hsfulda.onses.controllers; import de.hsfulda.onses.Main; import de.hsfulda.onses.models.Game; +import de.hsfulda.onses.services.GameService; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; @@ -13,22 +14,23 @@ import java.util.Objects; public class AppController implements Controller { - private final Game game; + private final GameService gameService; private final Stage stage; - public AppController(Game game, Stage stage) { - this.game = game; + public AppController(GameService gameService, Stage stage) { + this.gameService = gameService; this.stage = stage; } @Override public Parent render() throws IOException { - GameController gameController = new GameController(game); + GameController gameController = new GameController(gameService); final Parent parent = FXMLLoader.load(Objects.requireNonNull(Main.class.getResource("views/app.fxml"))); Button button = (Button) parent.lookup("#startGameBtn"); button.setOnAction(e -> { try { stage.setScene(new Scene(gameController.render())); + stage.setTitle("Onses - Uno Game"); } catch (IOException ex) { throw new RuntimeException(ex); } diff --git a/src/main/java/de/hsfulda/onses/controllers/GameController.java b/src/main/java/de/hsfulda/onses/controllers/GameController.java index 4eaf803..37f616f 100644 --- a/src/main/java/de/hsfulda/onses/controllers/GameController.java +++ b/src/main/java/de/hsfulda/onses/controllers/GameController.java @@ -1,21 +1,27 @@ package de.hsfulda.onses.controllers; import de.hsfulda.onses.Main; -import de.hsfulda.onses.models.Game; +import de.hsfulda.onses.models.Card; +import de.hsfulda.onses.services.GameService; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; +import javafx.scene.layout.Pane; import java.io.IOException; import java.util.Objects; public class GameController implements Controller { - private final Game game; - public GameController(Game game) { - this.game = game; + private final GameService gameService; + public GameController(GameService gameService) { + this.gameService = gameService; } @Override public Parent render() throws IOException { final Parent parent = FXMLLoader.load(Objects.requireNonNull(Main.class.getResource("views/game.fxml"))); + CardController lastPlayedCardController = new CardController(new Card().setValue(Card.Value.FIVE).setColor(Card.Color.BLUE)); + + Pane lastPlayedCardPane = (Pane) parent.lookup("#lastPlayedCardPane"); + lastPlayedCardPane.getChildren().add(lastPlayedCardController.render()); return parent; } diff --git a/src/main/resources/de/hsfulda/onses/views/game.fxml b/src/main/resources/de/hsfulda/onses/views/game.fxml index 29510a4..ca16664 100644 --- a/src/main/resources/de/hsfulda/onses/views/game.fxml +++ b/src/main/resources/de/hsfulda/onses/views/game.fxml @@ -1,5 +1,6 @@ + @@ -8,16 +9,38 @@ - + + + - + + +