Project Submission (late)

Dependencies:   mbed

Committer:
el17tc
Date:
Fri May 10 14:52:28 2019 +0000
Revision:
3:83e79d31930c
Parent:
2:43bb635db736
final commit, API is added.; I'm not sure if there is a specific statement of academic integrity wanted but- I declare that this work is 100% my own, I have not plagiarised any work or attempted to fabricate any part of it for extra marks.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17tc 0:72f372170a73 1 #ifndef DEFEATMENU_H
el17tc 0:72f372170a73 2 #define DEFEATMENU_H
el17tc 0:72f372170a73 3
el17tc 0:72f372170a73 4 #include "VictoryMenu.h"
el17tc 0:72f372170a73 5
el17tc 0:72f372170a73 6 /* screen that displays when the player runs out of time in the maze
el17tc 0:72f372170a73 7 reuses the yes and no buttons so VictoryMenu is included */
el17tc 0:72f372170a73 8
el17tc 3:83e79d31930c 9 /** VictoryMenu Class
el17tc 3:83e79d31930c 10 * @brief Derived from Menu. Displayed when the timer expires.
el17tc 3:83e79d31930c 11 */
el17tc 0:72f372170a73 12 class DefeatMenu : public Menu {
el17tc 0:72f372170a73 13 public:
el17tc 0:72f372170a73 14 DefeatMenu(N5110* screenPtr) : Menu(screenPtr) {
el17tc 0:72f372170a73 15 buttons[0] = new YesButton;
el17tc 0:72f372170a73 16 buttons[1] = new NoButton;
el17tc 0:72f372170a73 17 currentButton = buttons[0];
el17tc 0:72f372170a73 18 numOfButtons = 2;
el17tc 0:72f372170a73 19 buttonIndex = 0;
el17tc 0:72f372170a73 20 }
el17tc 0:72f372170a73 21 void virtual draw() {
el17tc 0:72f372170a73 22 std::stringstream sscore;
el17tc 0:72f372170a73 23 sscore << "Score: " << score;
el17tc 2:43bb635db736 24 lcd->printString("GAME OVER",10,1);
el17tc 2:43bb635db736 25 lcd->printString(sscore.str().c_str(),10,2);
el17tc 2:43bb635db736 26 lcd->printString("Play again?",10,3);
el17tc 2:43bb635db736 27 lcd->printString("Yes No",10,4);
el17tc 0:72f372170a73 28 }
el17tc 3:83e79d31930c 29 /** Destructor
el17tc 3:83e79d31930c 30 */
el17tc 0:72f372170a73 31 ~DefeatMenu() {
el17tc 0:72f372170a73 32 delete buttons[0];
el17tc 0:72f372170a73 33 delete buttons[1];
el17tc 0:72f372170a73 34 }
el17tc 0:72f372170a73 35 };
el17tc 0:72f372170a73 36
el17tc 2:43bb635db736 37 #endif // DEFEATMENU_H