Handled dynamic adding and removing of inventory items and syncing with menu systems.
This commit is contained in:
+5
-5
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
#include "olcPixelGameEngine.h"
|
||||
#include "Item.h"
|
||||
#include <stack>
|
||||
#include "safemap.h"
|
||||
#include "Theme.h"
|
||||
#include "Attributable.h"
|
||||
#include "olcUTIL_Geometry2D.h"
|
||||
#include <functional>
|
||||
|
||||
class Crawler;
|
||||
class MenuComponent;
|
||||
@@ -25,8 +24,6 @@ class Menu:IAttributable{
|
||||
friend class Player;
|
||||
|
||||
float buttonHoldTime=0;
|
||||
std::map<int/*Y*/,std::vector<MenuComponent*>>buttons; //Buttons are stored in rows followed by their column order.
|
||||
std::map<int/*Y*/,std::vector<MenuComponent*>>keyboardButtons; //Button ordered storage for keyboard/menu
|
||||
std::vector<MenuComponent*>displayComponents; //Components that are only for displaying purposes.
|
||||
vi2d selection={-1,-1};
|
||||
vi2d lastActiveMousePos={};
|
||||
@@ -50,11 +47,13 @@ public:
|
||||
static std::map<MenuType,Menu*>menus;
|
||||
vf2d pos; //Specify the upper-left corner of the window. Using CENTERED will always put this where the upper-left corner would center the window.
|
||||
vf2d size; //Size in tiles (24x24), every menu will be tile-based
|
||||
safemap<int/*Y*/,std::vector<MenuComponent*>>buttons; //Buttons are stored in rows followed by their column order.
|
||||
safemap<int/*Y*/,std::vector<MenuComponent*>>keyboardButtons; //Button ordered storage for keyboard/menu
|
||||
|
||||
static Theme&GetCurrentTheme();
|
||||
bool UsingMouseNavigation();
|
||||
void SetMouseNavigation(bool mouseNavigation);
|
||||
|
||||
static void InventorySlotsUpdated(ITCategory cat); //Called whenever an inventory item gets added to the player's inventory, thus increasing the total number of slots in our bag.
|
||||
private:
|
||||
Menu(vf2d pos,vf2d size);
|
||||
void HoverMenuSelect(Crawler*game);
|
||||
@@ -65,6 +64,7 @@ private:
|
||||
static void InitializeTestMenu();
|
||||
static void InitializeTestSubMenu();
|
||||
static void InitializeInventoryWindow();
|
||||
static void InitializeCharacterInfoWindow();
|
||||
//X (0-3), Y (0-2) for specific 9-patch tile (tiled version).
|
||||
static Renderable&GetPatchPart(int x,int y);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user