Project Submission (late)

Dependencies:   mbed

Revision:
0:72f372170a73
Child:
3:83e79d31930c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Menus/VictoryMenu.h	Fri May 10 08:07:10 2019 +0000
@@ -0,0 +1,55 @@
+#ifndef VICTORYMENU_H
+#define VICTORYMENU_H
+
+#include "Menus.h"
+
+// yes button used in the VictoryMenu and the DefeatMenu
+class YesButton : public Button {
+    public:
+    YesButton() {
+      x = 5;
+      y = 32;
+    }
+    void virtual run() {
+      printf("YesButton pushed\n");
+      restartFlag = true;
+    }
+};
+// no button used in the VictoryMenu and the DefeatMenu
+class NoButton : public Button {
+    public:
+    NoButton() {
+      x = 58;
+      y = 32;
+    }
+    void virtual run() {
+      printf("NoButton pushed\n");
+      menuFlag = true;
+    }
+};
+// VictoryMenu displays when the player escapes the maze, it displays score
+// and restart options
+class VictoryMenu : public Menu {
+    public:
+    VictoryMenu(N5110* screenPtr) : Menu(screenPtr) {
+        buttons[0] = new YesButton;
+        buttons[1] = new NoButton;
+        currentButton = buttons[0];
+        numOfButtons = 2;
+        buttonIndex = 0;
+    }
+    void virtual draw() {
+      std::stringstream sscore;
+      sscore << "Score: " << score;
+      lcd->printString("VICTORY",10,1);
+      lcd->printString(sscore.str().c_str(),10,2);
+      lcd->printString("Play again?",10,3);
+      lcd->printString("Yes      No",10,4);
+    }
+    ~VictoryMenu() {
+        delete buttons[0];
+        delete buttons[1];
+    }   
+};
+
+#endif // VICTORYMENU_H
\ No newline at end of file