|
|
|
#pragma once
|
|
|
|
#include "MenuComponent.h"
|
|
|
|
#include "olcPixelGameEngine.h"
|
|
|
|
#include <stack>
|
|
|
|
|
|
|
|
#define MENUFUNC [](Menu&menu,Crawler*game)
|
|
|
|
|
|
|
|
class Crawler;
|
|
|
|
|
|
|
|
class Menu{
|
|
|
|
friend class Crawler;
|
|
|
|
friend class Player;
|
|
|
|
static bool MOUSE_NAVIGATION;
|
|
|
|
static std::map<MenuType,Menu>menus;
|
|
|
|
|
|
|
|
std::map<int/*Y*/,std::vector<MenuComponent*>>buttons; //Buttons are stored in rows followed by their column order.
|
|
|
|
vi2d selection={-1,-1};
|
|
|
|
vf2d size; //Size in tiles (24x24), every menu will be tile-based
|
|
|
|
public:
|
|
|
|
Menu();
|
|
|
|
Menu(vf2d size);
|
|
|
|
void AddComponent(MenuComponent*button);
|
|
|
|
void Update(Crawler*game);
|
|
|
|
void Draw(Crawler*game);
|
|
|
|
static void InitializeMenus();
|
|
|
|
static void OpenMenu(MenuType menu);
|
|
|
|
static std::vector<Menu*>stack;
|
|
|
|
private:
|
|
|
|
void MenuSelect(Crawler*game);
|
|
|
|
static const Menu InitializeTestMenu();
|
|
|
|
static const Menu InitializeTestSubMenu();
|
|
|
|
|
|
|
|
void KeyboardButtonNavigation(Crawler*game,vf2d menuPos);
|
|
|
|
};
|
|
|
|
|