1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

Solitaire: Add statusbar segment to display elapsed time

The timer begins after the new-game animation ends, and stops when
either the game-over animation begins or the new-game animation is
started again.
This commit is contained in:
Timothy Flynn 2021-05-05 14:06:28 -04:00 committed by Andreas Kling
parent ee1a4a06e0
commit a07c178a02
4 changed files with 37 additions and 1 deletions

View file

@ -76,6 +76,9 @@ void Game::start_game_over_animation()
m_game_over_animation = true;
start_timer(s_timer_interval_ms);
if (on_game_end)
on_game_end();
}
void Game::stop_game_over_animation()
@ -93,6 +96,9 @@ void Game::setup()
{
stop_game_over_animation();
if (on_game_end)
on_game_end();
for (auto& stack : m_stacks)
stack.clear();
@ -370,6 +376,9 @@ void Game::paint_event(GUI::PaintEvent& event)
stack(Stock).push(m_new_deck.take_last());
m_new_game_animation = false;
stop_timer();
if (on_game_start)
on_game_start();
}
}
}