Project Submission (late)

Dependencies:   mbed

Menus/Menus.h

Committer:
el17tc
Date:
2019-05-10
Revision:
0:72f372170a73
Child:
3:83e79d31930c

File content as of revision 0:72f372170a73:

#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