Dawn/archive/ui/UIElement.cpp

53 lines
1.0 KiB
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "UIElement.hpp"
#include "assert/assert.hpp"
using namespace Dawn;
std::vector<std::shared_ptr<UIElement>> UIElement::getChildren() {
return {};
}
void UIElement::getSelfQuads(UICanvas &ctx) {
//Do nothing
}
float_t UIElement::getContentWidth() {
return 0.0f;
}
float_t UIElement::getContentHeight() {
return 0.0f;
}
float_t UIElement::getWidth() {
return this->getContentWidth();
}
float_t UIElement::getHeight() {
return this->getContentHeight();
}
void UIElement::getQuads(UICanvas &ctx) {
this->getSelfQuads(ctx);
auto children = getChildren();
for(auto &c : children) {
c->getQuads(ctx);
}
}
void UIElement::updateAlignment(
const glm::vec2 parentPosition,
const glm::vec2 parentSize,
const float_t canvasScale
) {
auto children = getChildren();
for(auto &c : children) {
c->updateAlignment(parentPosition, parentSize, canvasScale);
}
}