contains my game for the embedded systems project 2645

Dependencies:   mbed FXOS8700CQQQ

Committer:
OmarAlebiary
Date:
Fri May 03 00:27:52 2019 +0000
Revision:
33:24ef796ff2c8
Parent:
31:4d4a9d78cae5
Child:
37:b0e7e44503af
added in-line comments to all classes of the project

Who changed what in which revision?

UserRevisionLine numberNew contents of line
OmarAlebiary 28:39607fb67e88 1 #ifndef MENUS_H
OmarAlebiary 28:39607fb67e88 2 #define MENUS_H
OmarAlebiary 28:39607fb67e88 3 #include "RocketRacer.h"
OmarAlebiary 28:39607fb67e88 4 #include "GameSprites.h"
OmarAlebiary 28:39607fb67e88 5 #include "GameTones.h"
OmarAlebiary 28:39607fb67e88 6
OmarAlebiary 28:39607fb67e88 7 /** Menus class
OmarAlebiary 28:39607fb67e88 8
OmarAlebiary 33:24ef796ff2c8 9 @brief C++ class containing the game menus and the interface
OmarAlebiary 28:39607fb67e88 10
OmarAlebiary 28:39607fb67e88 11 @version 1.0
OmarAlebiary 28:39607fb67e88 12
OmarAlebiary 28:39607fb67e88 13 @author Omar Alebiary
OmarAlebiary 28:39607fb67e88 14
OmarAlebiary 28:39607fb67e88 15 @date April 2019
OmarAlebiary 28:39607fb67e88 16
OmarAlebiary 28:39607fb67e88 17 @code
OmarAlebiary 28:39607fb67e88 18
OmarAlebiary 28:39607fb67e88 19 #include "mbed.h"
OmarAlebiary 28:39607fb67e88 20 #include "N5110.h"
OmarAlebiary 28:39607fb67e88 21 #include "Gamepad.h"
OmarAlebiary 28:39607fb67e88 22 #include "RocketRacer.h"
OmarAlebiary 28:39607fb67e88 23
OmarAlebiary 28:39607fb67e88 24 // objects
OmarAlebiary 28:39607fb67e88 25 Gamepad pad;
OmarAlebiary 28:39607fb67e88 26 RocketRacer rc;
OmarAlebiary 28:39607fb67e88 27 Menus menus;
OmarAlebiary 28:39607fb67e88 28
OmarAlebiary 28:39607fb67e88 29
OmarAlebiary 28:39607fb67e88 30
OmarAlebiary 28:39607fb67e88 31 int main(){
OmarAlebiary 28:39607fb67e88 32
OmarAlebiary 28:39607fb67e88 33
OmarAlebiary 28:39607fb67e88 34 setup();
OmarAlebiary 28:39607fb67e88 35 menus.welcomeMenu(pad,lcd);
OmarAlebiary 28:39607fb67e88 36 menus.InstructionsMenu(pad,lcd);
OmarAlebiary 33:24ef796ff2c8 37 //keeps looping to display main menu and method calls
OmarAlebiary 28:39607fb67e88 38 while(1){
OmarAlebiary 33:24ef796ff2c8 39 //displays main menu and each related method call when button pressed
OmarAlebiary 33:24ef796ff2c8 40 menus.drawMenu(lcd,pad);
OmarAlebiary 28:39607fb67e88 41 }
OmarAlebiary 28:39607fb67e88 42
OmarAlebiary 28:39607fb67e88 43
OmarAlebiary 28:39607fb67e88 44 }
OmarAlebiary 28:39607fb67e88 45
OmarAlebiary 28:39607fb67e88 46 @endcode
OmarAlebiary 28:39607fb67e88 47 */
OmarAlebiary 28:39607fb67e88 48
OmarAlebiary 28:39607fb67e88 49
OmarAlebiary 28:39607fb67e88 50 class Menus{
OmarAlebiary 28:39607fb67e88 51
OmarAlebiary 28:39607fb67e88 52 public:
OmarAlebiary 28:39607fb67e88 53 /**
OmarAlebiary 28:39607fb67e88 54 * @brief default constructor
OmarAlebiary 28:39607fb67e88 55 */
OmarAlebiary 28:39607fb67e88 56 Menus();
OmarAlebiary 28:39607fb67e88 57 /**
OmarAlebiary 29:e660274d8222 58 * @brief default destructor
OmarAlebiary 29:e660274d8222 59 */
OmarAlebiary 29:e660274d8222 60 ~Menus();
OmarAlebiary 29:e660274d8222 61 /**
OmarAlebiary 28:39607fb67e88 62 * @brief welcome menu method
OmarAlebiary 28:39607fb67e88 63 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 64 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 65 */
OmarAlebiary 28:39607fb67e88 66 void welcomeMenu(Gamepad &pad,N5110 &lcd);
OmarAlebiary 28:39607fb67e88 67 /**
OmarAlebiary 28:39607fb67e88 68 * @brief instructions menu method
OmarAlebiary 28:39607fb67e88 69 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 70 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 71 */
OmarAlebiary 28:39607fb67e88 72 void InstructionsMenu(Gamepad &pad,N5110 &lcd);
OmarAlebiary 28:39607fb67e88 73
OmarAlebiary 28:39607fb67e88 74 /**
OmarAlebiary 28:39607fb67e88 75 * @brief draw menu method that draws the main menu
OmarAlebiary 28:39607fb67e88 76 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 77 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 78 */
OmarAlebiary 28:39607fb67e88 79 void drawMenu(N5110 &lcd,Gamepad &pad);
OmarAlebiary 28:39607fb67e88 80 /**
OmarAlebiary 28:39607fb67e88 81 * @brief method that displays credits of the owner of the game
OmarAlebiary 28:39607fb67e88 82 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 83 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 84 */
OmarAlebiary 28:39607fb67e88 85 void credits(N5110 &lcd,Gamepad &pad);
OmarAlebiary 28:39607fb67e88 86 /**
OmarAlebiary 28:39607fb67e88 87 * @brief method that checks buttons pressed in the main menu
OmarAlebiary 28:39607fb67e88 88 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 89 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 90 */
OmarAlebiary 28:39607fb67e88 91 void check_button_pressed(Gamepad &pad,N5110 &lcd);
OmarAlebiary 28:39607fb67e88 92 /**
OmarAlebiary 28:39607fb67e88 93 * @brief method that draws loading bar
OmarAlebiary 28:39607fb67e88 94 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 95 */
OmarAlebiary 28:39607fb67e88 96 void loading_menu(N5110 &lcd);
OmarAlebiary 31:4d4a9d78cae5 97 /**
OmarAlebiary 31:4d4a9d78cae5 98 * @brief second instructions menu method
OmarAlebiary 31:4d4a9d78cae5 99 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 31:4d4a9d78cae5 100 */
OmarAlebiary 31:4d4a9d78cae5 101 void SecondInstructionsMenu(N5110 &lcd);
OmarAlebiary 33:24ef796ff2c8 102
OmarAlebiary 28:39607fb67e88 103 private:
OmarAlebiary 28:39607fb67e88 104 RocketRacer Rocket_Race;
OmarAlebiary 28:39607fb67e88 105 GameTones tone;
OmarAlebiary 28:39607fb67e88 106
OmarAlebiary 28:39607fb67e88 107
OmarAlebiary 28:39607fb67e88 108 };
OmarAlebiary 28:39607fb67e88 109
OmarAlebiary 28:39607fb67e88 110 #endif