Project Submission (late)
Dependencies: mbed
Menus/DefeatMenu.h@0:72f372170a73, 2019-05-10 (annotated)
- Committer:
- el17tc
- Date:
- Fri May 10 08:07:10 2019 +0000
- Revision:
- 0:72f372170a73
- Child:
- 2:43bb635db736
Save at functioning version;
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:72f372170a73 | 9 | class DefeatMenu : public Menu { |
el17tc | 0:72f372170a73 | 10 | public: |
el17tc | 0:72f372170a73 | 11 | DefeatMenu(N5110* screenPtr) : Menu(screenPtr) { |
el17tc | 0:72f372170a73 | 12 | buttons[0] = new YesButton; |
el17tc | 0:72f372170a73 | 13 | buttons[1] = new NoButton; |
el17tc | 0:72f372170a73 | 14 | currentButton = buttons[0]; |
el17tc | 0:72f372170a73 | 15 | numOfButtons = 2; |
el17tc | 0:72f372170a73 | 16 | buttonIndex = 0; |
el17tc | 0:72f372170a73 | 17 | } |
el17tc | 0:72f372170a73 | 18 | void virtual draw() { |
el17tc | 0:72f372170a73 | 19 | std::stringstream sscore; |
el17tc | 0:72f372170a73 | 20 | sscore << "Score: " << score; |
el17tc | 0:72f372170a73 | 21 | lcd.printString("GAME OVER",10,1); |
el17tc | 0:72f372170a73 | 22 | lcd.printString(sscore.str().c_str(),10,2); |
el17tc | 0:72f372170a73 | 23 | lcd.printString("Play again?",10,3); |
el17tc | 0:72f372170a73 | 24 | lcd.printString("Yes No",10,4); |
el17tc | 0:72f372170a73 | 25 | } |
el17tc | 0:72f372170a73 | 26 | ~DefeatMenu() { |
el17tc | 0:72f372170a73 | 27 | delete buttons[0]; |
el17tc | 0:72f372170a73 | 28 | delete buttons[1]; |
el17tc | 0:72f372170a73 | 29 | } |
el17tc | 0:72f372170a73 | 30 | }; |
el17tc | 0:72f372170a73 | 31 | |
el17tc | 0:72f372170a73 | 32 | #endif DEFEATMENU_H |