contains my game for the embedded systems project 2645

Dependencies:   mbed FXOS8700CQQQ

Committer:
OmarAlebiary
Date:
Fri Apr 19 19:50:23 2019 +0000
Revision:
23:2ca9735b16ef
Parent:
22:3e6ff378d651
Child:
25:7e3b6df93dd5
added comments to Menus class

Who changed what in which revision?

UserRevisionLine numberNew contents of line
OmarAlebiary 22:3e6ff378d651 1 #include "RocketRacer.h"
OmarAlebiary 22:3e6ff378d651 2 #include "Menus.h"
OmarAlebiary 23:2ca9735b16ef 3
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 22:3e6ff378d651 23
OmarAlebiary 22:3e6ff378d651 24 // prototypes
OmarAlebiary 22:3e6ff378d651 25 /**
OmarAlebiary 22:3e6ff378d651 26 * @brief object initialization method
OmarAlebiary 22:3e6ff378d651 27 * @param None @details method that initializes objects like lcd,gampad and sets the default
OmarAlebiary 22:3e6ff378d651 28 * contrast of the lcd and brightness
OmarAlebiary 22:3e6ff378d651 29 */
OmarAlebiary 22:3e6ff378d651 30 void setup();
OmarAlebiary 22:3e6ff378d651 31 /**
OmarAlebiary 22:3e6ff378d651 32 * @brief main method
OmarAlebiary 22:3e6ff378d651 33 * @param None @details main method that has all the method calls of the Menus.cpp and
OmarAlebiary 22:3e6ff378d651 34 * the RocketRacer class and has the Game_Loop method that runs the game
OmarAlebiary 22:3e6ff378d651 35 */
OmarAlebiary 22:3e6ff378d651 36 int main();
OmarAlebiary 22:3e6ff378d651 37
OmarAlebiary 22:3e6ff378d651 38
OmarAlebiary 22:3e6ff378d651 39
OmarAlebiary 22:3e6ff378d651 40 void setup(){
OmarAlebiary 22:3e6ff378d651 41
OmarAlebiary 22:3e6ff378d651 42 lcd.init();//initialize the lcd
OmarAlebiary 22:3e6ff378d651 43 pad.init();//initialize the pad
OmarAlebiary 22:3e6ff378d651 44 lcd.clear();
OmarAlebiary 22:3e6ff378d651 45 lcd.setBrightness(0.4);//sets the default brightness
OmarAlebiary 22:3e6ff378d651 46 lcd.setContrast(0.55);//set the default contrast
OmarAlebiary 22:3e6ff378d651 47 lcd.normalMode();
OmarAlebiary 22:3e6ff378d651 48
OmarAlebiary 22:3e6ff378d651 49 }
OmarAlebiary 22:3e6ff378d651 50
OmarAlebiary 22:3e6ff378d651 51
OmarAlebiary 22:3e6ff378d651 52
OmarAlebiary 22:3e6ff378d651 53
OmarAlebiary 22:3e6ff378d651 54 int main(){
OmarAlebiary 22:3e6ff378d651 55
OmarAlebiary 22:3e6ff378d651 56
OmarAlebiary 22:3e6ff378d651 57 setup();
OmarAlebiary 22:3e6ff378d651 58 menus.welcomeMenu(pad,lcd);
OmarAlebiary 22:3e6ff378d651 59
OmarAlebiary 22:3e6ff378d651 60 menus.InstructionsMenu(pad,lcd);
OmarAlebiary 22:3e6ff378d651 61 //keeps looping untill the player loses
OmarAlebiary 22:3e6ff378d651 62 while(1){
OmarAlebiary 22:3e6ff378d651 63 Rocket_Racer.Game_Loop(lcd,pad);
OmarAlebiary 22:3e6ff378d651 64 }
OmarAlebiary 22:3e6ff378d651 65
OmarAlebiary 22:3e6ff378d651 66
OmarAlebiary 22:3e6ff378d651 67 }
OmarAlebiary 22:3e6ff378d651 68