Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
MenuClasses/StartScreen/StartScreen.h
- Committer:
- AhmedPlaymaker
- Date:
- 2019-05-08
- Revision:
- 88:1e2e70a484e7
- Parent:
- 84:9950d561fdf8
- Child:
- 91:ca8cff78f2fe
File content as of revision 88:1e2e70a484e7:
#ifndef StartScreen_H #define StartScreen_H #include "mbed.h" #include "N5110.h" #include "Gamepad.h" #include "Settings.h" #include "Stats.h" #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(); /** 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); /**This function initialises the class objects that are the diffrent parts of the game (Eg: SnakeFood Class).*/ void object_initialisations(); /** Draws the Title Sprite onto the screen and plays theme song.*/ void titleScreen(); /** Instructs the user about how to progress after the title screen has been displayed.*/ void instruct(); /** Shows who the author of the game is before starting the game. This function's functionality can be hidden using settings.*/ void credits(); /** 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); /** 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(); /** 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(); /** Waits for the user to select a menu option and calls a related function*/ void menu(); /** Displays all the Main Menu contents to the player and allows the user to navigate using drawSelectionArrow().*/ void mainMenu(); /** Draws an arrow to aid the selection of main menu options.*/ void drawSelectionArrow(); /** Calls the next menu item dependent on the input in mainMenu().*/ void nextMenu(); /** Obtains the user input on the game mode they would like to play on (Joystick or Motion Control).*/ void game_mode(); /** Value of g_mode is changed in this function that allows the choice between joystick/motion control.*/ void selectMode(); /** Changes the page displayed in the game mode menu*/ void scrollModeSelection(); /** Promts the user to press A to centre position their angle during the game if Motion Control is selected.*/ void motionControlInstructions(); /** Obtains the user input on the game speed to be used later in the SnakevsBlock class.*/ void game_speed(); /** 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(); /** Changes the page displayed in the game speed menu*/ void scrollSpeedSelection(); //SETTING THE GAME SPEED AND GAME MODE. int fps; // this sends over the game speed int g_mode; //this helps to select between joystick and motion control. int speed_index; //MENU OPTIONS INDEX. int menu_index; //VARIABLE USED TO DECIDE WEATHER TO SHOW CREDITS. int showCredits; //VARIABLE USED TO DECIDE THE WAIT TIME OF THE MENU PAGES. float controlSensitivity; 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; //Pointer to the N5110 object lcd. N5110 *_lcd; }; #endif