Fix F1 on/off toggle for ImGui overlay (all platforms), clean up keycode handling (mostly macOS/iOS)

This commit is contained in:
Stephen Saunders 2022-08-01 16:11:57 -04:00
parent 5c2aaaf693
commit 1b3fe76cdb
7 changed files with 106 additions and 70 deletions

View file

@ -596,7 +596,9 @@ public:
}
// Render imGui
imGui->drawFrame(drawCmdBuffers[i]);
if (UIOverlay.visible) {
imGui->drawFrame(drawCmdBuffers[i]);
}
vkCmdEndRenderPass(drawCmdBuffers[i]);
@ -748,8 +750,9 @@ public:
io.DeltaTime = frameTimer;
io.MousePos = ImVec2(mousePos.x, mousePos.y);
io.MouseDown[0] = mouseButtons.left;
io.MouseDown[1] = mouseButtons.right;
io.MouseDown[0] = mouseButtons.left && UIOverlay.visible;
io.MouseDown[1] = mouseButtons.right && UIOverlay.visible;
io.MouseDown[2] = mouseButtons.middle && UIOverlay.visible;
draw();
@ -765,7 +768,7 @@ public:
virtual void mouseMoved(double x, double y, bool &handled)
{
ImGuiIO& io = ImGui::GetIO();
handled = io.WantCaptureMouse;
handled = io.WantCaptureMouse && UIOverlay.visible;
}
};

View file

@ -321,9 +321,7 @@ public:
vkCmdBindPipeline(secondaryCommandBuffers.ui, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.starsphere);
if (settings.overlay) {
drawUI(secondaryCommandBuffers.ui);
}
drawUI(secondaryCommandBuffers.ui);
VK_CHECK_RESULT(vkEndCommandBuffer(secondaryCommandBuffers.ui));
}

View file

@ -915,7 +915,6 @@ public:
updateTextOverlay();
}
#if !defined(__ANDROID__)
virtual void keyPressed(uint32_t keyCode)
{
switch (keyCode)
@ -925,7 +924,6 @@ public:
textOverlay->visible = !textOverlay->visible;
}
}
#endif
};
VULKAN_EXAMPLE_MAIN()