contains my game for the embedded systems project 2645
Dependencies: mbed FXOS8700CQQQ
main.cpp@28:39607fb67e88, 2019-04-24 (annotated)
- Committer:
- OmarAlebiary
- Date:
- Wed Apr 24 10:19:07 2019 +0000
- Revision:
- 28:39607fb67e88
- Parent:
- 27:771d186b1bc8
- Child:
- 29:e660274d8222
added doxygen comments to RocketRacer.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
OmarAlebiary | 27:771d186b1bc8 | 1 | /* |
OmarAlebiary | 27:771d186b1bc8 | 2 | Electronic & Computer Engineering |
OmarAlebiary | 27:771d186b1bc8 | 3 | ELEC2645 Embedded Systems Project |
OmarAlebiary | 27:771d186b1bc8 | 4 | University of Leeds |
OmarAlebiary | 27:771d186b1bc8 | 5 | Name: Omar Alebiary |
OmarAlebiary | 27:771d186b1bc8 | 6 | Username: el17oa |
OmarAlebiary | 27:771d186b1bc8 | 7 | ID : 201172644 |
OmarAlebiary | 27:771d186b1bc8 | 8 | Date: 15/3/2019 |
OmarAlebiary | 27:771d186b1bc8 | 9 | */ |
OmarAlebiary | 22:3e6ff378d651 | 10 | #include "RocketRacer.h" |
OmarAlebiary | 22:3e6ff378d651 | 11 | #include "Menus.h" |
OmarAlebiary | 26:35714debc45f | 12 | #include "tests.h" |
OmarAlebiary | 23:2ca9735b16ef | 13 | |
OmarAlebiary | 22:3e6ff378d651 | 14 | // objects |
OmarAlebiary | 22:3e6ff378d651 | 15 | |
OmarAlebiary | 22:3e6ff378d651 | 16 | /** |
OmarAlebiary | 22:3e6ff378d651 | 17 | * @brief initializing the Gamepad object |
OmarAlebiary | 22:3e6ff378d651 | 18 | */ |
OmarAlebiary | 22:3e6ff378d651 | 19 | Gamepad pad; |
OmarAlebiary | 22:3e6ff378d651 | 20 | /** |
OmarAlebiary | 22:3e6ff378d651 | 21 | * @brief initializing the RocketRacer object |
OmarAlebiary | 22:3e6ff378d651 | 22 | */ |
OmarAlebiary | 22:3e6ff378d651 | 23 | RocketRacer Rocket_Racer; |
OmarAlebiary | 22:3e6ff378d651 | 24 | /** |
OmarAlebiary | 22:3e6ff378d651 | 25 | * @brief initializing the lcd object and assigning the pins on the gamepad to it |
OmarAlebiary | 22:3e6ff378d651 | 26 | */ |
OmarAlebiary | 22:3e6ff378d651 | 27 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
OmarAlebiary | 22:3e6ff378d651 | 28 | /** |
OmarAlebiary | 22:3e6ff378d651 | 29 | * @brief initializing the Menus object |
OmarAlebiary | 22:3e6ff378d651 | 30 | */ |
OmarAlebiary | 22:3e6ff378d651 | 31 | Menus menus; |
OmarAlebiary | 26:35714debc45f | 32 | /** |
OmarAlebiary | 26:35714debc45f | 33 | * @brief initializing the tests object |
OmarAlebiary | 26:35714debc45f | 34 | */ |
OmarAlebiary | 26:35714debc45f | 35 | tests test; |
OmarAlebiary | 22:3e6ff378d651 | 36 | |
OmarAlebiary | 22:3e6ff378d651 | 37 | // prototypes |
OmarAlebiary | 22:3e6ff378d651 | 38 | /** |
OmarAlebiary | 22:3e6ff378d651 | 39 | * @brief object initialization method |
OmarAlebiary | 22:3e6ff378d651 | 40 | * @param None @details method that initializes objects like lcd,gampad and sets the default |
OmarAlebiary | 22:3e6ff378d651 | 41 | * contrast of the lcd and brightness |
OmarAlebiary | 22:3e6ff378d651 | 42 | */ |
OmarAlebiary | 22:3e6ff378d651 | 43 | void setup(); |
OmarAlebiary | 22:3e6ff378d651 | 44 | /** |
OmarAlebiary | 22:3e6ff378d651 | 45 | * @brief main method |
OmarAlebiary | 22:3e6ff378d651 | 46 | * @param None @details main method that has all the method calls of the Menus.cpp and |
OmarAlebiary | 22:3e6ff378d651 | 47 | * the RocketRacer class and has the Game_Loop method that runs the game |
OmarAlebiary | 22:3e6ff378d651 | 48 | */ |
OmarAlebiary | 22:3e6ff378d651 | 49 | int main(); |
OmarAlebiary | 22:3e6ff378d651 | 50 | |
OmarAlebiary | 22:3e6ff378d651 | 51 | |
OmarAlebiary | 22:3e6ff378d651 | 52 | |
OmarAlebiary | 22:3e6ff378d651 | 53 | void setup(){ |
OmarAlebiary | 22:3e6ff378d651 | 54 | |
OmarAlebiary | 22:3e6ff378d651 | 55 | lcd.init();//initialize the lcd |
OmarAlebiary | 22:3e6ff378d651 | 56 | pad.init();//initialize the pad |
OmarAlebiary | 22:3e6ff378d651 | 57 | lcd.clear(); |
OmarAlebiary | 22:3e6ff378d651 | 58 | lcd.setBrightness(0.4);//sets the default brightness |
OmarAlebiary | 22:3e6ff378d651 | 59 | lcd.setContrast(0.55);//set the default contrast |
OmarAlebiary | 22:3e6ff378d651 | 60 | lcd.normalMode(); |
OmarAlebiary | 22:3e6ff378d651 | 61 | |
OmarAlebiary | 22:3e6ff378d651 | 62 | } |
OmarAlebiary | 22:3e6ff378d651 | 63 | |
OmarAlebiary | 22:3e6ff378d651 | 64 | |
OmarAlebiary | 22:3e6ff378d651 | 65 | |
OmarAlebiary | 22:3e6ff378d651 | 66 | |
OmarAlebiary | 22:3e6ff378d651 | 67 | int main(){ |
OmarAlebiary | 22:3e6ff378d651 | 68 | |
OmarAlebiary | 22:3e6ff378d651 | 69 | |
OmarAlebiary | 22:3e6ff378d651 | 70 | setup(); |
OmarAlebiary | 26:35714debc45f | 71 | // test.test_welcomeMenu(pad,lcd); |
OmarAlebiary | 28:39607fb67e88 | 72 | // test.test_Play_Welcome_Melody(pad); |
OmarAlebiary | 28:39607fb67e88 | 73 | // test.test_End_Game_Melody(Gamepad &pad); |
OmarAlebiary | 26:35714debc45f | 74 | // test.test_drawMenu(lcd, pad); |
OmarAlebiary | 26:35714debc45f | 75 | // test.test_credits_page(lcd,pad); |
OmarAlebiary | 26:35714debc45f | 76 | // test.test_loading_menu(lcd); |
OmarAlebiary | 26:35714debc45f | 77 | // test.test_InstructionsMenu(pad,lcd); |
OmarAlebiary | 26:35714debc45f | 78 | // test.test_Game_Loop(pad,lcd); |
OmarAlebiary | 26:35714debc45f | 79 | |
OmarAlebiary | 25:7e3b6df93dd5 | 80 | menus.welcomeMenu(pad,lcd); |
OmarAlebiary | 25:7e3b6df93dd5 | 81 | menus.loading_menu(lcd); |
OmarAlebiary | 25:7e3b6df93dd5 | 82 | pad.leds_off(); |
OmarAlebiary | 22:3e6ff378d651 | 83 | |
OmarAlebiary | 22:3e6ff378d651 | 84 | while(1){ |
OmarAlebiary | 25:7e3b6df93dd5 | 85 | menus.drawMenu(lcd,pad); |
OmarAlebiary | 22:3e6ff378d651 | 86 | } |
OmarAlebiary | 25:7e3b6df93dd5 | 87 | |
OmarAlebiary | 22:3e6ff378d651 | 88 | } |
OmarAlebiary | 22:3e6ff378d651 | 89 |