Basic UI Alignment controls examples

This commit is contained in:
2023-12-21 11:21:16 -06:00
parent 457d740c73
commit 92f8b17db6
19 changed files with 497 additions and 101 deletions

37
src/dawn/ui/UIElement.cpp Normal file
View File

@@ -0,0 +1,37 @@
// 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
}
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);
}
}