![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
MenuClasses/Stats/Stats.h
- Committer:
- AhmedPlaymaker
- Date:
- 2019-05-08
- Revision:
- 90:741120c09784
- Parent:
- 84:9950d561fdf8
- Child:
- 91:ca8cff78f2fe
File content as of revision 90:741120c09784:
#ifndef Stats_H #define Stats_H #include "mbed.h" #include "N5110.h" #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(); /** 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); /** Used to display saved stats onto the screen.*/ void StatsDisplay(); /** * @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); /** Used to read data from the file * @param The SDFileSystem library */ void read(SDFileSystem &sd); /** 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[]); private: 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; //Pointer to the N5110 object lcd. N5110 *_lcd; }; #endif