mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
legal moves now get highlighted in red
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -26,6 +26,7 @@ public class ReversiLayer extends Layer{
|
||||
|
||||
|
||||
reload();
|
||||
canvas.drawLegalMoves(reversi.getLegalMoves());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user