Byggern
highscore.h
1 #pragma once
2 
3 #include <avr/io.h>
4 
5 #define MAX_NAME_LENGTH 10
6 
15 namespace Highscore {
16 
23  struct Score {
24  uint16_t score;
25  uint8_t name_length;
26  char *name;
27 
28  Score(uint16_t score, char *name, uint8_t name_length) : score(score), name_length(name_length), name(name) {};
29 
34  void operator=(const Score &score);
35  };
36 
37 
45  class Highscore {
46 
47  private:
48 
53 
57  uint8_t length = 0;
58 
59 
60  public:
61 
65  Highscore();
66 
71  void SaveScore(Score &score);
72 
77  void StoreScores();
78 
82  void LoadScores();
83 
90  uint8_t GetHighscores(uint8_t first, Score ** &scores);
91 
98  void ClearHighscores();
99  };
100 }
Score ** score
Definition: highscore.h:52
Represents a score.
Definition: highscore.h:23
void operator=(const Score &score)
Keeps track of the highscore and stores it to the EEPROM using Score objects.
Definition: highscore.h:15