timer reset

This commit is contained in:
Romain MURPHY 2025-05-09 14:59:19 +02:00
parent 89dc810d43
commit 7ec9b00a44
2 changed files with 5 additions and 3 deletions

View File

@ -180,7 +180,7 @@ public class MyInterface extends JFrame {
game.setDefaultSetup();
if (timerManager == null)
timerManager = new TimerManager(whiteTimerLabel, blackTimerLabel, () -> gameOverByTimeout(), time);
timerManager.reset();
timerManager.reset(time);
timerManager.start(true); // white starts
}
public void clickButtonAdder() {
@ -236,7 +236,7 @@ public class MyInterface extends JFrame {
game.setAutoPlayerDepth(depth);
if (timerManager == null)
timerManager = new TimerManager(whiteTimerLabel, blackTimerLabel, () -> gameOverByTimeout(), time);
timerManager.reset();
timerManager.reset(time);
timerManager.start(game.getTurnColor());
game.start();
// this.repaint();

View File

@ -60,7 +60,9 @@ public class TimerManager {
timer.stop();
}
public void reset() {
public void reset(int time) {
whiteSeconds = time;
blackSeconds = time;
updateLabel(whiteLabel, whiteSeconds);
updateLabel(blackLabel, blackSeconds);
}