Basic UI Alignment controls examples
This commit is contained in:
37
src/dawn/ui/UIElement.cpp
Normal file
37
src/dawn/ui/UIElement.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user