ELEC2645 (2018/19) / Mbed 2 deprecated el17ajf

Dependencies:   mbed

Fork of el17ajf by Angus Findlay

Revision:
32:7b5a864b9234
Parent:
30:11838cb6979f
diff -r 69fedaa9b171 -r 7b5a864b9234 Menus/UI/UI.cpp
--- a/Menus/UI/UI.cpp	Sat Apr 13 09:53:39 2019 +0000
+++ b/Menus/UI/UI.cpp	Sat Apr 13 09:58:45 2019 +0000
@@ -63,7 +63,7 @@
     }
     
     void UI::reset() {
-        buttonCurrentlySelected = 0; 
+        button_currently_selected = 0; 
     }
     
     UI::~UI() {
@@ -71,9 +71,9 @@
     }
     
     void UI::clear() {
-        buttonPressedFrame = false;
-        nextYPos = PADDING_Y;
-        buttonCurrentlyDrawing = -1;
+        button_pressed_frame = false;
+        next_y_pos = PADDING_Y;
+        button_currently_drawing = -1;
         frame++;
     }
     
@@ -96,13 +96,13 @@
     int oldBorderX1,oldBorderY1, oldBorderX2, oldBorderY2;
     
     bool UI::drawAndCheckButton(const char * text) {
-        buttonCurrentlyDrawing++;
+        button_currently_drawing++;
         
         int y = nextY();
         
         Graphics::UI::drawText(PADDING_X, y, text);
         
-        bool selected = buttonCurrentlyDrawing == buttonCurrentlySelected;
+        bool selected = button_currently_drawing == button_currently_selected;
         
         int wordWidth = strlen(text) * (Graphics::UI::CHAR_WIDTH + Graphics::UI::CHAR_SPACE) - 1;
         
@@ -123,7 +123,7 @@
             oldBorderY2 = Math::lerp(oldBorderY2, borderY2);
         }
     
-        return buttonPressedFrame && selected;
+        return button_pressed_frame && selected;
     }
     
     void UI::drawLogo() {
@@ -132,24 +132,24 @@
     }
     
     void UI::selectNextButton() {
-        if (buttonCurrentlySelected < buttonCurrentlyDrawing) {
-            buttonCurrentlySelected++;
+        if (button_currently_selected < button_currently_drawing) {
+            button_currently_selected++;
         }
     }
     
     void UI::selectPreviousButton() {
-        if (buttonCurrentlySelected > 0) {
-            buttonCurrentlySelected--;
+        if (button_currently_selected > 0) {
+            button_currently_selected--;
         }
     }
     
     void UI::pressButton() {
-        buttonPressedFrame = true;
+        button_pressed_frame = true;
     }
     
     int UI::nextY() {
-        int currentYPos = nextYPos;
-        nextYPos += Graphics::UI::CHAR_HEIGHT + LINE_PADDING;
+        int currentYPos = next_y_pos;
+        next_y_pos += Graphics::UI::CHAR_HEIGHT + LINE_PADDING;
         return currentYPos;
     }
 };
\ No newline at end of file