Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
Diff: MenuClasses/Stats/Stats.h
- Revision:
- 90:741120c09784
- Parent:
- 84:9950d561fdf8
- Child:
- 91:ca8cff78f2fe
--- a/MenuClasses/Stats/Stats.h Wed May 08 19:05:30 2019 +0000 +++ b/MenuClasses/Stats/Stats.h Wed May 08 21:01:20 2019 +0000 @@ -6,50 +6,54 @@ #include "Gamepad.h" #include "SDFileSystem.h" +/** Stats Class +@brief Class for saving the highest level achived and displaying when asked. +@author Ahmed N.Adamjee +@date 8th May 2019 +*/ class Stats { public: + /** Constructor */ Stats(); + /** Destructor */ ~Stats(); - /** Initialise Stats - * - * This function passes the pointers to the stats class so that it can control the screen and the gamepad. + /** Gets pointers of lcd and pad from int main() to be used privately in the entire class.. + * @param pointer to the N5110 object in main, address of this pointer is saved to make availability to the entire class, without passing address to each function. + * @param pointer to the gamepad object in main, address of this pointer is saved to make availability to the entire class, without passing address to each function. */ void init(N5110 *lcd, Gamepad *pad); - /** Stats Display - * - * This function is used to configure stats. - */ + /** Used to display saved stats onto the screen.*/ void StatsDisplay(); - /** write - * - * This function is used to write to the file - */ + /** + * @brief Used to write stats to the SD card. + * @param level is as the name implies, the current game level while playing. + * @param The SDFileSystem library + */ void write(int level, SDFileSystem &sd); - /** Read - * - * This function is used to read from the file + /** Used to read data from the file + * @param The SDFileSystem library */ void read(SDFileSystem &sd); - /** delete file - * - * This function allows us to delete the file + /** Allows us to delete the file if required. + * @brief not used in the working version but used when i need to delete data from the sd card. + * @param filename[] saves the name of the file we want to delete. */ void delete_file(char filename[]); + - char bufferlevel[14]; //this helps me print the highest level on screen. - private: - int _stored_top_level; - int _current_level; - int _top_level; + int _stored_top_level; //stores the old top level from what is read from file. + int _current_level; //stores the current level. + int _top_level; //stores the new top level after comparison. + char _bufferlevel[14]; //this helps me print the highest level on screen. //Pointer to the game pad object pad. Gamepad *_pad;