James Cummins / Mbed 2 deprecated el17jnc

Dependencies:   mbed

Revision:
22:4e305ff8a050
Parent:
20:4a39a1a2be51
Child:
23:61fa82f76808
--- a/main.cpp	Wed Apr 17 15:11:54 2019 +0000
+++ b/main.cpp	Thu Apr 18 11:50:53 2019 +0000
@@ -12,6 +12,7 @@
 #include "mbed.h"
 #include "N5110.h"
 #include "BrickBreakerEngine.h"
+#include "OptionsEngine.h"
 #define RADIUS 3
 
 
@@ -19,6 +20,7 @@
 Gamepad gamepad;
 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
 BrickBreakerEngine brick;
+OptionsEngine opt;
 AnalogIn randnoise(PTB0);
 FXOS8700CQ accelerometer(I2C_SDA,I2C_SCL);
 
@@ -45,14 +47,14 @@
 
 
 int main(){
-    int fps = 15;
+    int fps = 30;
     init();
     startscreen();
     while(1){
         StartOption choice_selected = menu();
         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);*/}
+        if(choice_selected == OPTIONS){ opt.options_menu(gamepad, lcd);}
     }
 }
   
@@ -65,6 +67,7 @@
     lcd.init();
     lcd.setContrast(0.55);
     brick.init(RADIUS);
+    opt.init();
     accelerometer.init();
     wait(1);
 }
@@ -104,7 +107,7 @@
     };
     StartOption state = CLASSIC;  //start with the arrow on the top option
     int next = 2;  //next_state = 2 so that by default it doesn't change arrow position
-    while(!(gamepad.get_direction() == E)){     //select choice by pushing joystick to the right
+    while(!(gamepad.check_event(gamepad.A_PRESSED))){     //select choice by pushing joystick to the right
         state = fsm[state].next_state[next];
         lcd.clear();
         if(gamepad.get_direction() == N){ next = 0;}
@@ -124,5 +127,5 @@
         lcd.printString("Classic", 36, 0);
         lcd.printString("BrickBreak", 18, 2);
         lcd.printString("Options", 36, 4);
-        lcd.printString("(Joy R>>)", 30, 5);
+        lcd.printString("(A = Select)", 12, 5);
 }
\ No newline at end of file