![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
Diff: MenuClasses/StartScreen/StartScreen.h
- Revision:
- 88:1e2e70a484e7
- Parent:
- 84:9950d561fdf8
- Child:
- 91:ca8cff78f2fe
diff -r 871d9fecb593 -r 1e2e70a484e7 MenuClasses/StartScreen/StartScreen.h --- a/MenuClasses/StartScreen/StartScreen.h Wed May 08 16:39:24 2019 +0000 +++ b/MenuClasses/StartScreen/StartScreen.h Wed May 08 18:20:23 2019 +0000 @@ -9,127 +9,87 @@ #include "SDFileSystem.h" #include "Tutorial.h" +/** StartScreen Class +@brief Class for displaying the menu, calling all the classes that follow the menu (eg: Settings) and the animation when the game starts. +@author Ahmed N.Adamjee +@date 8th May 2019 +*/ class StartScreen { public: + /** Constructor */ StartScreen(); + /** Destructor */ ~StartScreen(); - /** Initialise StartScreen - * - * This function initialises the Game Interface and restarts the display. + /** Initialises all parameters of the Game Interface, assigns some default values and calls other init() functions. + * @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); - /** Initialise objects - * - * This function initialises the objects that are used to functionalise the game. - */ + /**This function initialises the class objects that are the diffrent parts of the game (Eg: SnakeFood Class).*/ void object_initialisations(); - /** Draw - * - * This function draws the Sprite onto the screen. - */ + /** Draws the Title Sprite onto the screen and plays theme song.*/ void titleScreen(); - /** Instruct - * - * This function updates the user about how to progress after the game banner has been displayed.. - */ + /** Instructs the user about how to progress after the title screen has been displayed.*/ void instruct(); - /** Display userID - * - * This function shows who the author of the game is before showing the menu screen. - */ + /** Shows who the author of the game is before starting the game. This function's functionality can be hidden using settings.*/ void credits(); - /** Read Stats - * - * This function just reads the current top level stored in the sd card and saves it for displaying in the menu. + /** Reads stored statistics using the Stats class in the sd card and saves it for displaying in the menu. + *@param The SDFileSystem library + @code + _stats.read(sd); + @endcode */ void read_stats(SDFileSystem &sd); - /** Check Back Pressed - * - * This function makes a centralised approach to check when back is pressed in a loop, so that it can be used to exit it and also go to. - * the previous menu option. + /** Checks BACK if button pressed in a loop, can be used to exit it and also remember if true/false and used for various conditions. + * @return True if the BACK pressed, else False. */ bool checkBackPressed(); - /** Check Start/A Pressed - * - * This function makes a centralised approach to check when Start/A is pressed in a loop, so that it can be used to exit it and also go to. - * the next menu option. + /** Checks if START or A buttons are pressed in a loop, can be used to terminate it and also remember if true/false and used for various conditions. + * @return True if the START or A pressed, else False. */ bool checkStartorAPressed(); - /** The Menu Screen - * - * This function obtains the user input on how they want to progress. - */ + /** Waits for the user to select a menu option and calls a related function*/ void menu(); - /** Main Menu - * - * This function displays all the Main Menu contents to the player. - */ + /** Displays all the Main Menu contents to the player and allows the user to navigate using drawSelectionArrow().*/ void mainMenu(); - /** Draw Selection Arrow - * - * This function draws arrow to select main menu options. - */ + /** Draws an arrow to aid the selection of main menu options.*/ void drawSelectionArrow(); - /** Implementing The First Menu Screen - * - * This function just implements the things decided in main menu. - */ + /** Calls the next menu item dependent on the input in mainMenu().*/ void nextMenu(); - /** The Second Menu Screen - * - * This function obtains the user input on the game type they would like to play. - */ + /** Obtains the user input on the game mode they would like to play on (Joystick or Motion Control).*/ void game_mode(); - /** Displaying Mode Options - * - * This function displays game_mode contents. - */ + /** Value of g_mode is changed in this function that allows the choice between joystick/motion control.*/ void selectMode(); - /** Selecting the game mode - * - * value of g_mode is changed in this function that allows the choise beteen joystick/motion control.. - */ + /** Changes the page displayed in the game mode menu*/ void scrollModeSelection(); - /** Motion Control Instructions - * - * This promts the user to press A to centre position their angle if Motion Control is selected.. - */ + /** Promts the user to press A to centre position their angle during the game if Motion Control is selected.*/ void motionControlInstructions(); - /** The Third Menu Screen - * - * This function obtains the user input on the game speed that suits them. - */ + /** Obtains the user input on the game speed to be used later in the SnakevsBlock class.*/ void game_speed(); - /** Displaying GAME speed Contents - * - * This function just displays game_speed contents. - */ + /** Value of fps is changed in this function that will be used as frames per second in my game loop in main.cpp.*/ void selectSpeed(); - /** Implementing GS - * - * This function just decides what has to be done next. - */ + /** Changes the page displayed in the game speed menu*/ void scrollSpeedSelection(); @@ -147,16 +107,16 @@ //VARIABLE USED TO DECIDE THE WAIT TIME OF THE MENU PAGES. float controlSensitivity; - //VARIABLES TO TOGGLE BACK AND FORTH BETWEEN MENU OPTIONS. - bool _backPressed; //remembers if back is pressed. - bool _startPressed; //remembers if start is pressed. - private: //OBJECT DECLARATIONS Stats _stats; Settings _settings; Tutorial _tutorial; + + //VARIABLES TO TOGGLE BACK AND FORTH BETWEEN MENU OPTIONS. + bool _backPressed; //remembers if back is pressed. + bool _startPressed; //remembers if start is pressed. //Pointer to the game pad object pad. Gamepad *_pad;