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.
Dependencies: mbed
Diff: Game/Game.h
- Revision:
- 28:f8ff7c8c1627
- Parent:
- 27:e46af658c67a
- Child:
- 29:4a02f0bae202
--- a/Game/Game.h Thu Apr 04 20:13:39 2019 +0000
+++ b/Game/Game.h Thu Apr 04 21:47:00 2019 +0000
@@ -30,14 +30,18 @@
class Game {
private:
Input input;
- bool backToMenu;
int noOfCubes;
+
+ bool playing;
+ int score;
+ int highScore;
+
+ bool inHomeMenu;
+ int help;
int homeSelection;
bool deathMenuSelection;
- bool playing;
- int score;
- bool selectDisable;
- int help;
+ FILE *filePointer;
+
Vector2D coord;
Cube cubeArray[25];
Face faceArray[150];
@@ -48,6 +52,14 @@
Gamepad gamepad;
Rasturizer renderer;
+ int readHighScore();
+ /** @brief Reads the highscore stored in the SD card
+ *@returns the highscore as an integer
+ */
+ void writeHighScore(int score);
+ /** @brief Writes the new highscore to the SD card
+ *@param the highscore as an integer
+ */
void resetScene();
/** @brief generates initial positions for all cubes
*/
@@ -84,18 +96,42 @@
/** @brief Determines the action to be taken depending on the button input at the home screen
*/
void disableAButton(bool a);
+ /** @brief Disables the A button for 300 milliseconds after being pressed to prevent erroneous input from switch bouncing
+ *@param a boolean indicating whether the button has been pressed
+ */
void disableYButton(bool y);
+ /** @brief Disables the Y button for 300 milliseconds after being pressed to prevent erroneous input from switch bouncing
+ *@param a boolean indicating whether the button has been pressed
+ */
void disableBButton(bool b);
+ /** @brief Disables the B button for 300 milliseconds after being pressed to prevent erroneous input from switch bouncing
+ *@param a boolean indicating whether the button has been pressed
+ */
void enableA();
+ /** @brief Is called using a ticker 300 milliseconds after the A button is pressed to re-enable it
+ */
void enableY();
+ /** @brief Is called using a ticker 300 milliseconds after the Y button is pressed to re-enable it
+ */
void enableB();
+ /** @brief Is called using a ticker 300 milliseconds after the B button is pressed to re-enable it
+ */
void processInput();
-
+ /** @brief Process the joystick and Y, B and A button inputs and store their values in a structure
+ */
void play();
+ /** @brief Begin the execution of the game
+ */
void helpScreen();
+ /** @brief Display the help screens
+ */
void checkNextHelpScreen();
+ /** @brief Check whether the user has advanced to the next help screen by pressing the A button
+ */
public:
Game();
+ /**brief The constructor of the Face class which instantiates the game object.
+ */
void run();
/** @brief Executes the game loop
*/