contains my game for the embedded systems project 2645
Dependencies: mbed FXOS8700CQQQ
GameMenus/Menus.h@31:4d4a9d78cae5, 2019-04-28 (annotated)
- Committer:
- OmarAlebiary
- Date:
- Sun Apr 28 02:43:58 2019 +0000
- Revision:
- 31:4d4a9d78cae5
- Parent:
- 29:e660274d8222
- Child:
- 33:24ef796ff2c8
fixed instructions menu not showing properly
Who changed what in which revision?
User | Revision | Line number | New 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 | 28:39607fb67e88 | 9 | @brief C++ class containing the game menu 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 | 28:39607fb67e88 | 37 | //keeps looping untill the player loses |
OmarAlebiary | 28:39607fb67e88 | 38 | while(1){ |
OmarAlebiary | 28:39607fb67e88 | 39 | Rocket_Racer.Game_Loop(lcd,pad); |
OmarAlebiary | 28:39607fb67e88 | 40 | } |
OmarAlebiary | 28:39607fb67e88 | 41 | |
OmarAlebiary | 28:39607fb67e88 | 42 | |
OmarAlebiary | 28:39607fb67e88 | 43 | } |
OmarAlebiary | 28:39607fb67e88 | 44 | |
OmarAlebiary | 28:39607fb67e88 | 45 | @endcode |
OmarAlebiary | 28:39607fb67e88 | 46 | */ |
OmarAlebiary | 28:39607fb67e88 | 47 | |
OmarAlebiary | 28:39607fb67e88 | 48 | |
OmarAlebiary | 28:39607fb67e88 | 49 | class Menus{ |
OmarAlebiary | 28:39607fb67e88 | 50 | |
OmarAlebiary | 28:39607fb67e88 | 51 | public: |
OmarAlebiary | 28:39607fb67e88 | 52 | /** |
OmarAlebiary | 28:39607fb67e88 | 53 | * @brief default constructor |
OmarAlebiary | 28:39607fb67e88 | 54 | */ |
OmarAlebiary | 28:39607fb67e88 | 55 | Menus(); |
OmarAlebiary | 28:39607fb67e88 | 56 | /** |
OmarAlebiary | 29:e660274d8222 | 57 | * @brief default destructor |
OmarAlebiary | 29:e660274d8222 | 58 | */ |
OmarAlebiary | 29:e660274d8222 | 59 | ~Menus(); |
OmarAlebiary | 29:e660274d8222 | 60 | /** |
OmarAlebiary | 28:39607fb67e88 | 61 | * @brief welcome menu method |
OmarAlebiary | 28:39607fb67e88 | 62 | * @param pad @details calls the Gamepad object to be passed to the methods called inside this method |
OmarAlebiary | 28:39607fb67e88 | 63 | * @param lcd @details calls the lcd object to be passed to the methods called inside this method |
OmarAlebiary | 28:39607fb67e88 | 64 | */ |
OmarAlebiary | 28:39607fb67e88 | 65 | void welcomeMenu(Gamepad &pad,N5110 &lcd); |
OmarAlebiary | 28:39607fb67e88 | 66 | /** |
OmarAlebiary | 28:39607fb67e88 | 67 | * @brief instructions menu method |
OmarAlebiary | 28:39607fb67e88 | 68 | * @param pad @details calls the Gamepad object to be passed to the methods called inside this method |
OmarAlebiary | 28:39607fb67e88 | 69 | * @param lcd @details calls the lcd object to be passed to the methods called inside this method |
OmarAlebiary | 28:39607fb67e88 | 70 | */ |
OmarAlebiary | 28:39607fb67e88 | 71 | void InstructionsMenu(Gamepad &pad,N5110 &lcd); |
OmarAlebiary | 28:39607fb67e88 | 72 | |
OmarAlebiary | 28:39607fb67e88 | 73 | /** |
OmarAlebiary | 28:39607fb67e88 | 74 | * @brief draw menu method that draws the main menu |
OmarAlebiary | 28:39607fb67e88 | 75 | * @param pad @details calls the Gamepad object to be passed to the methods called inside this method |
OmarAlebiary | 28:39607fb67e88 | 76 | * @param lcd @details calls the lcd object to be passed to the methods called inside this method |
OmarAlebiary | 28:39607fb67e88 | 77 | */ |
OmarAlebiary | 28:39607fb67e88 | 78 | void drawMenu(N5110 &lcd,Gamepad &pad); |
OmarAlebiary | 28:39607fb67e88 | 79 | /** |
OmarAlebiary | 28:39607fb67e88 | 80 | * @brief method that displays credits of the owner of the game |
OmarAlebiary | 28:39607fb67e88 | 81 | * @param pad @details calls the Gamepad object to be passed to the methods called inside this method |
OmarAlebiary | 28:39607fb67e88 | 82 | * @param lcd @details calls the lcd object to be passed to the methods called inside this method |
OmarAlebiary | 28:39607fb67e88 | 83 | */ |
OmarAlebiary | 28:39607fb67e88 | 84 | void credits(N5110 &lcd,Gamepad &pad); |
OmarAlebiary | 28:39607fb67e88 | 85 | /** |
OmarAlebiary | 28:39607fb67e88 | 86 | * @brief method that checks buttons pressed in the main menu |
OmarAlebiary | 28:39607fb67e88 | 87 | * @param pad @details calls the Gamepad object to be passed to the methods called inside this method |
OmarAlebiary | 28:39607fb67e88 | 88 | * @param lcd @details calls the lcd object to be passed to the methods called inside this method |
OmarAlebiary | 28:39607fb67e88 | 89 | */ |
OmarAlebiary | 28:39607fb67e88 | 90 | void check_button_pressed(Gamepad &pad,N5110 &lcd); |
OmarAlebiary | 28:39607fb67e88 | 91 | /** |
OmarAlebiary | 28:39607fb67e88 | 92 | * @brief method that draws loading bar |
OmarAlebiary | 28:39607fb67e88 | 93 | * @param lcd @details calls the lcd object to be passed to the methods called inside this method |
OmarAlebiary | 28:39607fb67e88 | 94 | */ |
OmarAlebiary | 28:39607fb67e88 | 95 | void loading_menu(N5110 &lcd); |
OmarAlebiary | 31:4d4a9d78cae5 | 96 | /** |
OmarAlebiary | 31:4d4a9d78cae5 | 97 | * @brief second instructions menu method |
OmarAlebiary | 31:4d4a9d78cae5 | 98 | * @param lcd @details calls the lcd object to be passed to the methods called inside this method |
OmarAlebiary | 31:4d4a9d78cae5 | 99 | */ |
OmarAlebiary | 31:4d4a9d78cae5 | 100 | void SecondInstructionsMenu(N5110 &lcd); |
OmarAlebiary | 28:39607fb67e88 | 101 | private: |
OmarAlebiary | 28:39607fb67e88 | 102 | RocketRacer Rocket_Race; |
OmarAlebiary | 28:39607fb67e88 | 103 | GameTones tone; |
OmarAlebiary | 28:39607fb67e88 | 104 | |
OmarAlebiary | 28:39607fb67e88 | 105 | |
OmarAlebiary | 28:39607fb67e88 | 106 | }; |
OmarAlebiary | 28:39607fb67e88 | 107 | |
OmarAlebiary | 28:39607fb67e88 | 108 | #endif |