Setup internal menu components so they know what button was clicked on a menu function. Compacted the on click menu function for menu buttons.
Refactored some item convenience functions.
This commit is contained in:
+21
-1
@@ -1,12 +1,24 @@
|
||||
#pragma once
|
||||
#include "MenuComponent.h"
|
||||
#include "olcPixelGameEngine.h"
|
||||
#include <stack>
|
||||
#include "safemap.h"
|
||||
#include "Theme.h"
|
||||
#include "Attributable.h"
|
||||
#include "olcUTIL_Geometry2D.h"
|
||||
#include <functional>
|
||||
|
||||
class Crawler;
|
||||
class MenuComponent;
|
||||
|
||||
enum MenuType{
|
||||
TEST,
|
||||
TEST_2,
|
||||
INVENTORY,
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
/*DO NOT REMOVE!!*/ENUM_END////////////////////////////////
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
class Menu:IAttributable{
|
||||
friend class Crawler;
|
||||
@@ -36,6 +48,7 @@ public:
|
||||
static std::string themeSelection;
|
||||
static safeunorderedmap<std::string,Theme>themes;
|
||||
static const vf2d CENTERED;
|
||||
|
||||
private:
|
||||
void HoverMenuSelect(Crawler*game);
|
||||
void MenuSelect(Crawler*game);
|
||||
@@ -55,3 +68,10 @@ private:
|
||||
Pixel GetRenderColor();
|
||||
};
|
||||
|
||||
struct MenuFuncData{
|
||||
Menu&menu;
|
||||
Crawler*game;
|
||||
MenuComponent*component;
|
||||
};
|
||||
|
||||
typedef std::function<void(MenuFuncData)> MenuFunc;
|
||||
Reference in New Issue
Block a user