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

@ -123,8 +123,8 @@ public:
rotation = { -2.5f, 0.0f, 0.0f };
cameraPos = { 0.0f, 1.0f, 0.0f };
timerSpeed *= 0.25f;
enableTextOverlay = true;
title = "Vulkan Example - Offscreen rendering";
title = "Offscreen rendering";
settings.overlay = true;
enabledFeatures.shaderClipDistance = VK_TRUE;
}
@ -399,16 +399,6 @@ public:
VK_CHECK_RESULT(vkEndCommandBuffer(offscreenPass.commandBuffer));
}
void reBuildCommandBuffers()
{
if (!checkCommandBuffers())
{
destroyCommandBuffers();
createCommandBuffers();
}
buildCommandBuffers();
}
void buildCommandBuffers()
{
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
@ -992,31 +982,14 @@ public:
updateUniformBufferOffscreen();
}
virtual void keyPressed(uint32_t keyCode)
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
{
switch (keyCode)
{
case KEY_D:
case GAMEPAD_BUTTON_A:
toggleDebugDisplay();
break;
if (overlay->header("Settings")) {
if (overlay->checkBox("Display render target", &debugDisplay)) {
buildCommandBuffers();
}
}
}
virtual void getOverlayText(VulkanTextOverlay *textOverlay)
{
#if defined(__ANDROID__)
textOverlay->addText("Press \"Button A\" to display offscreen target", 5.0f, 85.0f, VulkanTextOverlay::alignLeft);
#else
textOverlay->addText("Press \"d\" to display offscreen target", 5.0f, 85.0f, VulkanTextOverlay::alignLeft);
#endif
}
void toggleDebugDisplay()
{
debugDisplay = !debugDisplay;
reBuildCommandBuffers();
}
};
VULKAN_EXAMPLE_MAIN()