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