Canvas and UI Component #222

Merged
maverickdgg merged 5 commits from SP3-20-UI-System into main 2022-11-18 12:29:40 +08:00
2 changed files with 8 additions and 4 deletions
Showing only changes of commit d997cd4da6 - Show all commits

View File

@ -31,7 +31,7 @@ namespace SHADE
auto& children = sceneGraph.GetChildren(canvas.GetEID());
for (auto& child : children)
{
RecurssiveUIComponentCheck(child);
RecurssiveUIComponentCheck(child, canvas);
}
}
@ -53,7 +53,7 @@ namespace SHADE
}
void SHUISystem::AddUIComponentRoutine::RecurssiveUIComponentCheck(SHSceneNode* node) noexcept
void SHUISystem::AddUIComponentRoutine::RecurssiveUIComponentCheck(SHSceneNode* node, SHCanvasComponent& canvas) noexcept
{
if (node == nullptr)
return;
@ -62,11 +62,15 @@ namespace SHADE
if(SHComponentManager::HasComponent<SHUIComponent>(eid) == false)
SHComponentManager::AddComponent<SHUIComponent>(eid);
else
{
SHComponentManager::GetComponent<SHUIComponent>(eid)->canvasID = canvas.GetEID();
}
auto& children = SHSceneManager::GetCurrentSceneGraph().GetChildren(eid);
for (auto& child : children)
{
RecurssiveUIComponentCheck(child);
RecurssiveUIComponentCheck(child, canvas);
}
}

View File

@ -25,7 +25,7 @@ namespace SHADE
private:
void RecurssiveUIComponentCheck(SHSceneNode* node) noexcept;
void RecurssiveUIComponentCheck(SHSceneNode* node, SHCanvasComponent& canvas) noexcept;
};
friend class AddUIComponentRoutine;