-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Schinc
committed
Apr 23, 2024
1 parent
a965396
commit b75b8aa
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package ch.epfl.chacun; | ||
|
||
import ch.epfl.chacun.gui.PlayersUI; | ||
import ch.epfl.chacun.tile.Tiles; | ||
import javafx.application.Application; | ||
import javafx.beans.property.SimpleObjectProperty; | ||
import javafx.scene.Scene; | ||
import javafx.scene.layout.BorderPane; | ||
import javafx.stage.Stage; | ||
|
||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
public final class ChickenAttackerPlayersUITest extends Application { | ||
public static void main(String[] args) { launch(args); } | ||
|
||
@Override | ||
public void start(Stage primaryStage) { | ||
var playerNames = Map.of(PlayerColor.RED, "Rose", | ||
PlayerColor.BLUE, "Bernard"); | ||
var playerColors = playerNames.keySet().stream() | ||
.sorted() | ||
.toList(); | ||
|
||
var tilesByKind = Tiles.TILES.stream() | ||
.collect(Collectors.groupingBy(Tile::kind)); | ||
var tileDecks = | ||
new TileDecks(tilesByKind.get(Tile.Kind.START), | ||
tilesByKind.get(Tile.Kind.NORMAL), | ||
tilesByKind.get(Tile.Kind.MENHIR)); | ||
|
||
var textMaker = new TextMakerFr(playerNames); | ||
|
||
var gameState = | ||
GameState.initial(playerColors, | ||
tileDecks, | ||
textMaker); | ||
|
||
var gameStateO = new SimpleObjectProperty<>(gameState); | ||
|
||
var playersNode = PlayersUI.create(gameStateO, textMaker); | ||
var rootNode = new BorderPane(playersNode); | ||
primaryStage.setScene(new Scene(rootNode)); | ||
|
||
primaryStage.setTitle("ChaCuN test"); | ||
primaryStage.show(); | ||
} | ||
} | ||
|