Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 20:4a39a1a2be51
- Parent:
- 19:deddb013a8e8
- Child:
- 22:4e305ff8a050
--- a/main.cpp Wed Apr 17 09:36:29 2019 +0000 +++ b/main.cpp Wed Apr 17 14:34:08 2019 +0000 @@ -11,17 +11,29 @@ #include "Gamepad.h" #include "mbed.h" #include "N5110.h" -#include "GameEngine.h" +#include "BrickBreakerEngine.h" #define RADIUS 3 //Objects Gamepad gamepad; N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); -GameEngine engine; +BrickBreakerEngine brick; AnalogIn randnoise(PTB0); FXOS8700CQ accelerometer(I2C_SDA,I2C_SCL); +//Enumeric class and struct for game mode selection menu +enum StartOption{ + CLASSIC, + BRICKBREAKER, + OPTIONS + }; + +struct StartSelection{ + int output; + StartOption next_state[3]; + }; + //Methods void startscreen(); StartOption menu(); @@ -38,9 +50,9 @@ startscreen(); while(1){ StartOption choice_selected = menu(); - if(choice_selected == CLASSIC){ engine.classic_mode(accelerometer, gamepad, lcd, fps);} - if(choice_selected == BRICKBREAKER){ engine.brickbreaker_mode(accelerometer, gamepad, lcd, randnoise, fps);} - if(choice_selected == OPTIONS){ engine.options_menu(gamepad, lcd);} + if(choice_selected == CLASSIC){ /*engine.classic_mode(accelerometer, gamepad, lcd, fps);*/} + if(choice_selected == BRICKBREAKER){ brick.brickbreaker_mode(accelerometer, gamepad, lcd, randnoise, fps);} + if(choice_selected == OPTIONS){ /*engine.options_menu(gamepad, lcd);*/} } } @@ -52,7 +64,7 @@ gamepad.init(); lcd.init(); lcd.setContrast(0.55); - engine.init(RADIUS); + brick.init(RADIUS); accelerometer.init(); wait(1); }