Code cleanup, rename ui overlay property

This commit is contained in:
Sascha Willems 2024-05-23 21:56:42 +02:00
parent 9a8710a57c
commit fb881ab76f
8 changed files with 69 additions and 69 deletions

View file

@ -1,7 +1,7 @@
/*
* Vulkan Example - imGui (https://github.com/ocornut/imgui)
*
* Copyright (C) 2017-2023 by Sascha Willems - www.saschawillems.de
* Copyright (C) 2017-2024 by Sascha Willems - www.saschawillems.de
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/
@ -61,9 +61,9 @@ public:
//SRS - Set ImGui font and style scale factors to handle retina and other HiDPI displays
ImGuiIO& io = ImGui::GetIO();
io.FontGlobalScale = example->UIOverlay.scale;
io.FontGlobalScale = example->ui.scale;
ImGuiStyle& style = ImGui::GetStyle();
style.ScaleAllSizes(example->UIOverlay.scale);
style.ScaleAllSizes(example->ui.scale);
};
~ImGUI()
@ -380,8 +380,8 @@ public:
// Init imGui windows and elements
// Debug window
ImGui::SetWindowPos(ImVec2(20 * example->UIOverlay.scale, 20 * example->UIOverlay.scale), ImGuiSetCond_FirstUseEver);
ImGui::SetWindowSize(ImVec2(300 * example->UIOverlay.scale, 300 * example->UIOverlay.scale), ImGuiSetCond_Always);
ImGui::SetWindowPos(ImVec2(20 * example->ui.scale, 20 * example->ui.scale), ImGuiSetCond_FirstUseEver);
ImGui::SetWindowSize(ImVec2(300 * example->ui.scale, 300 * example->ui.scale), ImGuiSetCond_Always);
ImGui::TextUnformatted(example->title.c_str());
ImGui::TextUnformatted(device->properties.deviceName);
@ -409,8 +409,8 @@ public:
ImGui::InputFloat3("rotation", &example->camera.rotation.x, 2);
// Example settings window
ImGui::SetNextWindowPos(ImVec2(20 * example->UIOverlay.scale, 360 * example->UIOverlay.scale), ImGuiSetCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(300 * example->UIOverlay.scale, 200 * example->UIOverlay.scale), ImGuiSetCond_FirstUseEver);
ImGui::SetNextWindowPos(ImVec2(20 * example->ui.scale, 360 * example->ui.scale), ImGuiSetCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(300 * example->ui.scale, 200 * example->ui.scale), ImGuiSetCond_FirstUseEver);
ImGui::Begin("Example settings");
ImGui::Checkbox("Render models", &uiSettings.displayModels);
ImGui::Checkbox("Display logos", &uiSettings.displayLogos);
@ -638,7 +638,7 @@ public:
}
// Render imGui
if (UIOverlay.visible) {
if (ui.visible) {
imGui->drawFrame(drawCmdBuffers[i]);
}
@ -794,9 +794,9 @@ public:
io.DeltaTime = frameTimer;
io.MousePos = ImVec2(mouseState.position.x, mouseState.position.y);
io.MouseDown[0] = mouseState.buttons.left && UIOverlay.visible;
io.MouseDown[1] = mouseState.buttons.right && UIOverlay.visible;
io.MouseDown[2] = mouseState.buttons.middle && UIOverlay.visible;
io.MouseDown[0] = mouseState.buttons.left && ui.visible;
io.MouseDown[1] = mouseState.buttons.right && ui.visible;
io.MouseDown[2] = mouseState.buttons.middle && ui.visible;
draw();
}
@ -804,7 +804,7 @@ public:
virtual void mouseMoved(double x, double y, bool &handled)
{
ImGuiIO& io = ImGui::GetIO();
handled = io.WantCaptureMouse && UIOverlay.visible;
handled = io.WantCaptureMouse && ui.visible;
}
// Input handling is platform specific, to show how it's basically done this sample implements it for Windows