#pragma once #include "MenuComponent.h" #include "olcPixelGameEngine.h" #include #include "safemap.h" #include "Theme.h" #include "Attributable.h" class Crawler; class Menu:IAttributable{ friend class Crawler; friend class Player; static bool MOUSE_NAVIGATION; static std::mapmenus; std::map>buttons; //Buttons are stored in rows followed by their column order. std::vectordisplayComponents; //Components that are only for displaying purposes. safemapcomponents; //A friendly way to interrogate any component we are interested in. vi2d selection={-1,-1}; vf2d size; //Size in tiles (24x24), every menu will be tile-based bool scaled=false; //Whether or not the patch border is supposed to be scaled or tiled. public: Menu(); Menu(vf2d size); void AddComponent(std::string key,MenuComponent*button); void Update(Crawler*game); void Draw(Crawler*game); void SetScaledPatchBorder(bool scaled); static void InitializeMenus(); static void OpenMenu(MenuType menu); static std::vectorstack; static std::string themeSelection; static safemapthemes; private: void MenuSelect(Crawler*game); static const Menu InitializeTestMenu(); static const Menu InitializeTestSubMenu(); //X (0-3), Y (0-2) for specific 9-patch tile (tiled version). static Renderable&GetPatchPart(int x,int y); void KeyboardButtonNavigation(Crawler*game,vf2d menuPos); void DrawScaledWindow(Crawler*game,vf2d menuPos); void DrawTiledWindow(Crawler*game,vf2d menuPos); };