ELEC2645 (2017/18) / Mbed OS el16ajm
Revision:
9:fe86ddbf7799
Parent:
8:9d01fd4a63ad
Child:
10:279d3775d52c
--- a/Menu/Menu.cpp	Sun May 06 20:17:50 2018 +0000
+++ b/Menu/Menu.cpp	Sun May 06 20:49:48 2018 +0000
@@ -13,25 +13,37 @@
 
 void Menu::init()
 {
+    _start = false;
 
-/*
-    bool _start = false;
-    
-    int _selection = 1;
-    
-    lcd.clear();
-
-    while (!_start) {        
+    _selection = 1;
+}
 
-        lcd.printString("     Normal",0,1);
-        lcd.printString("     Level",0,2);
-        lcd.printString("     Options",0,3);
+void Menu::update()
+{
+    if (_d == N && _selection > 1) { //checks the menu arrow location
+        _selection -= 1;
+    } else if (_d == S && _selection < 3) {
+        _selection += 1;
+    }
 
-        lcd.printString("   >",0,_selection);
-        
-        wait(0.1);
-        lcd.refresh();
-    }
-    */
+
 }
 
+void Menu::read_input(Gamepad &pad)
+{
+    _d = pad.get_direction();
+}
+
+void Menu::draw(N5110 &lcd)
+{
+    lcd.printString("  Start",0,1);
+    lcd.printString("  Level Select",0,2);
+    lcd.printString("  Difficulty",0,3);
+
+    lcd.printString(" >",0,_selection);
+}
+
+bool Menu::started()
+{
+    return _start;
+}