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

@ -120,8 +120,8 @@ public:
zoom = -10.0f;
rotation = { -16.25f, -28.75f, 0.0f };
timerSpeed *= 0.5f;
enableTextOverlay = true;
title = "Vulkan Example - Radial blur";
title = "Full screen radial blur effect";
settings.overlay = true;
}
~VulkanExample()
@ -386,16 +386,6 @@ public:
VK_CHECK_RESULT(vkEndCommandBuffer(offscreenPass.commandBuffer));
}
void reBuildCommandBuffers()
{
if (!checkCommandBuffers())
{
destroyCommandBuffers();
createCommandBuffers();
}
buildCommandBuffers();
}
void buildCommandBuffers()
{
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
@ -835,44 +825,17 @@ public:
updateUniformBuffersScene();
}
void toggleBlur()
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
{
blur = !blur;
updateUniformBuffersScene();
reBuildCommandBuffers();
}
void toggleTextureDisplay()
{
displayTexture = !displayTexture;
reBuildCommandBuffers();
}
virtual void keyPressed(uint32_t keyCode)
{
switch (keyCode)
{
case KEY_B:
case GAMEPAD_BUTTON_A:
toggleBlur();
break;
case KEY_T:
case GAMEPAD_BUTTON_X:
toggleTextureDisplay();
break;
if (overlay->header("Settings")) {
if (overlay->checkBox("Radial blur", &blur)) {
buildCommandBuffers();
}
if (overlay->checkBox("Dsiplay render target", &displayTexture)) {
buildCommandBuffers();
}
}
}
virtual void getOverlayText(VulkanTextOverlay *textOverlay)
{
#if defined(__ANDROID__)
textOverlay->addText("Press \"Button A\" to toggle blur", 5.0f, 85.0f, VulkanTextOverlay::alignLeft);
textOverlay->addText("Press \"Button X\" to display offscreen texture", 5.0f, 105.0f, VulkanTextOverlay::alignLeft);
#else
textOverlay->addText("Press \"B\" to toggle blur", 5.0f, 85.0f, VulkanTextOverlay::alignLeft);
textOverlay->addText("Press \"T\" to display offscreen texture", 5.0f, 105.0f, VulkanTextOverlay::alignLeft);
#endif
}
};
VULKAN_EXAMPLE_MAIN()