contains my game for the embedded systems project 2645

Dependencies:   mbed FXOS8700CQQQ

Committer:
OmarAlebiary
Date:
Fri May 03 11:14:16 2019 +0000
Revision:
38:2c0bad326668
Parent:
37:b0e7e44503af
added comments to Menus.h

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 37:b0e7e44503af 35 //displays the welcome menu
OmarAlebiary 28:39607fb67e88 36 menus.welcomeMenu(pad,lcd);
OmarAlebiary 37:b0e7e44503af 37 //displays the instructions menu
OmarAlebiary 28:39607fb67e88 38 menus.InstructionsMenu(pad,lcd);
OmarAlebiary 37:b0e7e44503af 39 //displays the 2nd instructions menu
OmarAlebiary 37:b0e7e44503af 40 menus.SecondInstructionsMenu(lcd);
OmarAlebiary 37:b0e7e44503af 41 //displays the loading menu
OmarAlebiary 37:b0e7e44503af 42 menus.loading_menu(lcd);
OmarAlebiary 38:2c0bad326668 43 //displays the credits menu
OmarAlebiary 38:2c0bad326668 44 menus.credits(lcd,pad);
OmarAlebiary 33:24ef796ff2c8 45 //keeps looping to display main menu and method calls
OmarAlebiary 28:39607fb67e88 46 while(1){
OmarAlebiary 33:24ef796ff2c8 47 //displays main menu and each related method call when button pressed
OmarAlebiary 33:24ef796ff2c8 48 menus.drawMenu(lcd,pad);
OmarAlebiary 28:39607fb67e88 49 }
OmarAlebiary 28:39607fb67e88 50
OmarAlebiary 28:39607fb67e88 51
OmarAlebiary 28:39607fb67e88 52 }
OmarAlebiary 28:39607fb67e88 53
OmarAlebiary 28:39607fb67e88 54 @endcode
OmarAlebiary 28:39607fb67e88 55 */
OmarAlebiary 28:39607fb67e88 56
OmarAlebiary 28:39607fb67e88 57
OmarAlebiary 28:39607fb67e88 58 class Menus{
OmarAlebiary 28:39607fb67e88 59
OmarAlebiary 28:39607fb67e88 60 public:
OmarAlebiary 28:39607fb67e88 61 /**
OmarAlebiary 28:39607fb67e88 62 * @brief default constructor
OmarAlebiary 28:39607fb67e88 63 */
OmarAlebiary 28:39607fb67e88 64 Menus();
OmarAlebiary 28:39607fb67e88 65 /**
OmarAlebiary 29:e660274d8222 66 * @brief default destructor
OmarAlebiary 29:e660274d8222 67 */
OmarAlebiary 29:e660274d8222 68 ~Menus();
OmarAlebiary 29:e660274d8222 69 /**
OmarAlebiary 28:39607fb67e88 70 * @brief welcome menu method
OmarAlebiary 28:39607fb67e88 71 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 72 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 73 */
OmarAlebiary 28:39607fb67e88 74 void welcomeMenu(Gamepad &pad,N5110 &lcd);
OmarAlebiary 28:39607fb67e88 75 /**
OmarAlebiary 28:39607fb67e88 76 * @brief instructions menu method
OmarAlebiary 28:39607fb67e88 77 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 78 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 79 */
OmarAlebiary 28:39607fb67e88 80 void InstructionsMenu(Gamepad &pad,N5110 &lcd);
OmarAlebiary 28:39607fb67e88 81
OmarAlebiary 28:39607fb67e88 82 /**
OmarAlebiary 28:39607fb67e88 83 * @brief draw menu method that draws the main menu
OmarAlebiary 28:39607fb67e88 84 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 85 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 86 */
OmarAlebiary 28:39607fb67e88 87 void drawMenu(N5110 &lcd,Gamepad &pad);
OmarAlebiary 28:39607fb67e88 88 /**
OmarAlebiary 28:39607fb67e88 89 * @brief method that displays credits of the owner of the game
OmarAlebiary 28:39607fb67e88 90 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 91 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 92 */
OmarAlebiary 28:39607fb67e88 93 void credits(N5110 &lcd,Gamepad &pad);
OmarAlebiary 28:39607fb67e88 94 /**
OmarAlebiary 28:39607fb67e88 95 * @brief method that checks buttons pressed in the main menu
OmarAlebiary 28:39607fb67e88 96 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 97 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 98 */
OmarAlebiary 28:39607fb67e88 99 void check_button_pressed(Gamepad &pad,N5110 &lcd);
OmarAlebiary 28:39607fb67e88 100 /**
OmarAlebiary 28:39607fb67e88 101 * @brief method that draws loading bar
OmarAlebiary 28:39607fb67e88 102 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 28:39607fb67e88 103 */
OmarAlebiary 28:39607fb67e88 104 void loading_menu(N5110 &lcd);
OmarAlebiary 31:4d4a9d78cae5 105 /**
OmarAlebiary 31:4d4a9d78cae5 106 * @brief second instructions menu method
OmarAlebiary 31:4d4a9d78cae5 107 * @param lcd @details calls the lcd object to be passed to the methods called inside this method
OmarAlebiary 31:4d4a9d78cae5 108 */
OmarAlebiary 31:4d4a9d78cae5 109 void SecondInstructionsMenu(N5110 &lcd);
OmarAlebiary 33:24ef796ff2c8 110
OmarAlebiary 28:39607fb67e88 111 private:
OmarAlebiary 28:39607fb67e88 112 RocketRacer Rocket_Race;
OmarAlebiary 28:39607fb67e88 113 GameTones tone;
OmarAlebiary 28:39607fb67e88 114
OmarAlebiary 28:39607fb67e88 115
OmarAlebiary 28:39607fb67e88 116 };
OmarAlebiary 28:39607fb67e88 117
OmarAlebiary 28:39607fb67e88 118 #endif