Project Submission (late)
Dependencies: mbed
Menus/VictoryMenu.h
- Committer:
- el17tc
- Date:
- 2019-05-10
- Revision:
- 0:72f372170a73
- Child:
- 3:83e79d31930c
File content as of revision 0:72f372170a73:
#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