From ff85129e621adf2ff5d7dc1e3d2b2c41b0d63f1e Mon Sep 17 00:00:00 2001 From: Justine Yannis Date: Mon, 17 Oct 2022 20:42:13 +0200 Subject: [PATCH] =?UTF-8?q?Changement=20de=20dossier=20pour=20les=20=C3=A9?= =?UTF-8?q?v=C3=A8nements=20personnalis=C3=A9s,=20v=C3=A9rification=20du?= =?UTF-8?q?=20makefile=20et=20de=20chaque=20d=C3=A9pendances,=20ajout=20de?= =?UTF-8?q?=20variables=20pour=20raccourcir=20certaines=20d=C3=A9pendances?= =?UTF-8?q?,=20s=C3=A9paration=20du=20listener=20et=20de=20grille?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- projetAgile/Makefile | 52 ++++++++++--------- .../Controller/GrilleMouseListener.java | 2 +- .../Controller/ModelEventListener.java | 2 +- .../AbstractGridInitiater.java | 2 +- .../GridChangedListener.java | 2 +- .../EventListener => Event}/GridEvent.java | 2 +- .../EventListener => Event}/PlayerEvent.java | 2 +- .../projetAgile/Model/GrilleModel.java | 4 +- .../projetAgile/Utils/Constants.java | 6 +-- .../projetAgile/Utils/GameStatus.java | 6 +++ .../fr/iutfbleau/projetAgile/View/Grille.java | 1 - 11 files changed, 43 insertions(+), 38 deletions(-) rename projetAgile/src/fr/iutfbleau/projetAgile/{Controller/EventListener => Event}/AbstractGridInitiater.java (95%) rename projetAgile/src/fr/iutfbleau/projetAgile/{Controller/EventListener => Event}/GridChangedListener.java (74%) rename projetAgile/src/fr/iutfbleau/projetAgile/{Controller/EventListener => Event}/GridEvent.java (87%) rename projetAgile/src/fr/iutfbleau/projetAgile/{Controller/EventListener => Event}/PlayerEvent.java (85%) create mode 100644 projetAgile/src/fr/iutfbleau/projetAgile/Utils/GameStatus.java diff --git a/projetAgile/Makefile b/projetAgile/Makefile index e76d48d..e0cad95 100644 --- a/projetAgile/Makefile +++ b/projetAgile/Makefile @@ -6,58 +6,58 @@ JAR_OPTION = cvfe projetAgile.jar $(PACKAGE).main.Main -C build fr -C res #------- Dossiers ------ -View : build/$(PACKAGE_PATH)/View/Pion.class \ +View = build/$(PACKAGE_PATH)/View/Pion.class \ build/$(PACKAGE_PATH)/View/Grille.class \ build/$(PACKAGE_PATH)/View/Puissance4Panel.class \ build/$(PACKAGE_PATH)/View/TestGrille.class -Utils : build/$(PACKAGE_PATH)/Utils/Constants.class +Utils = build/$(PACKAGE_PATH)/Utils/Constants.class \ + build/$(PACKAGE_PATH)/Utils/GameStatus.class -Events : build/$(PACKAGE_PATH)/Controller/EventListener/GridChangedListener.class \ - build/$(PACKAGE_PATH)/Controller/EventListener/GridEvent.class \ - build/$(PACKAGE_PATH)/Controller/EventListener/PlayerEvent.class +Events = build/$(PACKAGE_PATH)/Event/GridChangedListener.class \ + build/$(PACKAGE_PATH)/Event/GridEvent.class \ + build/$(PACKAGE_PATH)/Event/PlayerEvent.class -Model : build/$(PACKAGE_PATH)/Model/GrilleModel.class +Model = build/$(PACKAGE_PATH)/Model/GrilleModel.class -Controller : build/$(PACKAGE_PATH)/Controller/GrilleMouseListener.class \ +Controller = build/$(PACKAGE_PATH)/Controller/GrilleMouseListener.class \ build/$(PACKAGE_PATH)/Controller/ModelEventListener.class #------- Events ------ -build/$(PACKAGE_PATH)/Controller/EventListener/PlayerEvent.class : src/$(PACKAGE_PATH)/Controller/EventListener/PlayerEvent.java +build/$(PACKAGE_PATH)/Event/PlayerEvent.class : src/$(PACKAGE_PATH)/Event/PlayerEvent.java javac $(JAVAC_OPT) $< -build/$(PACKAGE_PATH)/Controller/EventListener/GridEvent.class : src/$(PACKAGE_PATH)/Controller/EventListener/GridEvent.java +build/$(PACKAGE_PATH)/Event/GridEvent.class : src/$(PACKAGE_PATH)/Event/GridEvent.java javac $(JAVAC_OPT) $< -build/$(PACKAGE_PATH)/Controller/EventListener/GridChangedListener.class : src/$(PACKAGE_PATH)/Controller/EventListener/GridChangedListener.java \ - build/$(PACKAGE_PATH)/Controller/EventListener/GridEvent.class \ - build/$(PACKAGE_PATH)/Controller/EventListener/PlayerEvent.class +build/$(PACKAGE_PATH)/Event/GridChangedListener.class : src/$(PACKAGE_PATH)/Event/GridChangedListener.java \ + build/$(PACKAGE_PATH)/Event/GridEvent.class \ + build/$(PACKAGE_PATH)/Event/PlayerEvent.class javac $(JAVAC_OPT) $< -build/$(PACKAGE_PATH)/Controller/EventListener/AbstractGridInitiater.class : src/$(PACKAGE_PATH)/Controller/EventListener/AbstractGridInitiater.java \ - build/$(PACKAGE_PATH)/Controller/EventListener/GridChangedListener.class \ - build/$(PACKAGE_PATH)/Controller/EventListener/GridEvent.class \ - build/$(PACKAGE_PATH)/Controller/EventListener/PlayerEvent.class +build/$(PACKAGE_PATH)/Event/AbstractGridInitiater.class : src/$(PACKAGE_PATH)/Event/AbstractGridInitiater.java \ + $(Events) javac $(JAVAC_OPT) $< #------- Controleur ------ build/$(PACKAGE_PATH)/Controller/GrilleMouseListener.class : src/$(PACKAGE_PATH)/Controller/GrilleMouseListener.java \ build/$(PACKAGE_PATH)/View/Grille.class \ - build/$(PACKAGE_PATH)/Model/GrilleModel.class + build/$(PACKAGE_PATH)/Model/GrilleModel.class \ + build/$(PACKAGE_PATH)/Utils/GameStatus.class javac $(JAVAC_OPT) $< build/$(PACKAGE_PATH)/Controller/ModelEventListener.class : src/$(PACKAGE_PATH)/Controller/ModelEventListener.java \ - build/$(PACKAGE_PATH)/Controller/EventListener/GridChangedListener.class \ - build/$(PACKAGE_PATH)/Controller/EventListener/GridEvent.class \ - build/$(PACKAGE_PATH)/Controller/EventListener/PlayerEvent.class \ + build/$(PACKAGE_PATH)/Event/GridChangedListener.class \ + $(Event) build/$(PACKAGE_PATH)/View/Grille.class javac $(JAVAC_OPT) $< #------- Modele ------ build/$(PACKAGE_PATH)/Model/GrilleModel.class : src/$(PACKAGE_PATH)/Model/GrilleModel.java \ - build/$(PACKAGE_PATH)/Controller/EventListener/AbstractGridInitiater.class + build/$(PACKAGE_PATH)/Event/AbstractGridInitiater.class \ + $(Utils) javac $(JAVAC_OPT) $< #------- Utils ------ @@ -65,6 +65,9 @@ build/$(PACKAGE_PATH)/Model/GrilleModel.class : src/$(PACKAGE_PATH)/Model/Grille build/$(PACKAGE_PATH)/Utils/Constants.class : src/$(PACKAGE_PATH)/Utils/Constants.java javac $(JAVAC_OPT) $< +build/$(PACKAGE_PATH)/Utils/GameStatus.class : src/$(PACKAGE_PATH)/Utils/GameStatus.java + javac $(JAVAC_OPT) $< + #------- Vue ------ build/$(PACKAGE_PATH)/View/Pion.class : src/$(PACKAGE_PATH)/View/Pion.java \ @@ -78,7 +81,8 @@ build/$(PACKAGE_PATH)/View/Grille.class : src/$(PACKAGE_PATH)/View/Grille.java \ build/$(PACKAGE_PATH)/View/Puissance4Panel.class : src/$(PACKAGE_PATH)/View/Puissance4Panel.java \ build/$(PACKAGE_PATH)/View/Pion.class \ - build/$(PACKAGE_PATH)/View/Grille.class + build/$(PACKAGE_PATH)/View/Grille.class \ + $(Controller) javac $(JAVAC_OPT) $< build/$(PACKAGE_PATH)/View/TestGrille.class : src/$(PACKAGE_PATH)/View/TestGrille.java \ @@ -89,10 +93,10 @@ build/$(PACKAGE_PATH)/View/TestGrille.class : src/$(PACKAGE_PATH)/View/TestGril -testGrille : Controller Model View Utils Events +testGrille : build/$(PACKAGE_PATH)/View/TestGrille.class java -cp build $(PACKAGE).View.TestGrille -puissance4 : Controller Model View Utils Events +puissance4 : build/$(PACKAGE_PATH)/View/Puissance4Panel.class java -cp build $(PACKAGE).View.Puissance4Panel clear : diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/Controller/GrilleMouseListener.java b/projetAgile/src/fr/iutfbleau/projetAgile/Controller/GrilleMouseListener.java index 6c6332c..3257236 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/Controller/GrilleMouseListener.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/Controller/GrilleMouseListener.java @@ -4,7 +4,7 @@ import java.awt.event.MouseEvent; import javax.swing.event.MouseInputAdapter; import fr.iutfbleau.projetAgile.Model.GrilleModel; import fr.iutfbleau.projetAgile.View.Grille; -import static fr.iutfbleau.projetAgile.Utils.Constants.GameStatus.*; +import static fr.iutfbleau.projetAgile.Utils.GameStatus.*; public class GrilleMouseListener extends MouseInputAdapter{ diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/Controller/ModelEventListener.java b/projetAgile/src/fr/iutfbleau/projetAgile/Controller/ModelEventListener.java index 667bbea..37a2483 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/Controller/ModelEventListener.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/Controller/ModelEventListener.java @@ -1,6 +1,6 @@ package fr.iutfbleau.projetAgile.Controller; -import fr.iutfbleau.projetAgile.Controller.EventListener.*; +import fr.iutfbleau.projetAgile.Event.*; import fr.iutfbleau.projetAgile.Utils.Constants; import fr.iutfbleau.projetAgile.View.Grille; diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/Controller/EventListener/AbstractGridInitiater.java b/projetAgile/src/fr/iutfbleau/projetAgile/Event/AbstractGridInitiater.java similarity index 95% rename from projetAgile/src/fr/iutfbleau/projetAgile/Controller/EventListener/AbstractGridInitiater.java rename to projetAgile/src/fr/iutfbleau/projetAgile/Event/AbstractGridInitiater.java index 77c193c..5433c4d 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/Controller/EventListener/AbstractGridInitiater.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/Event/AbstractGridInitiater.java @@ -1,4 +1,4 @@ -package fr.iutfbleau.projetAgile.Controller.EventListener; +package fr.iutfbleau.projetAgile.Event; import javax.swing.event.EventListenerList; public abstract class AbstractGridInitiater { diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/Controller/EventListener/GridChangedListener.java b/projetAgile/src/fr/iutfbleau/projetAgile/Event/GridChangedListener.java similarity index 74% rename from projetAgile/src/fr/iutfbleau/projetAgile/Controller/EventListener/GridChangedListener.java rename to projetAgile/src/fr/iutfbleau/projetAgile/Event/GridChangedListener.java index b2b9fee..220df78 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/Controller/EventListener/GridChangedListener.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/Event/GridChangedListener.java @@ -1,4 +1,4 @@ -package fr.iutfbleau.projetAgile.Controller.EventListener; +package fr.iutfbleau.projetAgile.Event; import java.util.EventListener; diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/Controller/EventListener/GridEvent.java b/projetAgile/src/fr/iutfbleau/projetAgile/Event/GridEvent.java similarity index 87% rename from projetAgile/src/fr/iutfbleau/projetAgile/Controller/EventListener/GridEvent.java rename to projetAgile/src/fr/iutfbleau/projetAgile/Event/GridEvent.java index 3b891cb..366fd5d 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/Controller/EventListener/GridEvent.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/Event/GridEvent.java @@ -1,4 +1,4 @@ -package fr.iutfbleau.projetAgile.Controller.EventListener; +package fr.iutfbleau.projetAgile.Event; public class GridEvent { private int column; diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/Controller/EventListener/PlayerEvent.java b/projetAgile/src/fr/iutfbleau/projetAgile/Event/PlayerEvent.java similarity index 85% rename from projetAgile/src/fr/iutfbleau/projetAgile/Controller/EventListener/PlayerEvent.java rename to projetAgile/src/fr/iutfbleau/projetAgile/Event/PlayerEvent.java index ae682e7..586626a 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/Controller/EventListener/PlayerEvent.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/Event/PlayerEvent.java @@ -1,4 +1,4 @@ -package fr.iutfbleau.projetAgile.Controller.EventListener; +package fr.iutfbleau.projetAgile.Event; public class PlayerEvent { diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/Model/GrilleModel.java b/projetAgile/src/fr/iutfbleau/projetAgile/Model/GrilleModel.java index 8d7eb9d..627ce4b 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/Model/GrilleModel.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/Model/GrilleModel.java @@ -1,8 +1,8 @@ package fr.iutfbleau.projetAgile.Model; -import fr.iutfbleau.projetAgile.Controller.EventListener.AbstractGridInitiater; +import fr.iutfbleau.projetAgile.Event.AbstractGridInitiater; import fr.iutfbleau.projetAgile.Utils.Constants; -import fr.iutfbleau.projetAgile.Utils.Constants.GameStatus; +import fr.iutfbleau.projetAgile.Utils.GameStatus; public class GrilleModel extends AbstractGridInitiater{ private int[][] grille; diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/Utils/Constants.java b/projetAgile/src/fr/iutfbleau/projetAgile/Utils/Constants.java index cc7a8e6..2cd7d7b 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/Utils/Constants.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/Utils/Constants.java @@ -3,11 +3,7 @@ package fr.iutfbleau.projetAgile.Utils; import java.awt.Color; public class Constants { - - public enum GameStatus { - PLAYING, STOP, DRAW; - } - + public final static Color PLAYER_ONE_COLOR = new Color(252,21,21); public final static Color PLAYER_TWO_COLOR = new Color(241,205,15); public final static Color EMPTY_COLOR = new Color(42,42,42); diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/Utils/GameStatus.java b/projetAgile/src/fr/iutfbleau/projetAgile/Utils/GameStatus.java new file mode 100644 index 0000000..6fbe5d8 --- /dev/null +++ b/projetAgile/src/fr/iutfbleau/projetAgile/Utils/GameStatus.java @@ -0,0 +1,6 @@ +package fr.iutfbleau.projetAgile.Utils; + +public enum GameStatus { + PLAYING, STOP, DRAW; +} + diff --git a/projetAgile/src/fr/iutfbleau/projetAgile/View/Grille.java b/projetAgile/src/fr/iutfbleau/projetAgile/View/Grille.java index 0ff1557..5f11535 100644 --- a/projetAgile/src/fr/iutfbleau/projetAgile/View/Grille.java +++ b/projetAgile/src/fr/iutfbleau/projetAgile/View/Grille.java @@ -2,7 +2,6 @@ package fr.iutfbleau.projetAgile.View; import javax.swing.*; import java.awt.*; -import fr.iutfbleau.projetAgile.Controller.EventListener.*; import fr.iutfbleau.projetAgile.Utils.Constants; public class Grille extends JPanel{