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:
parent
ee1a4a06e0
commit
a07c178a02
4 changed files with 37 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue