diff --git a/bin/fr/iut_fbleau/Avalam/AvalamBoard.class b/bin/fr/iut_fbleau/Avalam/AvalamBoard.class new file mode 100644 index 0000000..25cb219 Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/AvalamBoard.class differ diff --git a/bin/fr/iut_fbleau/Avalam/AvalamPly.class b/bin/fr/iut_fbleau/Avalam/AvalamPly.class new file mode 100644 index 0000000..59fdfcb Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/AvalamPly.class differ diff --git a/bin/fr/iut_fbleau/Avalam/AvalamWindow$1.class b/bin/fr/iut_fbleau/Avalam/AvalamWindow$1.class new file mode 100644 index 0000000..339e29f Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/AvalamWindow$1.class differ diff --git a/bin/fr/iut_fbleau/Avalam/AvalamWindow.class b/bin/fr/iut_fbleau/Avalam/AvalamWindow.class new file mode 100644 index 0000000..2b31770 Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/AvalamWindow.class differ diff --git a/bin/fr/iut_fbleau/Avalam/Color.class b/bin/fr/iut_fbleau/Avalam/Color.class new file mode 100644 index 0000000..3e18a94 Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/Color.class differ diff --git a/bin/fr/iut_fbleau/Avalam/Main.class b/bin/fr/iut_fbleau/Avalam/Main.class new file mode 100644 index 0000000..1c97788 Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/Main.class differ diff --git a/bin/fr/iut_fbleau/Avalam/Tower.class b/bin/fr/iut_fbleau/Avalam/Tower.class new file mode 100644 index 0000000..1753bce Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/Tower.class differ diff --git a/bin/fr/iut_fbleau/Avalam/logic/BoardLoader.class b/bin/fr/iut_fbleau/Avalam/logic/BoardLoader.class new file mode 100644 index 0000000..58c7901 Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/logic/BoardLoader.class differ diff --git a/bin/fr/iut_fbleau/Avalam/ui/BoardView$BackgroundLayer.class b/bin/fr/iut_fbleau/Avalam/ui/BoardView$BackgroundLayer.class new file mode 100644 index 0000000..3c16397 Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/ui/BoardView$BackgroundLayer.class differ diff --git a/bin/fr/iut_fbleau/Avalam/ui/BoardView.class b/bin/fr/iut_fbleau/Avalam/ui/BoardView.class new file mode 100644 index 0000000..9e3cace Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/ui/BoardView.class differ diff --git a/bin/fr/iut_fbleau/Avalam/ui/HighlightLayer.class b/bin/fr/iut_fbleau/Avalam/ui/HighlightLayer.class new file mode 100644 index 0000000..ba1c09f Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/ui/HighlightLayer.class differ diff --git a/bin/fr/iut_fbleau/Avalam/ui/InteractionController.class b/bin/fr/iut_fbleau/Avalam/ui/InteractionController.class new file mode 100644 index 0000000..448a3c6 Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/ui/InteractionController.class differ diff --git a/bin/fr/iut_fbleau/Avalam/ui/PieceButton$1.class b/bin/fr/iut_fbleau/Avalam/ui/PieceButton$1.class new file mode 100644 index 0000000..9962344 Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/ui/PieceButton$1.class differ diff --git a/bin/fr/iut_fbleau/Avalam/ui/PieceButton.class b/bin/fr/iut_fbleau/Avalam/ui/PieceButton.class new file mode 100644 index 0000000..0492d30 Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/ui/PieceButton.class differ diff --git a/bin/fr/iut_fbleau/Avalam/ui/PieceLayer.class b/bin/fr/iut_fbleau/Avalam/ui/PieceLayer.class new file mode 100644 index 0000000..d4c552e Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/ui/PieceLayer.class differ diff --git a/bin/fr/iut_fbleau/Avalam/ui/ScoreView.class b/bin/fr/iut_fbleau/Avalam/ui/ScoreView.class new file mode 100644 index 0000000..cb29c75 Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/ui/ScoreView.class differ diff --git a/bin/fr/iut_fbleau/Avalam/ui/TurnView.class b/bin/fr/iut_fbleau/Avalam/ui/TurnView.class new file mode 100644 index 0000000..6381317 Binary files /dev/null and b/bin/fr/iut_fbleau/Avalam/ui/TurnView.class differ diff --git a/bin/fr/iut_fbleau/GameAPI/AbstractBoard.class b/bin/fr/iut_fbleau/GameAPI/AbstractBoard.class new file mode 100644 index 0000000..5372ca6 Binary files /dev/null and b/bin/fr/iut_fbleau/GameAPI/AbstractBoard.class differ diff --git a/bin/fr/iut_fbleau/GameAPI/AbstractGame.class b/bin/fr/iut_fbleau/GameAPI/AbstractGame.class new file mode 100644 index 0000000..9c63903 Binary files /dev/null and b/bin/fr/iut_fbleau/GameAPI/AbstractGame.class differ diff --git a/bin/fr/iut_fbleau/GameAPI/AbstractGamePlayer.class b/bin/fr/iut_fbleau/GameAPI/AbstractGamePlayer.class new file mode 100644 index 0000000..ff18254 Binary files /dev/null and b/bin/fr/iut_fbleau/GameAPI/AbstractGamePlayer.class differ diff --git a/bin/fr/iut_fbleau/GameAPI/AbstractPly.class b/bin/fr/iut_fbleau/GameAPI/AbstractPly.class new file mode 100644 index 0000000..5a3a4d2 Binary files /dev/null and b/bin/fr/iut_fbleau/GameAPI/AbstractPly.class differ diff --git a/bin/fr/iut_fbleau/GameAPI/IBoard.class b/bin/fr/iut_fbleau/GameAPI/IBoard.class new file mode 100644 index 0000000..986c0b3 Binary files /dev/null and b/bin/fr/iut_fbleau/GameAPI/IBoard.class differ diff --git a/bin/fr/iut_fbleau/GameAPI/Player.class b/bin/fr/iut_fbleau/GameAPI/Player.class new file mode 100644 index 0000000..c659c8b Binary files /dev/null and b/bin/fr/iut_fbleau/GameAPI/Player.class differ diff --git a/bin/fr/iut_fbleau/GameAPI/Result.class b/bin/fr/iut_fbleau/GameAPI/Result.class new file mode 100644 index 0000000..4234ba9 Binary files /dev/null and b/bin/fr/iut_fbleau/GameAPI/Result.class differ diff --git a/bin/fr/iut_fbleau/Res/BackgroundAvalam.png b/bin/fr/iut_fbleau/Res/BackgroundAvalam.png new file mode 100644 index 0000000..204977d Binary files /dev/null and b/bin/fr/iut_fbleau/Res/BackgroundAvalam.png differ diff --git a/bin/fr/iut_fbleau/Res/Plateau.txt b/bin/fr/iut_fbleau/Res/Plateau.txt new file mode 100644 index 0000000..250d0c9 --- /dev/null +++ b/bin/fr/iut_fbleau/Res/Plateau.txt @@ -0,0 +1,9 @@ +0,0,1,2,0,0,0,0,0 +0,1,2,1,2,0,0,0,0 +0,2,1,2,1,2,1,0,0 +0,1,2,1,2,1,2,1,2 +1,2,1,2,0,2,1,2,1 +2,1,2,1,2,1,2,1,0 +0,0,1,2,1,2,1,2,0 +0,0,0,0,2,1,2,1,0 +0,0,0,0,0,2,1,0,0 diff --git a/fr/iut_fbleau/Avalam/ui/BoardView.java b/fr/iut_fbleau/Avalam/ui/BoardView.java index dc445c3..7918eeb 100644 --- a/fr/iut_fbleau/Avalam/ui/BoardView.java +++ b/fr/iut_fbleau/Avalam/ui/BoardView.java @@ -12,20 +12,21 @@ import java.awt.*; * Elle gère : * - l’affichage des tours (PieceLayer) * - l’affichage des coups possibles (HighlightLayer) + * - un fond graphique personnalisé * - les clics via InteractionController - * - * Toute la logique de jeu est déléguée au moteur AvalamBoard - * et au contrôleur InteractionController. */ public class BoardView extends JLayeredPane { /** Référence au moteur Avalam */ private AvalamBoard board; + /** Couche d’affichage du fond */ + private BackgroundLayer backgroundLayer; + /** Couche d’affichage des rond verts */ private HighlightLayer highlightLayer; - /** Couche d’affichage des tours */ + /** Couche d’affichage des pièces */ private PieceLayer pieceLayer; /** Contrôleur des interactions */ @@ -37,14 +38,11 @@ public class BoardView extends JLayeredPane { private final int xBase = 60; private final int yBase = 60; - /** Callback vers AvalamWindow pour mises à jour (score, tour, fin de partie) */ + /** Callback vers AvalamWindow pour mises à jour (score, tour, fin) */ private Runnable boardUpdateCallback; /** - * Constructeur de la vue du plateau. - * - * @param board moteur Avalam utilisé pour afficher la grille - * @param boardUpdateCallback callback appelé après chaque coup + * Constructeur. */ public BoardView(AvalamBoard board, Runnable boardUpdateCallback) { this.board = board; @@ -52,28 +50,29 @@ public class BoardView extends JLayeredPane { setLayout(null); - // Contrôleur + // --- Contrôleur --- this.controller = new InteractionController(board, this); - // Couche Highlight + // --- Couche fond --- + backgroundLayer = new BackgroundLayer("fr/iut_fbleau/Res/BackgroundAvalam.png"); + backgroundLayer.setBounds(0, 0, 725, 725); + add(backgroundLayer, JLayeredPane.FRAME_CONTENT_LAYER); + + // --- Couche highlight --- highlightLayer = new HighlightLayer(xBase, yBase, spacing, size); add(highlightLayer, JLayeredPane.DEFAULT_LAYER); - // Couche des pièces + // --- Couche des pièces --- pieceLayer = new PieceLayer(); add(pieceLayer, JLayeredPane.PALETTE_LAYER); - setPreferredSize(new Dimension(800, 800)); + setPreferredSize(new Dimension(725, 725)); refresh(); } /** - * Appelée par InteractionController quand un coup est joué. - * Permet à AvalamWindow de rafraîchir : - * - scores - * - affichage du joueur courant - * - détection fin de partie + * Appelé par le contrôleur après un coup. */ public void onBoardUpdated() { if (boardUpdateCallback != null) { @@ -82,27 +81,26 @@ public class BoardView extends JLayeredPane { } /** - * Met à jour toutes les couches visuelles. + * Rafraîchit les couches visuelles. */ public void refresh() { - // Mise à jour des pièces pieceLayer.displayGrid( boardGrid(), xBase, yBase, spacing, size, (r, c) -> controller.onPieceClicked(r, c) ); - // Mise à jour des highlights highlightLayer.setLegalMoves(controller.getLegalMoves()); + backgroundLayer.repaint(); highlightLayer.repaint(); pieceLayer.repaint(); repaint(); } /** - * Renvoie la grille de tours depuis AvalamBoard. + * Récupère la grille depuis le moteur. */ private Tower[][] boardGrid() { Tower[][] grid = new Tower[AvalamBoard.SIZE][AvalamBoard.SIZE]; @@ -112,7 +110,27 @@ public class BoardView extends JLayeredPane { grid[r][c] = board.getTowerAt(r, c); } } - return grid; } + + /** + * Composant affichant l’image de fond. + */ + private static class BackgroundLayer extends JComponent { + private Image img; + + public BackgroundLayer(String resourcePath) { + img = Toolkit.getDefaultToolkit().getImage( + getClass().getClassLoader().getResource(resourcePath) + ); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + if (img != null) { + g.drawImage(img, 0, 0, getWidth(), getHeight(), this); + } + } + } }