VN System improved.
This commit is contained in:
@ -1,13 +1,14 @@
|
||||
# Copyright (c) 2022 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
UIBorder.cpp
|
||||
UIComponent.cpp
|
||||
UILabel.cpp
|
||||
UISprite.cpp
|
||||
# Copyright (c) 2022 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
UIBorder.cpp
|
||||
UIComponent.cpp
|
||||
UILabel.cpp
|
||||
UISprite.cpp
|
||||
UIEmpty.cpp
|
||||
)
|
@ -139,10 +139,11 @@ void UIComponent::addChild(UIComponent *child) {
|
||||
if(child->parent != nullptr) child->parent->removeChild(child);
|
||||
this->children.push_back(child);
|
||||
child->parent = this;
|
||||
this->updatePositions();
|
||||
}
|
||||
|
||||
void UIComponent::removeChild(UIComponent *child) {
|
||||
assertTrue(child->parent != this);
|
||||
assertTrue(child->parent == this);
|
||||
auto it = this->children.begin();
|
||||
while(it != this->children.end()) {
|
||||
if(*it == child) {
|
||||
@ -151,6 +152,7 @@ void UIComponent::removeChild(UIComponent *child) {
|
||||
}
|
||||
++it;
|
||||
}
|
||||
child->parent = nullptr;
|
||||
}
|
||||
|
||||
UIComponent::~UIComponent() {
|
||||
|
16
src/dawn/ui/UIEmpty.cpp
Normal file
16
src/dawn/ui/UIEmpty.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "UIEmpty.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
UIEmpty::UIEmpty(UICanvas *canvas) : UIComponent(canvas) {
|
||||
|
||||
}
|
||||
|
||||
void UIEmpty::drawSelf(UIShader *shader, glm::mat4 selfTrans) {
|
||||
|
||||
}
|
15
src/dawn/ui/UIEmpty.hpp
Normal file
15
src/dawn/ui/UIEmpty.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "UIComponent.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class UIEmpty : public UIComponent {
|
||||
public:
|
||||
UIEmpty(UICanvas *canvas);
|
||||
void drawSelf(UIShader *uiShader, glm::mat4 selfTransform) override;
|
||||
};
|
||||
}
|
@ -18,7 +18,7 @@ void UILabel::updatePositions() {
|
||||
|
||||
void UILabel::updateMesh() {
|
||||
if(!this->needsRebuffering) return;
|
||||
if(this->font == nullptr) return;
|
||||
if(this->font == nullptr || !this->font->isReady()) return;
|
||||
if(this->text.size() == 0) return;
|
||||
|
||||
float_t width = this->getWidth();
|
||||
|
Reference in New Issue
Block a user