mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:27:45 +00:00
FlappyBug: Persist high score to disk
Previously, the high score was only in-memory, so only persisted for as long as the FlappyBug window was open.
This commit is contained in:
parent
25c53e35e7
commit
1a2053781f
3 changed files with 30 additions and 5 deletions
|
@ -27,9 +27,9 @@ void Game::reset()
|
|||
|
||||
void Game::game_over()
|
||||
{
|
||||
if (m_highscore.value_or(0) < m_difficulty) {
|
||||
m_highscore = m_difficulty;
|
||||
}
|
||||
if (on_game_end)
|
||||
m_highscore = on_game_end(static_cast<u32>(m_difficulty));
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue