dark overlay is an ui element now

This commit is contained in:
MihailRis
2024-01-26 15:50:50 +03:00
parent 51ffb93230
commit c6a2fc90a8
8 changed files with 25 additions and 24 deletions
+4
View File
@@ -135,6 +135,10 @@ bool GUI::isFocusCaught() const {
return focus && focus->isfocuskeeper();
}
void GUI::addBack(std::shared_ptr<UINode> panel) {
container->addBack(panel);
}
void GUI::add(shared_ptr<UINode> panel) {
container->add(panel);
}
+1
View File
@@ -71,6 +71,7 @@ namespace gui {
void act(float delta);
void draw(Batch2D* batch, Assets* assets);
void addBack(std::shared_ptr<UINode> panel);
void add(std::shared_ptr<UINode> panel);
void remove(std::shared_ptr<UINode> panel);
void store(std::string name, std::shared_ptr<UINode> node);
+9 -1
View File
@@ -22,7 +22,9 @@ shared_ptr<UINode> Container::getAt(vec2 pos, shared_ptr<UINode> self) {
return nullptr;
}
if (!isInside(pos)) return nullptr;
for (auto node : nodes) {
for (int i = nodes.size()-1; i >= 0; i--) {
auto& node = nodes[i];
if (!node->visible())
continue;
auto hover = node->getAt(pos, node);
@@ -91,6 +93,12 @@ void Container::draw(Batch2D* batch, Assets* assets) {
Window::popScissor();
}
void Container::addBack(shared_ptr<UINode> node) {
nodes.insert(nodes.begin(), node);
node->setParent(this);
refresh();
}
void Container::add(shared_ptr<UINode> node) {
nodes.push_back(node);
node->setParent(this);
+1
View File
@@ -37,6 +37,7 @@ namespace gui {
virtual void drawBackground(Batch2D* batch, Assets* assets) {};
virtual void draw(Batch2D* batch, Assets* assets) override;
virtual std::shared_ptr<UINode> getAt(glm::vec2 pos, std::shared_ptr<UINode> self) override;
virtual void addBack(std::shared_ptr<UINode> node);
virtual void add(std::shared_ptr<UINode> node);
virtual void add(UINode* node);
virtual void add(std::shared_ptr<UINode> node, glm::vec2 coord);