55 lines
1.0 KiB
C++
55 lines
1.0 KiB
C++
#ifndef __CONSOLEMENU_H
|
|
#define __CONSOLEMENU_H
|
|
|
|
#include <Windows.h>
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
|
|
class menuBase{
|
|
public:
|
|
static std::string cutline;
|
|
std::string titleText; //title
|
|
std::vector<std::string> options; //options
|
|
std::vector<std::string> infos; //help info
|
|
std::string menuID; //Must be unique.
|
|
|
|
int numOfStatus;
|
|
int highLightedIndex; //from 0 to numOfStatus
|
|
|
|
virtual void DrawMenu();
|
|
virtual void StatusMove(int status) = 0;
|
|
virtual void beginOutPut(){};
|
|
virtual void endOutPut(){};
|
|
|
|
};
|
|
|
|
class menuManager{
|
|
|
|
public:
|
|
std::vector<menuBase*> menus; //menus
|
|
menuBase* activeMenu; //current menu
|
|
std::string defaultMenu = "";
|
|
private:
|
|
menuManager();
|
|
static menuManager *instance;
|
|
|
|
//API
|
|
public:
|
|
void SetDefaultUI(std::string menuID);
|
|
void UIRegistion(menuBase* pmenu);
|
|
void UITransform(std::string menuID);
|
|
|
|
static menuManager* (GetInstance()){
|
|
if(instance == nullptr){
|
|
instance = new menuManager();
|
|
if(instance == nullptr){exit(1);} //alloc failed
|
|
}
|
|
return instance;
|
|
}
|
|
};
|
|
|
|
|
|
|
|
#endif
|