Modification Makefile et fonction switchPlayer qui était prévu pour un seul type de constantes

This commit is contained in:
Justine Yannis 2022-10-20 14:25:27 +02:00
parent 43ae63c17c
commit 0c032153ea
5 changed files with 19 additions and 19 deletions

View File

@ -5,8 +5,11 @@ PACKAGE_PATH = fr/iutfbleau/projetAgile
JAR_OPTION = cvfe projetAgile.jar $(PACKAGE).main.Main -C build fr -C res
#BBUT PAR DEFAUT
run: puissance4
java -jar Puissance4.jar
run: ArgileGames.jar
java -jar ArgileGames.jar
ArgileGames.jar : build/$(PACKAGE_PATH)/Main.class
jar cvfe ArgileGames.jar $(PACKAGE_PATH).Main -C build fr -C res images
#------- Dossiers ------
View = build/$(PACKAGE_PATH)/View/Pion.class \
@ -26,7 +29,7 @@ Events = build/$(PACKAGE_PATH)/Event/GridChangedListener.class \
Model = build/$(PACKAGE_PATH)/Model/GrilleModel.class
Controller = build/$(PACKAGE_PATH)/Controller/GrilleMouseListener.class \
build/$(PACKAGE_PATH)/Controller/ModelEventListener.class \
build/$(PACKAGE_PATH)/Controller/ModelEventListener.class
#------- Events ------
build/$(PACKAGE_PATH)/Event/PlayerEvent.class : src/$(PACKAGE_PATH)/Event/PlayerEvent.java
@ -63,7 +66,7 @@ build/$(PACKAGE_PATH)/Controller/ObservateurMenuSouris.class : src/$(PACKAGE_PAT
build/$(PACKAGE_PATH)/View/BoutonsMenu.class
javac $(JAVAC_OPT) $<
build/$(PACKAGE_PATH)/Puissance4Controller.class : src/$(PACKAGE_PATH)/Controller/Puissance4Controller.java \
build/$(PACKAGE_PATH)/Controller/Puissance4Controller.class : src/$(PACKAGE_PATH)/Controller/Puissance4Controller.java \
build/$(PACKAGE_PATH)/Model/GrilleModel.class \
build/$(PACKAGE_PATH)/View/Grille.class \
build/$(PACKAGE_PATH)/Utils/GameStatus.class \
@ -101,26 +104,25 @@ build/$(PACKAGE_PATH)/View/Puissance4Panel.class : src/$(PACKAGE_PATH)/View/Pui
build/$(PACKAGE_PATH)/View/Pion.class \
build/$(PACKAGE_PATH)/View/Grille.class \
build/$(PACKAGE_PATH)/Controller/ResetGame.class \
build/$(PACKAGE_PATH)/View/Menu.class
build/$(PACKAGE_PATH)/Utils/Constants.class
javac $(JAVAC_OPT) $<
jar cvfe Puissance4.jar $(PACKAGE_PATH).Main -C build fr -C res images
build/$(PACKAGE_PATH)/View/BoutonsMenu.class : src/$(PACKAGE_PATH)/View/BoutonsMenu.java
javac $(JAVAC_OPT) $<
build/$(PACKAGE_PATH)/View/Menu.class : src/$(PACKAGE_PATH)/View/Menu.java \
build/$(PACKAGE_PATH)/Controller/ObservateurMenuSouris.class \
build/$(PACKAGE_PATH)/View/BoutonsMenu.class
build/$(PACKAGE_PATH)/Controller/ObservateurMenuSouris.class \
build/$(PACKAGE_PATH)/View/BoutonsMenu.class
javac $(JAVAC_OPT) $<
build/$(PACKAGE_PATH)/Main.class : src/$(PACKAGE_PATH)/Main.java
build/$(PACKAGE_PATH)/Main.class : src/$(PACKAGE_PATH)/Main.java \
build/$(PACKAGE_PATH)/View/Menu.class \
build/$(PACKAGE_PATH)/Controller/Puissance4Controller.class \
build/$(PACKAGE_PATH)/View/Grille.class \
build/$(PACKAGE_PATH)/Model/GrilleModel.class
javac $(JAVAC_OPT) $<
puissance4 : build/$(PACKAGE_PATH)/Main.class \
build/$(PACKAGE_PATH)/Puissance4Controller.class \
$(Model)
doc :
javadoc -d doc src/$(PACKAGE_PATH)/View/*.java src/$(PACKAGE_PATH)/Controller/*.java src/$(PACKAGE_PATH)/Utils/*.java src/$(PACKAGE_PATH)/Model/*.java src/$(PACKAGE_PATH)/Event/*.java

View File

@ -18,7 +18,6 @@ public class ModelEventListener implements GridChangedListener {
@Override
public void playerChanged(PlayerEvent e) {
//System.out.println("Tour du joueur : " + (e.getNewPlayer() == Constants.PLAYER_ONE ? "Rouge" : "Jaune"));
this.panel.changeLabel(e.getNewPlayer());
}
}

View File

@ -126,7 +126,7 @@ public class GrilleModel extends AbstractGridInitiater{
public void switchPlayer() {
int oldPlayer = this.playerTurn;
this.playerTurn = (this.playerTurn + 1) % 2;
this.playerTurn = this.playerTurn == Constants.PLAYER_ONE ? Constants.PLAYER_TWO : Constants.PLAYER_ONE;
firePlayerChanged(oldPlayer, this.playerTurn);
}

View File

@ -8,9 +8,9 @@ public class Constants {
public final static Color PLAYER_TWO_COLOR = new Color(241,205,15);
public final static Color BACKGROUND_COLOR = new Color(31,31,31);
public final static Color EMPTY_COLOR = new Color(42,42,42);
public final static int EMPTY_PLAYER = -1;
public final static int PLAYER_ONE = 0;
public final static int PLAYER_TWO = 1;
public final static int EMPTY_PLAYER = 0;
public final static int PLAYER_ONE = 1;
public final static int PLAYER_TWO = 2;
public static int PIECE_MARGIN = 10;
public static int COLUMN_COUNT = 7;
public static int ROW_COUNT = 6;

View File

@ -108,7 +108,6 @@ public class Puissance4Panel extends JPanel{
public void changeLabel(int joueur) {
switch(joueur){
case Constants.PLAYER_ONE:
this.label.setText("Tour Joueur 1");
break;