Refactor, GUI::storage (map for direct access to panels)

This commit is contained in:
MihailRis
2023-11-17 14:26:54 +03:00
parent 4e1f19c911
commit 6392f63604
10 changed files with 75 additions and 54 deletions
+6
View File
@@ -5,6 +5,7 @@
#include <vector>
#include <glm/glm.hpp>
#include <functional>
#include <unordered_map>
class Batch2D;
class Assets;
@@ -50,6 +51,8 @@ namespace gui {
std::shared_ptr<UINode> hover = nullptr;
std::shared_ptr<UINode> pressed = nullptr;
std::shared_ptr<UINode> focus = nullptr;
std::unordered_map<std::string, std::shared_ptr<UINode>> storage;
Camera* uicamera;
public:
GUI();
@@ -62,6 +65,9 @@ namespace gui {
void draw(Batch2D* batch, Assets* assets);
void add(std::shared_ptr<UINode> panel);
void remove(std::shared_ptr<UINode> panel);
void store(std::string name, std::shared_ptr<UINode> node);
std::shared_ptr<UINode> get(std::string name);
void remove(std::string name);
};
}