1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

Solitaire: Only start timer when a move happens

Previously, the timer started if you clicked within the game area,
whether that was on a card or not. Now, we only start when you click
on a card or otherwise attempt a move.

As a bonus, we now immediately update the status bar time indicator
on game start, instead of having to wait until 1 second has elapsed.
This commit is contained in:
Sam Atkins 2021-06-12 19:45:47 +01:00 committed by Linus Groh
parent 8ee447b718
commit 679f831451
2 changed files with 7 additions and 5 deletions

View file

@ -129,6 +129,7 @@ int main(int argc, char** argv)
game.on_game_start = [&]() {
seconds_elapsed = 0;
timer->start();
statusbar.set_text(2, "Time: 00:00:00");
};
game.on_game_end = [&](Solitaire::GameOverReason reason, uint32_t score) {
if (timer->is_active())