This commit is contained in:
2023-03-05 15:51:07 -08:00
parent 7d20397e83
commit aeb5014a07
10 changed files with 49 additions and 8 deletions

View File

@ -7,6 +7,7 @@
#include "display/Transform.hpp"
#include "event/Event.hpp"
#include "scene/Scene.hpp"
#include "util/array.hpp"
namespace Dawn {
class SceneItemComponent;
@ -113,6 +114,22 @@ namespace Dawn {
}
return children;
}
template<class T>
std::vector<T*> findChildrenDeep() {
std::vector<Transform*> itemsToCheck = this->transform.children;
std::vector<T*> itemsFound;
while(itemsToCheck.size() > 0) {
auto item = itemsToCheck.begin();
vectorAppend(&itemsToCheck, (*item)->children);
auto component = (*item)->item->getComponent<T>();
if(component != nullptr) itemsFound.push_back(component);
itemsToCheck.erase(item);
}
return itemsFound;
}
/**
* Destroy this SceneItem.

View File

@ -7,6 +7,8 @@
target_sources(${DAWN_TARGET_NAME}
PRIVATE
UICanvas.cpp
UIComponent.cpp
UILabel.cpp
)
tool_scenecomponent(UICanvas scene/components/ui/UICanvas.hpp)

View File

@ -8,6 +8,11 @@
#include "UICanvas.hpp"
namespace Dawn {
class UIComponentRendaerable {
public:
int32_t cum;
};
class UIComponent : public SceneItemComponent {
private:
UICanvas *canvas = nullptr;

View File

@ -24,8 +24,8 @@ void UILabel::updateMesh() {
// std::string text = this->getGame()->localeManager.getString(key);
this->font->buffer(
this->text,
this->fontSize,
text,
fontSize,
-1,
&this->mesh,
&this->measure

View File

@ -5,6 +5,7 @@
#pragma once
#include "UIComponent.hpp"
#include "display/font/Font.hpp"
namespace Dawn {
class UILabel : public UIComponent {