51 lines
836 B
C++
51 lines
836 B
C++
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "Base/ITickable.hpp"
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace openVulkanoCpp::Scene::UI
|
|
{
|
|
class UiElement : public ITickable
|
|
{
|
|
public:
|
|
std::vector<std::shared_ptr<UiElement>> children;
|
|
|
|
~UiElement() override = default;
|
|
|
|
void Tick() override {};
|
|
|
|
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:
|
|
virtual void Init() = 0;
|
|
|
|
void Draw() override {}
|
|
};
|
|
}
|