Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
highlight selected piece for move
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Procio committed Dec 8, 2020
1 parent a00cb76 commit 1fcf9b8
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ Testing
* [x] Client creates it's own thread for server in case of game on 1 machine
* [x] Communication in own thread
* [x] Add modifiers to class datastructures (for security)
* [x] Highlight selected piece in GUI
* [ ] FIX - Check on king against random computer player can desync BoardPane and Board
* [ ] FIX - Remote game doesn't even remotely work...
* [ ] Highlight selected piece in GUI
* [ ] Actually add checkmate and en passant
* [ ] Replace client/server communication with JSON
7 changes: 7 additions & 0 deletions src/main/java/client/GUI/BoardPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import logic.Move;
import logic.PlayerColor;
Expand Down Expand Up @@ -82,8 +83,14 @@ public void setMove(MouseEvent mouseEvent){
}
if (this.move.getSrc() == null) {
this.move.setSrc((PosXY) ((Node) mouseEvent.getSource()).getUserData());
this.squareButtons[this.move.getSrc().getX()][this.move.getSrc().getY()].setBackground(
new Background(new BackgroundFill(Paint.valueOf("green"), null, null)));
}else{
this.move.setDest((PosXY) ((Node) mouseEvent.getSource()).getUserData());
String color = (this.move.getSrc().getX() + this.move.getSrc().getY()) % 2 != 0 ?
"grey" : "white";
this.squareButtons[this.move.getSrc().getX()][this.move.getSrc().getY()].setBackground(
new Background(new BackgroundFill(Paint.valueOf(color), null, null)));
/* get move out to Runner */
try {
this.outMoveReady.put(true);
Expand Down
Binary file modified target/classes/client/GUI/BoardPane.class
Binary file not shown.
Binary file added target/test-classes/BoardTests.class
Binary file not shown.
Binary file added target/test-classes/KingTests.class
Binary file not shown.
Binary file added target/test-classes/PawnTests.class
Binary file not shown.
Binary file added target/test-classes/QueenTests.class
Binary file not shown.

0 comments on commit 1fcf9b8

Please sign in to comment.