Implemented menucomponent depth property. Fixed equipment menu labels interacting with hover events.

This commit is contained in:
2023-12-09 01:58:46 -06:00
parent dc6ecf40c2
commit 4ac42fbd7e
12 changed files with 89 additions and 44 deletions
+7 -1
View File
@@ -47,6 +47,9 @@ class Crawler;
class MenuComponent;
class ScrollableWindowComponent;
#define DEFAULT_DEPTH -999999
#define STARTING_DEPTH 999999
enum MenuType{
TEST,
TEST_2,
@@ -73,6 +76,7 @@ class Menu:public IAttributable{
float buttonHoldTime=0;
vi2d selection={-1,-1};
vi2d lastActiveMousePos={};
int componentCount;
MenuComponent*draggingComponent=nullptr;
Renderable r,overlay;
@@ -82,7 +86,7 @@ public:
//The constructor is private. Use CreateMenu() instead!
Menu()=default;
~Menu();
void AddComponent(std::string key,MenuComponent*button);
void AddComponent(std::string key,MenuComponent*button,int depth=DEFAULT_DEPTH);
void Update(Crawler*game);
void Draw(Crawler*game);
static void InitializeMenus();
@@ -119,6 +123,7 @@ public:
//X (0-2), Y (0-2) for specific 9-patch tile (tiled version).
static Renderable&GetPatchPart(int x,int y);
void RecalculateComponentCount();
private:
Menu(vf2d pos,vf2d size);
static MenuType lastMenuTypeCreated;
@@ -151,6 +156,7 @@ private:
bool HandleOutsideDisabledButtonSelection(MenuComponent*disabledButton);
Pixel GetRenderColor();
static bool MOUSE_NAVIGATION;
bool cover; //A black cover for when a menu pops up to fade out the stuff behind it.
};