added a class that could be implemented with more work and time.
This commit is contained in:
parent
a3e65fcb81
commit
efd5d21f19
|
|
@ -13,7 +13,6 @@ public class Main {
|
||||||
Board testBoard = new Board(8, 8);
|
Board testBoard = new Board(8, 8);
|
||||||
testBoard.populateBoard();
|
testBoard.populateBoard();
|
||||||
System.out.println(testBoard.toString());
|
System.out.println(testBoard.toString());
|
||||||
|
|
||||||
// launches graphical interface :
|
// launches graphical interface :
|
||||||
MyInterface mjf = new MyInterface();
|
MyInterface mjf = new MyInterface();
|
||||||
mjf.setVisible(true);
|
mjf.setVisible(true);
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ public class Board {
|
||||||
Piece selectedCell;
|
Piece selectedCell;
|
||||||
private ArrayList<Move> moveHistory = new ArrayList<>();
|
private ArrayList<Move> moveHistory = new ArrayList<>();
|
||||||
public Piece enPassantTargetPawn = null;
|
public Piece enPassantTargetPawn = null;
|
||||||
|
public Interface Color;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int turnNumber = 0;
|
int turnNumber = 0;
|
||||||
|
|
||||||
|
|
@ -20,6 +23,7 @@ public class Board {
|
||||||
lNum=lineNum;
|
lNum=lineNum;
|
||||||
cells = new Piece[cNum][lNum]; // creation du tableau de pieces
|
cells = new Piece[cNum][lNum]; // creation du tableau de pieces
|
||||||
selectedCell=null;
|
selectedCell=null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
|
|
@ -34,7 +38,6 @@ public class Board {
|
||||||
return turnNumber;
|
return turnNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isTurnWhite() {
|
public boolean isTurnWhite() {
|
||||||
return getTurnNumber() % 2 == 0;
|
return getTurnNumber() % 2 == 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import javax.swing.JPanel;
|
||||||
import backend.Game;
|
import backend.Game;
|
||||||
import backend.Piece;
|
import backend.Piece;
|
||||||
import backend.PieceType;
|
import backend.PieceType;
|
||||||
|
import backend.Interface;
|
||||||
|
|
||||||
public class JPanelChessBoard extends JPanel {
|
public class JPanelChessBoard extends JPanel {
|
||||||
|
|
||||||
|
|
@ -31,6 +32,9 @@ public class JPanelChessBoard extends JPanel {
|
||||||
private boolean selectedPieceIsWhite;
|
private boolean selectedPieceIsWhite;
|
||||||
private PieceType selectedPieceType;
|
private PieceType selectedPieceType;
|
||||||
private boolean pieceAdderMode;
|
private boolean pieceAdderMode;
|
||||||
|
private Interface color;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public JPanelChessBoard(MyInterface itf) {
|
public JPanelChessBoard(MyInterface itf) {
|
||||||
super();
|
super();
|
||||||
|
|
@ -81,7 +85,7 @@ public class JPanelChessBoard extends JPanel {
|
||||||
@Override
|
@Override
|
||||||
protected void paintComponent(Graphics g) {
|
protected void paintComponent(Graphics g) {
|
||||||
super.paintComponent(g);
|
super.paintComponent(g);
|
||||||
this.setBackground(Color.PINK);
|
this.setBackground(Color.DARK_GRAY);
|
||||||
if(pieceSelectorMode) {
|
if(pieceSelectorMode) {
|
||||||
g.drawImage(
|
g.drawImage(
|
||||||
spriteSheet,
|
spriteSheet,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue