contains my game for the embedded systems project 2645
Dependencies: mbed FXOS8700CQQQ
main.cpp@29:e660274d8222, 2019-04-25 (annotated)
- Committer:
- OmarAlebiary
- Date:
- Thu Apr 25 10:44:53 2019 +0000
- Revision:
- 29:e660274d8222
- Parent:
- 28:39607fb67e88
- Child:
- 30:c5060010a1e6
added doxygen comments
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 | 29:e660274d8222 | 16 | //instantiating the Gamepad object |
OmarAlebiary | 22:3e6ff378d651 | 17 | Gamepad pad; |
OmarAlebiary | 29:e660274d8222 | 18 | |
OmarAlebiary | 29:e660274d8222 | 19 | // instantiating the RocketRacer object |
OmarAlebiary | 22:3e6ff378d651 | 20 | RocketRacer Rocket_Racer; |
OmarAlebiary | 29:e660274d8222 | 21 | |
OmarAlebiary | 29:e660274d8222 | 22 | //instantiating the lcd object and assigning the pins on the gamepad to it |
OmarAlebiary | 22:3e6ff378d651 | 23 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
OmarAlebiary | 29:e660274d8222 | 24 | |
OmarAlebiary | 29:e660274d8222 | 25 | //instantiating the Menus object |
OmarAlebiary | 22:3e6ff378d651 | 26 | Menus menus; |
OmarAlebiary | 29:e660274d8222 | 27 | |
OmarAlebiary | 29:e660274d8222 | 28 | // instantiating the tests object |
OmarAlebiary | 26:35714debc45f | 29 | tests test; |
OmarAlebiary | 22:3e6ff378d651 | 30 | |
OmarAlebiary | 22:3e6ff378d651 | 31 | // prototypes |
OmarAlebiary | 22:3e6ff378d651 | 32 | /** |
OmarAlebiary | 22:3e6ff378d651 | 33 | * @brief object initialization method |
OmarAlebiary | 22:3e6ff378d651 | 34 | * @param None @details method that initializes objects like lcd,gampad and sets the default |
OmarAlebiary | 22:3e6ff378d651 | 35 | * contrast of the lcd and brightness |
OmarAlebiary | 22:3e6ff378d651 | 36 | */ |
OmarAlebiary | 22:3e6ff378d651 | 37 | void setup(); |
OmarAlebiary | 22:3e6ff378d651 | 38 | /** |
OmarAlebiary | 22:3e6ff378d651 | 39 | * @brief main method |
OmarAlebiary | 22:3e6ff378d651 | 40 | * @param None @details main method that has all the method calls of the Menus.cpp and |
OmarAlebiary | 22:3e6ff378d651 | 41 | * the RocketRacer class and has the Game_Loop method that runs the game |
OmarAlebiary | 22:3e6ff378d651 | 42 | */ |
OmarAlebiary | 22:3e6ff378d651 | 43 | int main(); |
OmarAlebiary | 22:3e6ff378d651 | 44 | |
OmarAlebiary | 22:3e6ff378d651 | 45 | |
OmarAlebiary | 22:3e6ff378d651 | 46 | |
OmarAlebiary | 22:3e6ff378d651 | 47 | void setup(){ |
OmarAlebiary | 22:3e6ff378d651 | 48 | |
OmarAlebiary | 22:3e6ff378d651 | 49 | lcd.init();//initialize the lcd |
OmarAlebiary | 22:3e6ff378d651 | 50 | pad.init();//initialize the pad |
OmarAlebiary | 22:3e6ff378d651 | 51 | lcd.clear(); |
OmarAlebiary | 22:3e6ff378d651 | 52 | lcd.setBrightness(0.4);//sets the default brightness |
OmarAlebiary | 22:3e6ff378d651 | 53 | lcd.setContrast(0.55);//set the default contrast |
OmarAlebiary | 22:3e6ff378d651 | 54 | lcd.normalMode(); |
OmarAlebiary | 22:3e6ff378d651 | 55 | |
OmarAlebiary | 22:3e6ff378d651 | 56 | } |
OmarAlebiary | 22:3e6ff378d651 | 57 | |
OmarAlebiary | 22:3e6ff378d651 | 58 | |
OmarAlebiary | 22:3e6ff378d651 | 59 | |
OmarAlebiary | 22:3e6ff378d651 | 60 | |
OmarAlebiary | 22:3e6ff378d651 | 61 | int main(){ |
OmarAlebiary | 22:3e6ff378d651 | 62 | |
OmarAlebiary | 22:3e6ff378d651 | 63 | |
OmarAlebiary | 22:3e6ff378d651 | 64 | setup(); |
OmarAlebiary | 26:35714debc45f | 65 | // test.test_welcomeMenu(pad,lcd); |
OmarAlebiary | 28:39607fb67e88 | 66 | // test.test_Play_Welcome_Melody(pad); |
OmarAlebiary | 28:39607fb67e88 | 67 | // test.test_End_Game_Melody(Gamepad &pad); |
OmarAlebiary | 26:35714debc45f | 68 | // test.test_drawMenu(lcd, pad); |
OmarAlebiary | 26:35714debc45f | 69 | // test.test_credits_page(lcd,pad); |
OmarAlebiary | 26:35714debc45f | 70 | // test.test_loading_menu(lcd); |
OmarAlebiary | 26:35714debc45f | 71 | // test.test_InstructionsMenu(pad,lcd); |
OmarAlebiary | 26:35714debc45f | 72 | // test.test_Game_Loop(pad,lcd); |
OmarAlebiary | 26:35714debc45f | 73 | |
OmarAlebiary | 25:7e3b6df93dd5 | 74 | menus.welcomeMenu(pad,lcd); |
OmarAlebiary | 25:7e3b6df93dd5 | 75 | menus.loading_menu(lcd); |
OmarAlebiary | 25:7e3b6df93dd5 | 76 | pad.leds_off(); |
OmarAlebiary | 22:3e6ff378d651 | 77 | |
OmarAlebiary | 22:3e6ff378d651 | 78 | while(1){ |
OmarAlebiary | 25:7e3b6df93dd5 | 79 | menus.drawMenu(lcd,pad); |
OmarAlebiary | 22:3e6ff378d651 | 80 | } |
OmarAlebiary | 25:7e3b6df93dd5 | 81 | |
OmarAlebiary | 22:3e6ff378d651 | 82 | } |
OmarAlebiary | 22:3e6ff378d651 | 83 |