Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SavedGames/SavedGames.h
- Committer:
- evanso
- Date:
- 2020-05-19
- Revision:
- 51:35cb8e604b72
- Parent:
- 50:13c8710985f4
- Child:
- 52:feb8cf28bcff
File content as of revision 51:35cb8e604b72:
#ifndef SAVEDGAMES_H #define SAVEDGAMES_H // Included libraries ---------------------------------------------------------- #include "mbed.h" #include "N5110.h" #include "Gamepad.h" #include "SDFileSystem.h" #include <vector> struct SavedGamesData{ int score; /**< Bool to draw circle one */ int lives; /**< Bool to draw circle two */ int smart_bombs; /**< Fill type of circle one */ int alien_number; /**< Fill type of circle two */ }; /** SavedGames class * @brief Stores saved games on sd card, stores score, lives, smart bombs and * number of current alliens * @author Benjamin Evans, University of Leeds * @date May 2020 */ class SavedGames{ public: /** Constructor */ SavedGames(); /** Destructor */ ~SavedGames(); /** Initalises SavedGames * @param lcd @details N5110 object * @param sd @details sd card object */ void init(SDFileSystem &sd,N5110 &lcd); /** Check if sd card is inserted and print message if not * @param lcd @details N5110 object * @param sd @details sd card object */ void check_sd_present(SDFileSystem &sd,N5110 &lcd); /** Check if saveddata files opens correctly * @param lcd @details N5110 object * @param sd @details sd card object */ void check_open_file(SDFileSystem &sd,N5110 &lcd); /** Adds saved data to sd card * @param SavedGamesData @details Saved game data struct * @param sd @details sd card object */ void add_saved_data(SDFileSystem &sd,struct SavedGamesData); // Accessors and mutators -------------------------------------------------- /** Gets error flag * @return error_; */ bool get_error(); private: // Varibles ---------------------------------------------------------------- /** Flag for error, true = error */ bool error_; /** Vector to store saved game data*/ std::vector<SavedGamesData> saved_data_vector; }; #endif