mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 04:21:50 +00:00
dark overlay is an ui element now
This commit is contained in:
parent
51ffb93230
commit
c6a2fc90a8
8 changed files with 25 additions and 24 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue