Project Submission (late)
Dependencies: mbed
Diff: Menus/Menus.h
- Revision:
- 0:72f372170a73
- Child:
- 3:83e79d31930c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Menus/Menus.h Fri May 10 08:07:10 2019 +0000 @@ -0,0 +1,59 @@ +#ifndef MENUS_H +#define MENUS_H + +#include <string> +#include <sstream> + +#include "N5110.h" +//#include "MenuGraphics.h" + +/* because these classes are so short and so closely linked, they are declared +and defined in the same files for convenience and clarity */ + +// abstract class for Button +class Button { + public: + int x; + int y; + Button() { + x = y = 0; + } + void virtual run() { + printf("Button\n"); + } + void virtual runBack() { + printf("Back functionality\n"); + // only overridden in functions that can be pressed backwards e.g. sliders + // for contrast and brightness + } +}; + +// abstract class for Menu +class Menu { + public: + Button* buttons[3]; + int score; // used in the victory and defeat menus + int numOfButtons; + int buttonIndex; + N5110* lcd; + Menu(N5110* screenPtr) : lcd(screenPtr) { + numOfButtons = buttonIndex = 0; + } + void virtual draw() { + printf("This is a menu\n"); + } +}; + +// important flags used throughout the menus to interact with the game's settings +Menu *currentMenu; +Button *currentButton; +double contrastVal = 0.5; +double brightnessVal = 0.5; +int mazeSize = 12; +bool beginFlag = false; +bool restartFlag = false; +bool menuFlag = false; +bool timerFlag = true; + + +#endif // MENUS_H \ No newline at end of file