Bug quand on recommence une partie un pion reste en surbrillance (algo pas du tout optimisé O(2n)
This commit is contained in:
parent
3d3149a913
commit
1fc4a36f50
@ -2,6 +2,7 @@ package fr.iutfbleau.projetAgile.Controller;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.event.MouseInputAdapter;
|
||||
import fr.iutfbleau.projetAgile.Utils.Constants;
|
||||
|
||||
public class GrilleMouseListener extends MouseInputAdapter{
|
||||
|
||||
@ -13,14 +14,15 @@ public class GrilleMouseListener extends MouseInputAdapter{
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
this.controller.hoverGrille(e.getX());
|
||||
if(Constants.DRAW_POSITION)
|
||||
this.controller.hoverGrille(e.getX());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if(e.getButton() == MouseEvent.BUTTON1) {
|
||||
this.controller.verifyColumn(e.getX());
|
||||
this.controller.hoverGrille(e.getX());
|
||||
this.mouseMoved(e);;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ public class Constants {
|
||||
public final static int EMPTY_PLAYER = 0;
|
||||
public final static int PLAYER_ONE = 1;
|
||||
public final static int PLAYER_TWO = 2;
|
||||
public static final boolean DRAW_POSITION = true;
|
||||
public static int PIECE_MARGIN = 10;
|
||||
public static int COLUMN_COUNT = 7;
|
||||
public static int ROW_COUNT = 6;
|
||||
|
@ -56,6 +56,7 @@ public class Grille extends JPanel{
|
||||
for (int x = 0; x < this.column; x++) {
|
||||
for (int y = 0; y < this.row; y++) {
|
||||
this.grille[x][y].setPlayer(Constants.EMPTY_PLAYER);
|
||||
this.grille[x][y].setHover(false);
|
||||
}
|
||||
}
|
||||
this.repaint();
|
||||
|
Loading…
Reference in New Issue
Block a user