Fix issues with ui rendering

This commit is contained in:
2023-09-08 18:17:16 +02:00
parent 2bcea0d7fd
commit 703f5c0d12
12 changed files with 43 additions and 50 deletions

View File

@@ -106,7 +106,7 @@ namespace openVulkanoCpp::Scene
{
CheckShaderInitState();
if (bindingId < 0) bindingId = static_cast<int>(vertexInputDescriptions.size());
while (bindingId > vertexInputDescriptions.size())
while (bindingId > static_cast<int>(vertexInputDescriptions.size()))
{
vertexInputDescriptions.emplace_back(0, 0);
}
@@ -127,7 +127,7 @@ namespace openVulkanoCpp::Scene
if (setId < 0) setId = static_cast<int>(descriptorSets.size() + 2);
if (setId < 2) throw std::runtime_error("Cant bind set id 0 or 1!");
setId -= 2;
while (setId >= descriptorSets.size())
while (setId >= static_cast<int>(descriptorSets.size()))
{
descriptorSets.emplace_back();
}

View File

@@ -27,7 +27,8 @@ namespace openVulkanoCpp::Scene::UI
Draw();
for(const auto& child : children)
{
child->Render();
if (child->ShouldDraw())
child->Render();
}
EndDraw();
}
@@ -38,6 +39,8 @@ namespace openVulkanoCpp::Scene::UI
virtual void Draw() = 0;
virtual void EndDraw() {};
virtual bool ShouldDraw() { return true; }
};
class Ui : public UiElement