changed color of the chessboard and higlited

This commit is contained in:
Jérôme BEDIER 2025-05-22 22:31:51 +02:00
parent 3b41d77eea
commit 9ded1e1879
1 changed files with 4 additions and 4 deletions

View File

@ -80,7 +80,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.black); this.setBackground(Color.darkGray);
if(pieceSelectorMode) { if(pieceSelectorMode) {
g.drawImage( g.drawImage(
spriteSheet, spriteSheet,
@ -97,16 +97,16 @@ public class JPanelChessBoard extends JPanel {
float cellWidth = cellWidth(); float cellWidth = cellWidth();
float cellHeight = cellHeight(); float cellHeight = cellHeight();
g.setColor(Color.white); g.setColor(Color.pink);
for(int x=0; x<myGame.getWidth();x++) { for(int x=0; x<myGame.getWidth();x++) {
for (int y=0; y<myGame.getHeight(); y++) { for (int y=0; y<myGame.getHeight(); y++) {
boolean isSelect = myGame.isSelected(x,y); boolean isSelect = myGame.isSelected(x,y);
boolean isHighlight = myGame.isHighlighted(x,y); boolean isHighlight = myGame.isHighlighted(x,y);
if(isSelect) { if(isSelect) {
g.setColor(Color.blue); g.setColor(Color.red);
} }
if(isHighlight) { if(isHighlight) {
g.setColor(Color.yellow); g.setColor(Color.blue);
} }
if((x+y)%2==1 || isSelect || isHighlight) { if((x+y)%2==1 || isSelect || isHighlight) {
g.fillRect( g.fillRect(