Skip to content
Snippets Groups Projects
Commit 288d68cf authored by David Reiser's avatar David Reiser
Browse files

images as symbols

parent df0569f9
No related branches found
No related tags found
Loading
......@@ -71,12 +71,22 @@ public class GameUI extends Application{
return;
}
board.tiles[index].set_owner(board.currentPlayer);
buttons[index].setText(board.currentPlayer == 0 ? "X" : "O");
String imageSymbols = board.currentPlayer == 0 ? getClass().getResource("/textures/1_0.png").toExternalForm() : getClass().getResource("/textures/0_0.png").toExternalForm();
Image image = new Image(""+ imageSymbols);
ImageView imageView = new ImageView(image);
imageView.setFitWidth(135);
imageView.setFitHeight(135);
imageView.setPreserveRatio(true);
buttons[index].setGraphic(imageView);
board.turnEnd();
updatePlayerTurn(board.currentPlayer);
if (board.victoryCheck()) {
//statusLabel.setText("Player " + (board.currentPlayer == 0 ? "X" : "O") + " wins!");
playerLabel.setText("Player " + (board.currentPlayer == 0 ? "X" : "O") + " wins!");
updatePlayerScore();
return;
}
......@@ -85,10 +95,6 @@ public class GameUI extends Application{
playerLabel.setText("It's a draw!");
return;
}
//ImageView imageView = new ImageView(new Image(tile.getImagePath()));
//button.setGraphic(imageView);
}
private void updatePlayerTurn(int currentPlayer) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment