Add ui logic for renderer
This commit is contained in:
41
openVulkanoCpp/Scene/UI/UI.hpp
Normal file
41
openVulkanoCpp/Scene/UI/UI.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
virtual ~UiElement() override = default;
|
||||
|
||||
virtual void Tick() override {};
|
||||
|
||||
virtual void Draw() const;
|
||||
|
||||
void Render() const
|
||||
{
|
||||
Draw();
|
||||
for(const auto& child : children)
|
||||
{
|
||||
child->Render();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class Ui : public UiElement
|
||||
{
|
||||
public:
|
||||
void Draw() const override {}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user