Fix issues with UI renderer

This commit is contained in:
2023-09-06 00:03:06 +02:00
parent f9688792c4
commit 9709861bda
5 changed files with 29 additions and 9 deletions

View File

@@ -17,25 +17,34 @@ namespace openVulkanoCpp::Scene::UI
public:
std::vector<std::shared_ptr<UiElement>> children;
virtual ~UiElement() override = default;
~UiElement() override = default;
virtual void Tick() override {};
void Tick() override {};
virtual void Draw() const;
void Render() const
void Render()
{
BeginDraw();
Draw();
for(const auto& child : children)
{
child->Render();
}
EndDraw();
}
protected:
virtual void BeginDraw() {};
virtual void Draw() = 0;
virtual void EndDraw() {};
};
class Ui : public UiElement
{
public:
void Draw() const override {}
virtual void Init() = 0;
void Draw() override {}
};
}