mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Refactor, GUI::storage (map for direct access to panels)
This commit is contained in:
parent
4e1f19c911
commit
6392f63604
10 changed files with 75 additions and 54 deletions
|
|
@ -12,6 +12,7 @@
|
|||
#include "../../window/input.h"
|
||||
#include "../../window/Camera.h"
|
||||
|
||||
using std::string;
|
||||
using std::shared_ptr;
|
||||
using namespace gui;
|
||||
|
||||
|
|
@ -101,6 +102,22 @@ void GUI::add(shared_ptr<UINode> panel) {
|
|||
container->add(panel);
|
||||
}
|
||||
|
||||
void GUI::remove(std::shared_ptr<UINode> panel) {
|
||||
void GUI::remove(shared_ptr<UINode> panel) {
|
||||
container->remove(panel);
|
||||
}
|
||||
|
||||
void GUI::store(string name, shared_ptr<UINode> node) {
|
||||
storage[name] = node;
|
||||
}
|
||||
|
||||
shared_ptr<UINode> GUI::get(string name) {
|
||||
auto found = storage.find(name);
|
||||
if (found == storage.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return found->second;
|
||||
}
|
||||
|
||||
void GUI::remove(string name) {
|
||||
storage.erase(name);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue