Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified players.dat
Binary file not shown.
3 changes: 3 additions & 0 deletions src/main/java/co/ppg2/controllers/GameController.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,7 @@ public void updateLeaderboard(char token) {

LeaderboardPopup.showLeaderboard(players);
}

public void resetGame() {
}
}
10 changes: 10 additions & 0 deletions src/main/java/co/ppg2/views/GameView.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import javafx.scene.control.Button;

/**
* Represents the graphical interface for the TicTacToe game.
Expand Down Expand Up @@ -44,6 +45,10 @@ public void launchGame() {

labelInstructions = new LabelInstructions(gameController.getCurrentPlayer().getUsername() + "'s turn");

// Create the reset button
Button resetButton = new Button("Reset");
resetButton.setOnAction(e -> resetGame());

BorderPane borderPane = new BorderPane();
borderPane.setCenter(gridPane);
borderPane.setBottom(labelInstructions);
Expand All @@ -54,6 +59,11 @@ public void launchGame() {
primaryStage.show();
}

private void resetGame() {
gameController.resetGame(); // Assuming gameController has a reset logic
launchGame(); // Relaunch the game UI
}

/**
* Updates the label displaying the current game status.
*
Expand Down