Fix piece colors

main
Brett 2022-12-18 00:07:20 -05:00
parent b2a2b493da
commit e4d9c1334c
7 changed files with 15 additions and 14 deletions

View File

@ -7,8 +7,8 @@ import static ui.Display.loadImage;
public class Bishop extends ChessPiece {
private Image whiteBishop = loadImage("./resources/chess_piece_2_black_bishop.png");
private Image blackBishop = loadImage("./resources/chess_piece_2_white_bishop.png");
private Image whiteBishop = loadImage("./resources/chess_piece_2_white_bishop.png");
private Image blackBishop = loadImage("./resources/chess_piece_2_black_bishop.png");
public Bishop(Board b, boolean isWhite, int x, int y) {
super(b,isWhite,x,y);

View File

@ -7,8 +7,8 @@ import static ui.Display.loadImage;
public class King extends ChessPiece {
private final Image whiteKing = loadImage("./resources/chess_piece_2_black_king.png");
private final Image blackKing = loadImage("./resources/chess_piece_2_white_king.png");
private final Image whiteKing = loadImage("./resources/chess_piece_2_white_king.png");
private final Image blackKing = loadImage("./resources/chess_piece_2_black_king.png");
public King(Board b, boolean isWhite, int x, int y) {
super(b,isWhite,x,y);

View File

@ -7,8 +7,8 @@ import static ui.Display.loadImage;
public class Knight extends ChessPiece {
private Image whiteKnight = loadImage("./resources/chess_piece_2_black_knight.png");
private Image blackKnight = loadImage("./resources/chess_piece_2_white_knight.png");
private final Image whiteKnight = loadImage("./resources/chess_piece_2_white_knight.png");
private final Image blackKnight = loadImage("./resources/chess_piece_2_black_knight.png");
public Knight(Board b, boolean isWhite, int x, int y) {
super(b,isWhite,x,y);

View File

@ -7,8 +7,8 @@ import java.util.ArrayList;
public class Pawn extends ChessPiece {
private Image white = Display.loadImage("./resources/chess_piece_2_black_pawn.png");
private Image black = Display.loadImage("./resources/chess_piece_2_white_pawn.png");
private Image white = Display.loadImage("./resources/chess_piece_2_white_pawn.png");
private Image black = Display.loadImage("./resources/chess_piece_2_black_pawn.png");
public Pawn(Board b, boolean isWhite, int x, int y) {
super(b,isWhite,x,y);

View File

@ -7,8 +7,8 @@ import static ui.Display.loadImage;
public class Queen extends ChessPiece {
private Image whiteQueen = loadImage("./resources/chess_piece_2_black_queen.png");
private Image blackQueen = loadImage("./resources/chess_piece_2_white_queen.png");
private Image whiteQueen = loadImage("./resources/chess_piece_2_white_queen.png");
private Image blackQueen = loadImage("./resources/chess_piece_2_black_queen.png");
public Queen(Board b, boolean isWhite, int x, int y) {
super(b,isWhite,x,y);

View File

@ -7,8 +7,8 @@ import static ui.Display.loadImage;
public class Rook extends ChessPiece {
private Image whiteRook = loadImage("./resources/chess_piece_2_black_rook.png");
private Image blackRook = loadImage("./resources/chess_piece_2_white_rook.png");
private Image whiteRook = loadImage("./resources/chess_piece_2_white_rook.png");
private Image blackRook = loadImage("./resources/chess_piece_2_black_rook.png");
public Rook(Board b, boolean isWhite, int x, int y) {
super(b,isWhite,x,y);

View File

@ -37,8 +37,9 @@ public class Display extends JFrame implements MouseListener {
super.paint(g);
for (int i = 0; i < b.size(); i++){
for (int j = 0; j < b.size(); j++){
if (b.get(i,j) != null)
g.drawImage(b.get(i,j).getImage(), xOffset + (i) * width, yOffset + (j) * height, null);
var p = b.get(i,j);
if (p != null)
g.drawImage(p.getImage(), xOffset + (i) * width, yOffset + (j) * height, null);
}
}
if (movingPointX != -1 && movingPointY != -1) {