Byggern
|
Keeps track of the highscore and stores it to the EEPROM. More...
#include <highscore.h>
Public Member Functions | |
Highscore () | |
void | SaveScore (Score &score) |
void | StoreScores () |
void | LoadScores () |
uint8_t | GetHighscores (uint8_t first, Score **&scores) |
void | ClearHighscores () |
Private Attributes | |
Score ** | score |
uint8_t | length = 0 |
Keeps track of the highscore and stores it to the EEPROM.
The Highscore class keeps track of the highscores, and provides a method for saving them to the EEPROM for persistent storage.
Highscore::Highscore::Highscore | ( | ) |
Automatically loads highscores from EEPROM.
void Highscore::Highscore::ClearHighscores | ( | ) |
Clears the list of highscores. Of course, this does not clear the stored highscore list from the EEPROM. If you want to clear the EEPROM, please run ClearHighscores() followed by StoreScores().
uint8_t Highscore::Highscore::GetHighscores | ( | uint8_t | first, |
Score **& | scores | ||
) |
Returns an array of highscores
first | The first highscore to return by index. |
scores | The array to change to point to the highscore list. |
void Highscore::Highscore::LoadScores | ( | ) |
Loads the highscore list from the EEPROM.
void Highscore::Highscore::SaveScore | ( | Score & | score | ) |
Saves the score to the highscore list.
score | The score to save. |
void Highscore::Highscore::StoreScores | ( | ) |
Store the highscore list to the EEPROM. This can take a few seconds.
|
private |
Length of the score variable.
|
private |
Contains a sorted list of scores.