Ben Evans University Second Year Project. Game Called Defender.
Embed:
(wiki syntax)
Show/hide line numbers
HighScore.h
00001 #ifndef HIGHSCORE_H 00002 #define HIGHSCORE_H 00003 00004 // Included Headers ------------------------------------------------------------ 00005 #include "mbed.h" 00006 #include "N5110.h" 00007 #include "SDFileSystem.h" 00008 #include "Sprites.h" 00009 #include "SDErrors.h" 00010 00011 /** High Score class 00012 * @brief Displays the highest score 00013 * @author Benjamin Evans, University of Leeds 00014 * @date May 2020 00015 */ 00016 class HighScore:public SDErrors{ 00017 public: 00018 /** Constructor */ 00019 HighScore(); 00020 00021 /** Destructor */ 00022 ~HighScore(); 00023 00024 /** Initialises HighScore 00025 */ 00026 void init(); 00027 00028 /** Saves the sore if a new High score 00029 * @param lcd @details N5110 object 00030 * @param sd @details sd card object 00031 * @param new_high_score 00032 */ 00033 void save_new_high_score(SDFileSystem &sd, N5110 &lcd, 00034 int new_high_score); 00035 00036 /** Reads and returns the highest score 00037 * @param sd @details sd card object 00038 * @return high_score 00039 */ 00040 int read_high_score(SDFileSystem &sd); 00041 00042 /** Draws no high scores screen 00043 * @param lcd @details N5110 object 00044 */ 00045 void no_high_scores(N5110 &lcd); 00046 00047 /** Runs the save test unit test 00048 * @param lcd @details N5110 object 00049 * @param sd @details sd card object 00050 */ 00051 void run_save_test(SDFileSystem &sd, N5110 &lcd); 00052 00053 private: 00054 // Function prototypes ----------------------------------------------------- 00055 00056 /** Shows error if high data files opens incorrectly 00057 * @param lcd @details N5110 object 00058 */ 00059 void error_open_file(N5110 &lcd); 00060 00061 /** Save test unit test, checks the saving and reading functions work 00062 * @param lcd @details N5110 object 00063 * @param sd @details sd card object 00064 * @param score @details score at end of game 00065 */ 00066 bool save_test(int score,SDFileSystem &sd, N5110 &lcd); 00067 00068 }; 00069 #endif
Generated on Fri Aug 5 2022 06:55:07 by
1.7.2