legal moves now get highlighted in red

This commit is contained in:
Ticho Hidding
2025-10-09 15:27:58 +02:00
parent 5a3490af2e
commit 5dda85248e
4 changed files with 104 additions and 7 deletions

View File

@@ -104,6 +104,7 @@ public abstract class GameCanvas {
graphics.setFill(color);
graphics.fillOval(x, y, width, height);
IO.println("gothere");
}
public void resize(int width, int height) {

View File

@@ -22,13 +22,14 @@ public class ReversiCanvas extends GameCanvas{
public void drawLegalMoves(Game.Move[] moves){
mostRecentLegalMoves = moves;
for(Game.Move move : moves){
drawDot(Color.RED,move.position());
IO.println("Legal Moves:" + move.position());
drawDot(new Color(1f,0,0,0.25f),move.position());
}
}
public void removeLegalMoves(){
if (mostRecentLegalMoves != null){
for(Game.Move move : mostRecentLegalMoves){
drawDot(Color.GRAY,move.position()); //todo get current background color
drawDot(Color.GRAY,move.position()); //todo get current background color or make this redraw the entire board
}
}
mostRecentLegalMoves = null;

View File

@@ -26,6 +26,7 @@ public class ReversiLayer extends Layer{
reload();
canvas.drawLegalMoves(reversi.getLegalMoves());
}
@Override