hud.showOverlay

This commit is contained in:
MihailRis
2024-03-06 09:42:23 +03:00
parent e16b24f4af
commit c71c918a9c
3 changed files with 81 additions and 11 deletions
+40 -1
View File
@@ -70,22 +70,39 @@ class Hud {
LevelFrontend* frontend;
Player* player;
/// @brief Is any overlay/inventory open
bool inventoryOpen = false;
/// @brief Is pause mode on
bool pause = false;
/// @brief Content access panel scroll container
std::shared_ptr<gui::Container> contentAccessPanel;
/// @brief Content access panel itself
std::shared_ptr<InventoryView> contentAccess;
/// @brief Player inventory hotbar
std::shared_ptr<InventoryView> hotbarView;
/// @brief Debug info and control panel (F3 key)
std::shared_ptr<gui::UINode> debugPanel;
/// @brief Overlay used in pause mode
std::shared_ptr<gui::Panel> darkOverlay;
/// @brief Inventories interaction agent (grabbed item and other info)
std::unique_ptr<InventoryInteraction> interaction;
/// @brief Grabbed item visual element
std::shared_ptr<SlotView> grabbedItemView;
/// @brief List of all controlled hud elements
std::vector<HudElement> elements;
/// @brief Player inventory view
std::shared_ptr<InventoryView> inventoryView = nullptr;
/// @brief Block inventory view
std::shared_ptr<InventoryView> blockUI = nullptr;
/// @brief Position of the block open
glm::ivec3 currentblock {};
/// @brief Id of the block open (used to detect block destruction or replacement)
blockid_t currentblockid = 0;
/// @brief UI element will be dynamicly positioned near to inventory or in screen center
std::shared_ptr<gui::UINode> secondUI = nullptr;
std::shared_ptr<InventoryView> createContentAccess();
std::shared_ptr<InventoryView> createHotbar();
@@ -98,13 +115,35 @@ public:
void update(bool hudVisible);
void draw(const GfxContext& context);
/// @brief Check if inventory mode on
bool isInventoryOpen() const;
/// @brief Check if pause mode on
bool isPause() const;
/// @brief Enable/disable pause mode
void setPause(bool pause);
/// @brief Show player inventory in inventory-mode
void openInventory();
/// @brief Show block inventory in inventory-mode
/// @param block block position
/// @param doc block ui layout
/// @param blockInv block inventory
/// @param playerInventory show player inventory too
void openInventory(glm::ivec3 block, UiDocument* doc, std::shared_ptr<Inventory> blockInv, bool playerInventory);
/// @brief Show element in inventory-mode
/// @param doc element layout
/// @param playerInventory show player inventory too
void showOverlay(UiDocument* doc, bool playerInventory);
/// @brief Close all open inventories and overlay
void closeInventory();
/// @brief Add element will be visible until removed
/// @param doc element layout
void openPermanent(UiDocument* doc);
void add(HudElement element);
@@ -114,4 +153,4 @@ public:
Player* getPlayer() const;
};
#endif /* SRC_HUD_H_ */
#endif // SRC_HUD_H_