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:
- 34:5cb9b4d01f5c
- Parent:
- 32:9c250eda7f3f
- Child:
- 35:fe3956825bd8
--- a/Game/Game.h Mon Apr 29 14:31:44 2019 +0000
+++ b/Game/Game.h Mon Apr 29 14:48:27 2019 +0000
@@ -11,13 +11,10 @@
#include "mbed.h"
#include "SDFileSystem.h"
-/** Game class
-*@brief A class used to instantiate a game object, this is used to run the game
-*@author Christopher Doel
-*@date April, 2019
+/** Input struct
+brief Stores current details of required inputs
*/
-
-struct Input{ //Stores current details of required inputs
+struct Input{
float x;
bool yButton;
bool aButton;
@@ -27,12 +24,22 @@
bool bCooldown;
};
-
+/** Menu slections struct
+brief stores the current selections in both the home menu and death menu
+*/
struct MenuSelections{ //stores the current selections in both menus
int deathMenuSelection;
int homeMenuSelection;
};
+
+/** Game class
+*brief A class used to instantiate a game object, this is used to run the game
+*@author Christopher Doel
+*@date April, 2019
+*/
+
+
class Game {
private:
Input input;
@@ -57,90 +64,90 @@
Renderer renderer;
int readHighScore();
- /** @brief Reads the highscore stored in the SD card
+ /** 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
+ /** brief Writes the new highscore to the SD card
*@param the highscore as an integer
*/
void resetScene();
- /** @brief generates initial positions for all cubes
+ /** brief generates initial positions for all cubes
*/
void addScore();
- /** @brief Increments the score by 1
+ /** brief Increments the score by 1
*/
void resetScore();
- /** @brief Resets the score to 0
+ /** brief Resets the score to 0
*/
void checkDespawn(Cube *cube);
- /** @brief Checks whether a cube needs to be despawned, if it does then the cube will be translated to the far side of the map
+ /** brief Checks whether a cube needs to be despawned, if it does then the cube will be translated to the far side of the map
*@param A pointer to a cube object
*/
void checkDeath(Cube *cube);
- /** @brief Checks whether a cube is too close to the user and therefore a collision has occured, the game will be stopped if true
+ /** brief Checks whether a cube is too close to the user and therefore a collision has occured, the game will be stopped if true
*@param A pointer to a cube object
*/
void cubeToBeRendered(Cube *cube, int cubeIndex);
- /** @brief Adds the cubes faces to the array of faces to be passed to the renderer
+ /** brief Adds the cubes faces to the array of faces to be passed to the renderer
*@param A pointer to a cube object
*@param The integer index of the cubes position in the cube array
*/
void moveCubes(Cube *cube);
- /** @brief Translates the cube in the z axis towards the user (speed dependant on score) and left and right depending on the joystick location
+ /** brief Translates the cube in the z axis towards the user (speed dependant on score) and left and right depending on the joystick location
*@param A pointer to a cube object
*/
void displayDeathMenu();
- /** @brief Displays the menu screen if the game has stopeed propting the user to either restart or go to the home menu
+ /** brief Displays the menu screen if the game has stopeed propting the user to either restart or go to the home menu
*/
void deathButtonSelections();
- /** @brief Determines the action to be taken depending on the button input once the game has ended
+ /** brief Determines the action to be taken depending on the button input once the game has ended
*/
void homeButtonSelections();
- /** @brief Determines the action to be taken depending on the button input at the home screen
+ /** 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
+ /** 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
+ /** 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
+ /** 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
+ /** 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
+ /** 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
+ /** 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
+ /** 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
+ /** brief Begin the execution of the game
*/
void homeScreen();
- /** @brief Displays the home screen
+ /** brief Displays the home screen
*/
void helpScreen();
- /** @brief Display the help screens
+ /** brief Display the help screens
*/
void checkNextHelpScreen();
- /** @brief Check whether the user has advanced to the next help screen by pressing the A button
+ /** 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 main loop
+ /** brief Executes the main loop
*/
};
\ No newline at end of file