Replaced text overlay with proper UI overlay

This commit is contained in:
saschawillems 2017-11-01 14:22:10 +01:00
parent 570750c16f
commit 68692367e0
54 changed files with 564 additions and 1649 deletions

View file

@ -128,8 +128,8 @@ public:
zoomSpeed = 10.0f;
timerSpeed *= 0.25f;
rotation = { -20.5f, -673.0f, 0.0f };
enableTextOverlay = true;
title = "Vulkan Example - Point light shadows";
title = "Point light shadows (cubemap)";
settings.overlay = true;
}
~VulkanExample()
@ -540,16 +540,6 @@ public:
VK_CHECK_RESULT(vkEndCommandBuffer(offscreenPass.commandBuffer));
}
void reBuildCommandBuffers()
{
if (!checkCommandBuffers())
{
destroyCommandBuffers();
createCommandBuffers();
}
buildCommandBuffers();
}
void buildCommandBuffers()
{
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
@ -1048,31 +1038,14 @@ public:
updateUniformBuffers();
}
virtual void keyPressed(uint32_t keyCode)
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
{
switch (keyCode)
{
case KEY_D:
case GAMEPAD_BUTTON_A:
toggleCubeMapDisplay();
break;
if (overlay->header("Settings")) {
if (overlay->checkBox("Display shadow cube render target", &displayCubeMap)) {
buildCommandBuffers();
}
}
}
virtual void getOverlayText(VulkanTextOverlay *textOverlay)
{
#if defined(__ANDROID__)
textOverlay->addText("Press \"Button A\" to display depth cubemap", 5.0f, 85.0f, VulkanTextOverlay::alignLeft);
#else
textOverlay->addText("Press \"d\" to display depth cubemap", 5.0f, 85.0f, VulkanTextOverlay::alignLeft);
#endif
}
void toggleCubeMapDisplay()
{
displayCubeMap = !displayCubeMap;
reBuildCommandBuffers();
}
};
VULKAN_EXAMPLE_MAIN()