mirror of
https://github.com/ocornut/imgui.git
synced 2025-10-09 11:36:29 +00:00
This commit is contained in:
@@ -433,11 +433,23 @@ int main(int, char**)
|
|||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||||
|
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
|
||||||
|
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
|
||||||
|
//io.ConfigFlags |= ImGuiConfigFlags_ViewportsNoTaskBarIcons;
|
||||||
|
//io.ConfigFlags |= ImGuiConfigFlags_ViewportsNoMerge;
|
||||||
|
|
||||||
// Setup Dear ImGui style
|
// Setup Dear ImGui style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsLight();
|
//ImGui::StyleColorsLight();
|
||||||
|
|
||||||
|
// When viewports are enabled we tweak WindowRounding/WindowBg so platform windows can look identical to regular ones.
|
||||||
|
ImGuiStyle& style = ImGui::GetStyle();
|
||||||
|
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||||
|
{
|
||||||
|
style.WindowRounding = 0.0f;
|
||||||
|
style.Colors[ImGuiCol_WindowBg].w = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// Setup Platform/Renderer backends
|
// Setup Platform/Renderer backends
|
||||||
ImGui_ImplSDL3_InitForVulkan(window);
|
ImGui_ImplSDL3_InitForVulkan(window);
|
||||||
ImGui_ImplVulkan_InitInfo init_info = {};
|
ImGui_ImplVulkan_InitInfo init_info = {};
|
||||||
@@ -557,17 +569,25 @@ int main(int, char**)
|
|||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
ImDrawData* draw_data = ImGui::GetDrawData();
|
ImDrawData* main_draw_data = ImGui::GetDrawData();
|
||||||
const bool is_minimized = (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f);
|
const bool main_is_minimized = (main_draw_data->DisplaySize.x <= 0.0f || main_draw_data->DisplaySize.y <= 0.0f);
|
||||||
if (!is_minimized)
|
wd->ClearValue.color.float32[0] = clear_color.x * clear_color.w;
|
||||||
|
wd->ClearValue.color.float32[1] = clear_color.y * clear_color.w;
|
||||||
|
wd->ClearValue.color.float32[2] = clear_color.z * clear_color.w;
|
||||||
|
wd->ClearValue.color.float32[3] = clear_color.w;
|
||||||
|
if (!main_is_minimized)
|
||||||
|
FrameRender(wd, main_draw_data);
|
||||||
|
|
||||||
|
// Update and Render additional Platform Windows
|
||||||
|
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||||
{
|
{
|
||||||
wd->ClearValue.color.float32[0] = clear_color.x * clear_color.w;
|
ImGui::UpdatePlatformWindows();
|
||||||
wd->ClearValue.color.float32[1] = clear_color.y * clear_color.w;
|
ImGui::RenderPlatformWindowsDefault();
|
||||||
wd->ClearValue.color.float32[2] = clear_color.z * clear_color.w;
|
|
||||||
wd->ClearValue.color.float32[3] = clear_color.w;
|
|
||||||
FrameRender(wd, draw_data);
|
|
||||||
FramePresent(wd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Present Main Platform Window
|
||||||
|
if (!main_is_minimized)
|
||||||
|
FramePresent(wd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
|
Reference in New Issue
Block a user