contains my game for the embedded systems project 2645

Dependencies:   mbed FXOS8700CQQQ

Committer:
OmarAlebiary
Date:
Sun Apr 21 11:26:12 2019 +0000
Revision:
27:771d186b1bc8
Parent:
26:35714debc45f
Child:
28:39607fb67e88
added the sprites in a separate .h file

Who changed what in which revision?

UserRevisionLine numberNew contents of line
OmarAlebiary 27:771d186b1bc8 1 /*
OmarAlebiary 27:771d186b1bc8 2
OmarAlebiary 27:771d186b1bc8 3 Electronic & Computer Engineering
OmarAlebiary 27:771d186b1bc8 4 ELEC2645 Embedded Systems Project
OmarAlebiary 27:771d186b1bc8 5 University of Leeds
OmarAlebiary 27:771d186b1bc8 6 Name: Omar Alebiary
OmarAlebiary 27:771d186b1bc8 7 Username: el17oa
OmarAlebiary 27:771d186b1bc8 8 ID : 201172644
OmarAlebiary 27:771d186b1bc8 9 Date: 15/3/2019
OmarAlebiary 27:771d186b1bc8 10 */
OmarAlebiary 22:3e6ff378d651 11 #include "RocketRacer.h"
OmarAlebiary 22:3e6ff378d651 12 #include "Menus.h"
OmarAlebiary 26:35714debc45f 13 #include "tests.h"
OmarAlebiary 23:2ca9735b16ef 14
OmarAlebiary 22:3e6ff378d651 15 // objects
OmarAlebiary 22:3e6ff378d651 16
OmarAlebiary 22:3e6ff378d651 17 /**
OmarAlebiary 22:3e6ff378d651 18 * @brief initializing the Gamepad object
OmarAlebiary 22:3e6ff378d651 19 */
OmarAlebiary 22:3e6ff378d651 20 Gamepad pad;
OmarAlebiary 22:3e6ff378d651 21 /**
OmarAlebiary 22:3e6ff378d651 22 * @brief initializing the RocketRacer object
OmarAlebiary 22:3e6ff378d651 23 */
OmarAlebiary 22:3e6ff378d651 24 RocketRacer Rocket_Racer;
OmarAlebiary 22:3e6ff378d651 25 /**
OmarAlebiary 22:3e6ff378d651 26 * @brief initializing the lcd object and assigning the pins on the gamepad to it
OmarAlebiary 22:3e6ff378d651 27 */
OmarAlebiary 22:3e6ff378d651 28 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
OmarAlebiary 22:3e6ff378d651 29 /**
OmarAlebiary 22:3e6ff378d651 30 * @brief initializing the Menus object
OmarAlebiary 22:3e6ff378d651 31 */
OmarAlebiary 22:3e6ff378d651 32 Menus menus;
OmarAlebiary 26:35714debc45f 33 /**
OmarAlebiary 26:35714debc45f 34 * @brief initializing the tests object
OmarAlebiary 26:35714debc45f 35 */
OmarAlebiary 26:35714debc45f 36 tests test;
OmarAlebiary 22:3e6ff378d651 37
OmarAlebiary 22:3e6ff378d651 38 // prototypes
OmarAlebiary 22:3e6ff378d651 39 /**
OmarAlebiary 22:3e6ff378d651 40 * @brief object initialization method
OmarAlebiary 22:3e6ff378d651 41 * @param None @details method that initializes objects like lcd,gampad and sets the default
OmarAlebiary 22:3e6ff378d651 42 * contrast of the lcd and brightness
OmarAlebiary 22:3e6ff378d651 43 */
OmarAlebiary 22:3e6ff378d651 44 void setup();
OmarAlebiary 22:3e6ff378d651 45 /**
OmarAlebiary 22:3e6ff378d651 46 * @brief main method
OmarAlebiary 22:3e6ff378d651 47 * @param None @details main method that has all the method calls of the Menus.cpp and
OmarAlebiary 22:3e6ff378d651 48 * the RocketRacer class and has the Game_Loop method that runs the game
OmarAlebiary 22:3e6ff378d651 49 */
OmarAlebiary 22:3e6ff378d651 50 int main();
OmarAlebiary 22:3e6ff378d651 51
OmarAlebiary 22:3e6ff378d651 52
OmarAlebiary 22:3e6ff378d651 53
OmarAlebiary 22:3e6ff378d651 54 void setup(){
OmarAlebiary 22:3e6ff378d651 55
OmarAlebiary 22:3e6ff378d651 56 lcd.init();//initialize the lcd
OmarAlebiary 22:3e6ff378d651 57 pad.init();//initialize the pad
OmarAlebiary 22:3e6ff378d651 58 lcd.clear();
OmarAlebiary 22:3e6ff378d651 59 lcd.setBrightness(0.4);//sets the default brightness
OmarAlebiary 22:3e6ff378d651 60 lcd.setContrast(0.55);//set the default contrast
OmarAlebiary 22:3e6ff378d651 61 lcd.normalMode();
OmarAlebiary 22:3e6ff378d651 62
OmarAlebiary 22:3e6ff378d651 63 }
OmarAlebiary 22:3e6ff378d651 64
OmarAlebiary 22:3e6ff378d651 65
OmarAlebiary 22:3e6ff378d651 66
OmarAlebiary 22:3e6ff378d651 67
OmarAlebiary 22:3e6ff378d651 68 int main(){
OmarAlebiary 22:3e6ff378d651 69
OmarAlebiary 22:3e6ff378d651 70
OmarAlebiary 22:3e6ff378d651 71 setup();
OmarAlebiary 26:35714debc45f 72 // test.test_welcomeMenu(pad,lcd);
OmarAlebiary 26:35714debc45f 73 // test.test_PlayMelody(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 26:35714debc45f 88
OmarAlebiary 22:3e6ff378d651 89
OmarAlebiary 22:3e6ff378d651 90 }
OmarAlebiary 22:3e6ff378d651 91