ELEC2645 (2018/19) / Mbed 2 deprecated EL17MCD

Dependencies:   mbed

Committer:
el17mcd
Date:
Thu May 09 13:10:16 2019 +0000
Revision:
21:44e87d88afe2
Parent:
18:165e3d49daa8
Doxygen comments added.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17mcd 16:a2c945279b79 1 #ifndef SCORES_H
el17mcd 16:a2c945279b79 2 #define SCORES_H
el17mcd 16:a2c945279b79 3
el17mcd 16:a2c945279b79 4 #include "mbed.h"
el17mcd 16:a2c945279b79 5 #include "N5110.h"
el17mcd 16:a2c945279b79 6 #include "Gamepad.h"
el17mcd 16:a2c945279b79 7
el17mcd 21:44e87d88afe2 8 /** Menus Class
el17mcd 21:44e87d88afe2 9 * @brief Calculates, ranks and displays the players' scores.
el17mcd 21:44e87d88afe2 10 * @author Maxim C. Delacoe
el17mcd 21:44e87d88afe2 11 * @date April 2019
el17mcd 21:44e87d88afe2 12 */
el17mcd 16:a2c945279b79 13
el17mcd 16:a2c945279b79 14 class Scores
el17mcd 16:a2c945279b79 15 {
el17mcd 16:a2c945279b79 16
el17mcd 16:a2c945279b79 17 public:
el17mcd 21:44e87d88afe2 18 // Constructor and destructor.
el17mcd 21:44e87d88afe2 19 /**
el17mcd 21:44e87d88afe2 20 * @brief Constructor
el17mcd 21:44e87d88afe2 21 * @details Sets the highscores to 0.
el17mcd 21:44e87d88afe2 22 */
el17mcd 17:cb39d9fa08dc 23 Scores();
el17mcd 21:44e87d88afe2 24 /**
el17mcd 21:44e87d88afe2 25 * @brief Destructor
el17mcd 21:44e87d88afe2 26 * @details Non user specified.
el17mcd 21:44e87d88afe2 27 */
el17mcd 17:cb39d9fa08dc 28 ~Scores();
el17mcd 21:44e87d88afe2 29 // Member Methods
el17mcd 21:44e87d88afe2 30 /**
el17mcd 21:44e87d88afe2 31 * @brief Calculate's the winner's score based on number of turns played and initial health.
el17mcd 21:44e87d88afe2 32 * @param turns @details The number of turns the game has elapsed
el17mcd 21:44e87d88afe2 33 * @param health @details The initial health of the tanks
el17mcd 21:44e87d88afe2 34 */
el17mcd 17:cb39d9fa08dc 35 float score_calculator(int turns, int health);
el17mcd 21:44e87d88afe2 36 /**
el17mcd 21:44e87d88afe2 37 * @brief Displays the winner's score on the screen.
el17mcd 21:44e87d88afe2 38 * @param current @details The concluding score for the current game
el17mcd 21:44e87d88afe2 39 * @param lcd @details The lcd object from N5110 class.
el17mcd 21:44e87d88afe2 40 */
el17mcd 17:cb39d9fa08dc 41 void display_score(float current, N5110 &lcd);
el17mcd 21:44e87d88afe2 42 /**
el17mcd 21:44e87d88afe2 43 * @brief Displays the highest three score on the screen.
el17mcd 21:44e87d88afe2 44 * @param lcd @details The lcd object from N5110 class.
el17mcd 21:44e87d88afe2 45 */
el17mcd 17:cb39d9fa08dc 46 void display_top_scores(N5110 &lcd);
el17mcd 16:a2c945279b79 47
el17mcd 16:a2c945279b79 48 private:
el17mcd 16:a2c945279b79 49
el17mcd 17:cb39d9fa08dc 50 void _add_to_top_scores(float new_score);
el17mcd 16:a2c945279b79 51
el17mcd 17:cb39d9fa08dc 52 float _top_three[3];
el17mcd 16:a2c945279b79 53 };
el17mcd 16:a2c945279b79 54
el17mcd 16:a2c945279b79 55 #endif // SCORES_H