working piece display + basic moves
This commit is contained in:
38
app/src/main/java/chess/view/render2D/Pieces.java
Normal file
38
app/src/main/java/chess/view/render2D/Pieces.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package chess.view.render2D;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public enum Pieces {
|
||||
WHITE_KING,
|
||||
WHITE_QUEEN,
|
||||
WHITE_KNIGHT,
|
||||
WHITE_BISHOP,
|
||||
WHITE_ROOK,
|
||||
WHITE_PAWN,
|
||||
BLACK_KING,
|
||||
BLACK_QUEEN,
|
||||
BLACK_KNIGHT,
|
||||
BLACK_BISHOP,
|
||||
BLACK_ROOK,
|
||||
BLACK_PAWN;
|
||||
|
||||
public static ImageIcon getIcon(String path) {
|
||||
/*return switch (this) {
|
||||
case WHITE_KING -> new ImageIcon(new ImageIcon(path + "white-king.png").getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
case WHITE_QUEEN -> new ImageIcon(new ImageIcon(path + "white-queen.png").getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
case WHITE_KNIGHT -> new ImageIcon(new ImageIcon(path + "white-knight.png").getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
case WHITE_BISHOP -> new ImageIcon(new ImageIcon(path + "white-bishop.png").getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
case WHITE_ROOK -> new ImageIcon(new ImageIcon(path + "white-rook.png").getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
case WHITE_PAWN -> new ImageIcon(new ImageIcon(path + "white-pawn.png").getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
case BLACK_KING -> new ImageIcon(new ImageIcon(path + "black-king.png").getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
case BLACK_QUEEN -> new ImageIcon(new ImageIcon(path + "black-queen.png").getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
case BLACK_KNIGHT -> new ImageIcon(new ImageIcon(path + "black-knight.png").getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
case BLACK_BISHOP -> new ImageIcon(new ImageIcon(path + "black-bishop.png").getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
case BLACK_ROOK -> new ImageIcon(new ImageIcon(path + "black-rook.png").getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
case BLACK_PAWN -> new ImageIcon(new ImageIcon(path + "black-pawn.png").getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
default -> null;
|
||||
};*/
|
||||
return new ImageIcon(new ImageIcon(path).getImage().getScaledInstance(100,100, Image.SCALE_SMOOTH));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user