Revert "Viewports: Renamed UpdatePlatformWindows > PlatformWindowsUpdate, RenderPlatformWindowsDefault -> PlatformWindowsRender, DestroyPlatformWindows > PlatformWindowsDestroy (#1542)"
This reverts commit f2c7f3b200
.
This commit is contained in:
parent
f2c7f3b200
commit
fbaf65b8f6
@ -82,7 +82,7 @@ Other changes:
|
||||
- Added GetWindowDpiScale().
|
||||
- Added GetOverlayDrawList(ImGuiViewport* viewport).
|
||||
The no-parameter version of GetOverlayDrawList() return the overlay for the current window's viewport.
|
||||
- Added PlatformWindowsUpdate(), PlatformWindowsRender(), PlatformWindowsDestroy() for usage for application core.
|
||||
- Added UpdatePlatformWindows(), RenderPlatformWindows(), DestroyPlatformWindows() for usage for application core.
|
||||
- Added FindViewportByID(), FindViewportByPlatformHandle() for usage by back-ends.
|
||||
- Added ImGuiConfigFlags_ViewportsEnable configuration flag and other viewport options.
|
||||
- Added io.ConfigViewportsNoAutoMerge, io.ConfigViewportsNoTaskBarIcon, io.ConfigViewportsNoDecoration, io.ConfigViewportsNoDefaultParent options.
|
||||
|
@ -160,8 +160,8 @@ int main(int, char**)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
GLFWwindow* backup_current_context = glfwGetCurrentContext();
|
||||
ImGui::PlatformWindowsUpdate();
|
||||
ImGui::PlatformWindowsRender();
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
glfwMakeContextCurrent(backup_current_context);
|
||||
}
|
||||
|
||||
|
@ -205,8 +205,8 @@ int main(int, char**)
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
GLFWwindow* backup_current_context = glfwGetCurrentContext();
|
||||
ImGui::PlatformWindowsUpdate();
|
||||
ImGui::PlatformWindowsRender();
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
glfwMakeContextCurrent(backup_current_context);
|
||||
}
|
||||
|
||||
|
@ -525,8 +525,8 @@ int main(int, char**)
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::PlatformWindowsUpdate();
|
||||
ImGui::PlatformWindowsRender();
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
}
|
||||
|
||||
FramePresent(wd);
|
||||
|
@ -166,8 +166,8 @@ int main(int, char**)
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::PlatformWindowsUpdate();
|
||||
ImGui::PlatformWindowsRender();
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
}
|
||||
|
||||
g_pSwapChain->Present(1, 0); // Present with vsync
|
||||
|
@ -158,8 +158,8 @@ int main(int, char**)
|
||||
{
|
||||
SDL_Window* backup_current_window = SDL_GL_GetCurrentWindow();
|
||||
SDL_GLContext backup_current_context = SDL_GL_GetCurrentContext();
|
||||
ImGui::PlatformWindowsUpdate();
|
||||
ImGui::PlatformWindowsRender();
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
SDL_GL_MakeCurrent(backup_current_window, backup_current_context);
|
||||
}
|
||||
|
||||
|
@ -207,8 +207,8 @@ int main(int, char**)
|
||||
{
|
||||
SDL_Window* backup_current_window = SDL_GL_GetCurrentWindow();
|
||||
SDL_GLContext backup_current_context = SDL_GL_GetCurrentContext();
|
||||
ImGui::PlatformWindowsUpdate();
|
||||
ImGui::PlatformWindowsRender();
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
SDL_GL_MakeCurrent(backup_current_window, backup_current_context);
|
||||
}
|
||||
|
||||
|
@ -522,8 +522,8 @@ int main(int, char**)
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::PlatformWindowsUpdate();
|
||||
ImGui::PlatformWindowsRender();
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
}
|
||||
|
||||
FramePresent(wd);
|
||||
|
@ -159,8 +159,8 @@ int main(int, char**)
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::PlatformWindowsUpdate();
|
||||
ImGui::PlatformWindowsRender();
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
}
|
||||
|
||||
g_pSwapChain->Present(1, 0); // Present with vsync
|
||||
|
@ -166,8 +166,8 @@ int main(int, char**)
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::PlatformWindowsUpdate();
|
||||
ImGui::PlatformWindowsRender();
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
}
|
||||
|
||||
g_pSwapChain->Present(1, 0); // Present with vsync
|
||||
|
@ -210,8 +210,8 @@ int main(int, char**)
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::PlatformWindowsUpdate();
|
||||
ImGui::PlatformWindowsRender(NULL, (void*)g_pd3dCommandList);
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault(NULL, (void*)g_pd3dCommandList);
|
||||
}
|
||||
|
||||
g_pSwapChain->Present(1, 0); // Present with vsync
|
||||
|
@ -165,8 +165,8 @@ int main(int, char**)
|
||||
// Update and Render additional Platform Windows
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::PlatformWindowsUpdate();
|
||||
ImGui::PlatformWindowsRender();
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
}
|
||||
|
||||
HRESULT result = g_pd3dDevice->Present(NULL, NULL, NULL, NULL);
|
||||
|
@ -655,6 +655,6 @@ void ImGui_ImplDX10_InitPlatformInterface()
|
||||
|
||||
void ImGui_ImplDX10_ShutdownPlatformInterface()
|
||||
{
|
||||
ImGui::PlatformWindowsDestroy();
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
||||
|
@ -671,5 +671,5 @@ static void ImGui_ImplDX11_InitPlatformInterface()
|
||||
|
||||
static void ImGui_ImplDX11_ShutdownPlatformInterface()
|
||||
{
|
||||
ImGui::PlatformWindowsDestroy();
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -947,5 +947,5 @@ void ImGui_ImplDX12_InitPlatformInterface()
|
||||
|
||||
void ImGui_ImplDX12_ShutdownPlatformInterface()
|
||||
{
|
||||
ImGui::PlatformWindowsDestroy();
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ static void ImGui_ImplDX9_InitPlatformInterface()
|
||||
|
||||
static void ImGui_ImplDX9_ShutdownPlatformInterface()
|
||||
{
|
||||
ImGui::PlatformWindowsDestroy();
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
||||
static void ImGui_ImplDX9_CreateDeviceObjectsForPlatformWindows()
|
||||
|
@ -598,7 +598,7 @@ static LRESULT CALLBACK WndProcNoInputs(HWND hWnd, UINT msg, WPARAM wParam, LPAR
|
||||
// Let mouse pass-through the window. This will allow the back-end to set io.MouseHoveredViewport properly (which is OPTIONAL).
|
||||
// The ImGuiViewportFlags_NoInputs flag is set while dragging a viewport, as want to detect the window behind the one we are dragging.
|
||||
// If you cannot easily access those viewport flags from your windowing/event code: you may manually synchronize its state e.g. in
|
||||
// your main loop after calling PlatformWindowsUpdate(). Iterate all viewports/platform windows and pass the flag to your windowing system.
|
||||
// your main loop after calling UpdatePlatformWindows(). Iterate all viewports/platform windows and pass the flag to your windowing system.
|
||||
ImGuiViewport* viewport = (ImGuiViewport*)::GetPropA(hWnd, "IMGUI_VIEWPORT");
|
||||
if (viewport->Flags & ImGuiViewportFlags_NoInputs)
|
||||
return HTTRANSPARENT;
|
||||
|
@ -283,5 +283,5 @@ static void ImGui_ImplOpenGL2_InitPlatformInterface()
|
||||
|
||||
static void ImGui_ImplOpenGL2_ShutdownPlatformInterface()
|
||||
{
|
||||
ImGui::PlatformWindowsDestroy();
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -712,5 +712,5 @@ static void ImGui_ImplOpenGL3_InitPlatformInterface()
|
||||
|
||||
static void ImGui_ImplOpenGL3_ShutdownPlatformInterface()
|
||||
{
|
||||
ImGui::PlatformWindowsDestroy();
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -1445,5 +1445,5 @@ void ImGui_ImplVulkan_InitPlatformInterface()
|
||||
|
||||
void ImGui_ImplVulkan_ShutdownPlatformInterface()
|
||||
{
|
||||
ImGui::PlatformWindowsDestroy();
|
||||
ImGui::DestroyPlatformWindows();
|
||||
}
|
||||
|
@ -798,7 +798,7 @@ static LRESULT CALLBACK ImGui_ImplWin32_WndProcHandler_PlatformWindow(HWND hWnd,
|
||||
// Let mouse pass-through the window. This will allow the back-end to set io.MouseHoveredViewport properly (which is OPTIONAL).
|
||||
// The ImGuiViewportFlags_NoInputs flag is set while dragging a viewport, as want to detect the window behind the one we are dragging.
|
||||
// If you cannot easily access those viewport flags from your windowing/event code: you may manually synchronize its state e.g. in
|
||||
// your main loop after calling PlatformWindowsUpdate(). Iterate all viewports/platform windows and pass the flag to your windowing system.
|
||||
// your main loop after calling UpdatePlatformWindows(). Iterate all viewports/platform windows and pass the flag to your windowing system.
|
||||
if (viewport->Flags & ImGuiViewportFlags_NoInputs)
|
||||
return HTTRANSPARENT;
|
||||
break;
|
||||
|
36
imgui.cpp
36
imgui.cpp
@ -3912,7 +3912,7 @@ static void NewFrameSanityChecks()
|
||||
{
|
||||
if ((g.IO.BackendFlags & ImGuiBackendFlags_PlatformHasViewports) && (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasViewports))
|
||||
{
|
||||
IM_ASSERT((g.FrameCount == 0 || g.FrameCount == g.FrameCountPlatformEnded) && "Forgot to call PlatformWindowsUpdate() in main loop after EndFrame()? Check examples/ applications for reference.");
|
||||
IM_ASSERT((g.FrameCount == 0 || g.FrameCount == g.FrameCountPlatformEnded) && "Forgot to call UpdatePlatformWindows() in main loop after EndFrame()? Check examples/ applications for reference.");
|
||||
IM_ASSERT(g.PlatformIO.Platform_CreateWindow != NULL && "Platform init didn't install handlers?");
|
||||
IM_ASSERT(g.PlatformIO.Platform_DestroyWindow != NULL && "Platform init didn't install handlers?");
|
||||
IM_ASSERT(g.PlatformIO.Platform_GetWindowPos != NULL && "Platform init didn't install handlers?");
|
||||
@ -4233,7 +4233,7 @@ void ImGui::Shutdown(ImGuiContext* context)
|
||||
// Destroy platform windows
|
||||
ImGuiContext* backup_context = ImGui::GetCurrentContext();
|
||||
SetCurrentContext(context);
|
||||
PlatformWindowsDestroy();
|
||||
DestroyPlatformWindows();
|
||||
SetCurrentContext(backup_context);
|
||||
|
||||
// Shutdown extensions
|
||||
@ -10582,13 +10582,13 @@ static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandl
|
||||
// - UpdateViewportsEndFrame() [Internal]
|
||||
// - AddUpdateViewport() [Internal]
|
||||
// - UpdateSelectWindowViewport() [Internal]
|
||||
// - PlatformWindowsUpdate()
|
||||
// - PlatformWindowsRender()
|
||||
// - UpdatePlatformWindows()
|
||||
// - RenderPlatformWindowsDefault()
|
||||
// - FindPlatformMonitorForPos() [Internal]
|
||||
// - FindPlatformMonitorForRect() [Internal]
|
||||
// - UpdateViewportPlatformMonitor() [Internal]
|
||||
// - PlatformWindowsDestroyOne() [Internal]
|
||||
// - PlatformWindowsDestroy()
|
||||
// - DestroyPlatformWindow() [Internal]
|
||||
// - DestroyPlatformWindows()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ImGuiViewport* ImGui::GetMainViewport()
|
||||
@ -10809,7 +10809,7 @@ static void ImGui::UpdateViewportsNewFrame()
|
||||
|
||||
// Destroy
|
||||
IMGUI_DEBUG_LOG_VIEWPORT("Delete Viewport %08X (%s)\n", viewport->ID, viewport->Window ? viewport->Window->Name : "n/a");
|
||||
PlatformWindowsDestroyOne(viewport); // In most circumstances the platform window will already be destroyed here.
|
||||
DestroyPlatformWindow(viewport); // In most circumstances the platform window will already be destroyed here.
|
||||
IM_ASSERT(g.PlatformIO.Viewports.contains(viewport) == false);
|
||||
IM_DELETE(viewport);
|
||||
n--;
|
||||
@ -10820,7 +10820,7 @@ static void ImGui::UpdateViewportsNewFrame()
|
||||
if (viewports_enabled)
|
||||
{
|
||||
// Update Position and Size (from Platform Window to ImGui) if requested.
|
||||
// We do it early in the frame instead of waiting for PlatformWindowsUpdate() to avoid a frame of lag when moving/resizing using OS facilities.
|
||||
// We do it early in the frame instead of waiting for UpdatePlatformWindows() to avoid a frame of lag when moving/resizing using OS facilities.
|
||||
if (!(viewport->Flags & ImGuiViewportFlags_Minimized) && platform_funcs_available)
|
||||
{
|
||||
if (viewport->PlatformRequestMove)
|
||||
@ -10943,7 +10943,7 @@ static void ImGui::UpdateViewportsEndFrame()
|
||||
IM_ASSERT(viewport->Window != NULL);
|
||||
g.PlatformIO.Viewports.push_back(viewport);
|
||||
}
|
||||
g.Viewports[0]->ClearRequestFlags(); // Clear main viewport flags because PlatformWindowsUpdate() won't do it and may not even be called
|
||||
g.Viewports[0]->ClearRequestFlags(); // Clear main viewport flags because UpdatePlatformWindows() won't do it and may not even be called
|
||||
}
|
||||
|
||||
// FIXME: We should ideally refactor the system to call this every frame (we currently don't)
|
||||
@ -11135,11 +11135,11 @@ static void ImGui::UpdateSelectWindowViewport(ImGuiWindow* window)
|
||||
}
|
||||
|
||||
// Called by user at the end of the main loop, after EndFrame()
|
||||
// This will handle the creation/update of all OS windows via function defined in the ImGuiPlatformIO API.
|
||||
void ImGui::PlatformWindowsUpdate()
|
||||
// This will handle the creation/update of all OS windows via function defined in the ImGuiPlatformIO api.
|
||||
void ImGui::UpdatePlatformWindows()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(g.FrameCountEnded == g.FrameCount && "Forgot to call Render() or EndFrame() before PlatformWindowsUpdate()?");
|
||||
IM_ASSERT(g.FrameCountEnded == g.FrameCount && "Forgot to call Render() or EndFrame() before UpdatePlatformWindows()?");
|
||||
IM_ASSERT(g.FrameCountPlatformEnded < g.FrameCount);
|
||||
g.FrameCountPlatformEnded = g.FrameCount;
|
||||
if (!(g.ConfigFlagsCurrFrame & ImGuiConfigFlags_ViewportsEnable))
|
||||
@ -11152,13 +11152,13 @@ void ImGui::PlatformWindowsUpdate()
|
||||
ImGuiViewportP* viewport = g.Viewports[i];
|
||||
|
||||
// Destroy platform window if the viewport hasn't been submitted or if it is hosting a hidden window
|
||||
// (the implicit/fallback Debug##Default window will be registering its viewport then be disabled, causing a dummy PlatformWindowsDestroyOne to be made each frame)
|
||||
// (the implicit/fallback Debug##Default window will be registering its viewport then be disabled, causing a dummy DestroyPlatformWindow to be made each frame)
|
||||
bool destroy_platform_window = false;
|
||||
destroy_platform_window |= (viewport->LastFrameActive < g.FrameCount - 1);
|
||||
destroy_platform_window |= (viewport->Window && !IsWindowActiveAndVisible(viewport->Window));
|
||||
if (destroy_platform_window)
|
||||
{
|
||||
PlatformWindowsDestroyOne(viewport);
|
||||
DestroyPlatformWindow(viewport);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -11267,7 +11267,7 @@ void ImGui::PlatformWindowsUpdate()
|
||||
// if ((platform_io.Viewports[i]->Flags & ImGuiViewportFlags_Minimized) == 0)
|
||||
// MySwapBufferFunction(platform_io.Viewports[i], my_args);
|
||||
//
|
||||
void ImGui::PlatformWindowsRender(void* platform_render_arg, void* renderer_render_arg)
|
||||
void ImGui::RenderPlatformWindowsDefault(void* platform_render_arg, void* renderer_render_arg)
|
||||
{
|
||||
// Skip the main viewport (index 0), which is always fully handled by the application!
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
@ -11341,7 +11341,7 @@ static void ImGui::UpdateViewportPlatformMonitor(ImGuiViewportP* viewport)
|
||||
viewport->PlatformMonitor = (short)FindPlatformMonitorForRect(viewport->GetMainRect());
|
||||
}
|
||||
|
||||
void ImGui::PlatformWindowsDestroyOne(ImGuiViewportP* viewport)
|
||||
void ImGui::DestroyPlatformWindow(ImGuiViewportP* viewport)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (viewport->PlatformWindowCreated)
|
||||
@ -11365,7 +11365,7 @@ void ImGui::PlatformWindowsDestroyOne(ImGuiViewportP* viewport)
|
||||
viewport->ClearRequestFlags();
|
||||
}
|
||||
|
||||
void ImGui::PlatformWindowsDestroy()
|
||||
void ImGui::DestroyPlatformWindows()
|
||||
{
|
||||
// We call the destroy window on every viewport (including the main viewport, index 0) to give a chance to the back-end
|
||||
// to clear any data they may have stored in e.g. PlatformUserData, RendererUserData.
|
||||
@ -11375,7 +11375,7 @@ void ImGui::PlatformWindowsDestroy()
|
||||
// crashing if it doesn't have data stored.
|
||||
ImGuiContext& g = *GImGui;
|
||||
for (int i = 0; i < g.Viewports.Size; i++)
|
||||
PlatformWindowsDestroyOne(g.Viewports[i]);
|
||||
DestroyPlatformWindow(g.Viewports[i]);
|
||||
}
|
||||
|
||||
|
||||
|
40
imgui.h
40
imgui.h
@ -779,11 +779,11 @@ namespace ImGui
|
||||
// Note: You may use GetWindowViewport() to get the current viewport of the current window.
|
||||
IMGUI_API ImGuiPlatformIO& GetPlatformIO(); // platform/renderer functions, for back-end to setup + viewports list.
|
||||
IMGUI_API ImGuiViewport* GetMainViewport(); // main viewport. same as GetPlatformIO().MainViewport == GetPlatformIO().Viewports[0].
|
||||
IMGUI_API void PlatformWindowsUpdate(); // call in main loop. will call CreateWindow/ResizeWindow/etc. platform functions for each secondary viewport, and DestroyWindow for each inactive viewport.
|
||||
IMGUI_API void PlatformWindowsRender(void* platform_render_arg = NULL, void* renderer_render_arg = NULL); // call in main loop. will call RenderWindow/SwapBuffers platform functions for each secondary viewport which doesn't have the ImGuiViewportFlags_Minimized flag set. May be reimplemented by user for custom rendering needs.
|
||||
IMGUI_API void PlatformWindowsDestroy(); // call DestroyWindow platform functions for all viewports. call from back-end Shutdown() if you need to close platform windows before imgui shutdown. otherwise will be called by DestroyContext().
|
||||
IMGUI_API ImGuiViewport* FindViewportByID(ImGuiID id); // helper for back-ends to find a viewport.
|
||||
IMGUI_API ImGuiViewport* FindViewportByPlatformHandle(void* platform_handle); // helper for back-ends to find a viewport. the type platform_handle is decided by the back-end (e.g. HWND, MyWindow*, GLFWwindow* etc.)
|
||||
IMGUI_API void UpdatePlatformWindows(); // call in main loop. will call CreateWindow/ResizeWindow/etc. platform functions for each secondary viewport, and DestroyWindow for each inactive viewport.
|
||||
IMGUI_API void RenderPlatformWindowsDefault(void* platform_render_arg = NULL, void* renderer_render_arg = NULL); // call in main loop. will call RenderWindow/SwapBuffers platform functions for each secondary viewport which doesn't have the ImGuiViewportFlags_Minimized flag set. May be reimplemented by user for custom rendering needs.
|
||||
IMGUI_API void DestroyPlatformWindows(); // call DestroyWindow platform functions for all viewports. call from back-end Shutdown() if you need to close platform windows before imgui shutdown. otherwise will be called by DestroyContext().
|
||||
IMGUI_API ImGuiViewport* FindViewportByID(ImGuiID id); // this is a helper for back-ends.
|
||||
IMGUI_API ImGuiViewport* FindViewportByPlatformHandle(void* platform_handle); // this is a helper for back-ends. the type platform_handle is decided by the back-end (e.g. HWND, MyWindow*, GLFWwindow* etc.)
|
||||
|
||||
} // namespace ImGui
|
||||
|
||||
@ -2412,7 +2412,7 @@ struct ImFont
|
||||
// Steps to use multi-viewports in your application, when using a default back-end from the examples/ folder:
|
||||
// - Application: Enable feature with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||
// - Back-end: The back-end initialization will setup all necessary ImGuiPlatformIO's functions and update monitors info every frame.
|
||||
// - Application: In your main loop, call ImGui::PlatformWindowsUpdate(), ImGui::PlatformWindowsRender() after EndFrame() or Render().
|
||||
// - Application: In your main loop, call ImGui::UpdatePlatformWindows(), ImGui::RenderPlatformWindowsDefault() after EndFrame() or Render().
|
||||
// - Application: Fix absolute coordinates used in ImGui::SetWindowPos() or ImGui::SetNextWindowPos() calls.
|
||||
//
|
||||
// Steps to use multi-viewports in your application, when using a custom back-end:
|
||||
@ -2424,18 +2424,18 @@ struct ImFont
|
||||
// Set 'io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports' and 'io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports'.
|
||||
// Update ImGuiPlatformIO's Monitors list every frame.
|
||||
// Update MousePos every frame, in absolute coordinates.
|
||||
// - Application: In your main loop, call ImGui::PlatformWindowsUpdate(), ImGui::PlatformWindowsRender() after EndFrame() or Render().
|
||||
// You may skip calling PlatformWindowsRender() if its API is not convenient for your needs. Read comments below.
|
||||
// - Application: In your main loop, call ImGui::UpdatePlatformWindows(), ImGui::RenderPlatformWindowsDefault() after EndFrame() or Render().
|
||||
// You may skip calling RenderPlatformWindowsDefault() if its API is not convenient for your needs. Read comments below.
|
||||
// - Application: Fix absolute coordinates used in ImGui::SetWindowPos() or ImGui::SetNextWindowPos() calls.
|
||||
//
|
||||
// About ImGui::PlatformWindowsRender():
|
||||
// About ImGui::RenderPlatformWindowsDefault():
|
||||
// - This function is a mostly a _helper_ for the common-most cases, and to facilitate using default back-ends.
|
||||
// - You can check its simple source code to understand what it does.
|
||||
// It basically iterates secondary viewports and call 4 functions that are setup in ImGuiPlatformIO, if available:
|
||||
// Platform_RenderWindow(), Renderer_RenderWindow(), Platform_SwapBuffers(), Renderer_SwapBuffers()
|
||||
// Those functions pointers exists only for the benefit of PlatformWindowsRender().
|
||||
// Those functions pointers exists only for the benefit of RenderPlatformWindowsDefault().
|
||||
// - If you have very specific rendering needs (e.g. flipping multiple swap-chain simultaneously, unusual sync/threading issues, etc.),
|
||||
// you may be tempted to ignore PlatformWindowsRender() and write customized code to perform your renderingg.
|
||||
// you may be tempted to ignore RenderPlatformWindowsDefault() and write customized code to perform your renderingg.
|
||||
// You may decide to setup the platform_io's *RenderWindow and *SwapBuffers pointers and call your functions through those pointers,
|
||||
// or you may decide to never setup those pointers and call your code directly. They are a convenience, not an obligatory interface.
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -2451,10 +2451,10 @@ struct ImGuiPlatformIO
|
||||
// For reference, the second column shows which function are generally calling the Platform Functions:
|
||||
// N = ImGui::NewFrame() ~ beginning of the dear imgui frame: read info from platform/OS windows (latest size/position)
|
||||
// F = ImGui::Begin(), ImGui::EndFrame() ~ during the dear imgui frame
|
||||
// U = ImGui::PlatformWindowsUpdate() ~ after the dear imgui frame: create and update all platform/OS windows
|
||||
// R = ImGui::PlatformWindowsRender() ~ render (read comment above about this function!)
|
||||
// D = ImGui::PlatformWindowsDestroy() ~ shutdown
|
||||
// The general idea is that NewFrame() we will read the current Platform/OS state, and PlatformWindowsUpdate() will write to it.
|
||||
// U = ImGui::UpdatePlatformWindows() ~ after the dear imgui frame: create and update all platform/OS windows
|
||||
// R = ImGui::RenderPlatformWindowsDefault() ~ render
|
||||
// D = ImGui::DestroyPlatformWindows() ~ shutdown
|
||||
// The general idea is that NewFrame() we will read the current Platform/OS state, and UpdatePlatformWindows() will write to it.
|
||||
//
|
||||
// The functions are designed so we can mix and match 2 imgui_impl_xxxx files, one for the Platform (~window/input handling), one for Renderer.
|
||||
// Custom engine back-ends will often provide both Platform and Renderer interfaces and so may not need to use all functions.
|
||||
@ -2473,9 +2473,9 @@ struct ImGuiPlatformIO
|
||||
bool (*Platform_GetWindowMinimized)(ImGuiViewport* vp); // N . . . . // Get platform window minimized state. When minimized, we generally won't attempt to get/set size and contents will be culled more easily
|
||||
void (*Platform_SetWindowTitle)(ImGuiViewport* vp, const char* str); // . . U . . // Set platform window title (given an UTF-8 string)
|
||||
void (*Platform_SetWindowAlpha)(ImGuiViewport* vp, float alpha); // . . U . . // (Optional) Setup window transparency
|
||||
void (*Platform_UpdateWindow)(ImGuiViewport* vp); // . . U . . // (Optional) Called by PlatformWindowsUpdate(). Optional hook to allow the platform back-end from doing general book-keeping every frame.
|
||||
void (*Platform_RenderWindow)(ImGuiViewport* vp, void* render_arg); // . . . R . // (Optional) Main rendering (platform side! This is often unused, or just setting a "current" context for OpenGL bindings). 'render_arg' is the value passed to PlatformWindowsRender().
|
||||
void (*Platform_SwapBuffers)(ImGuiViewport* vp, void* render_arg); // . . . R . // (Optional) Call Present/SwapBuffers (platform side! This is often unused!). 'render_arg' is the value passed to PlatformWindowsRender().
|
||||
void (*Platform_UpdateWindow)(ImGuiViewport* vp); // . . U . . // (Optional) Called by UpdatePlatformWindows(). Optional hook to allow the platform back-end from doing general book-keeping every frame.
|
||||
void (*Platform_RenderWindow)(ImGuiViewport* vp, void* render_arg); // . . . R . // (Optional) Main rendering (platform side! This is often unused, or just setting a "current" context for OpenGL bindings). 'render_arg' is the value passed to RenderPlatformWindowsDefault().
|
||||
void (*Platform_SwapBuffers)(ImGuiViewport* vp, void* render_arg); // . . . R . // (Optional) Call Present/SwapBuffers (platform side! This is often unused!). 'render_arg' is the value passed to RenderPlatformWindowsDefault().
|
||||
float (*Platform_GetWindowDpiScale)(ImGuiViewport* vp); // N . . . . // (Optional) [BETA] FIXME-DPI: DPI handling: Return DPI scale for this viewport. 1.0f = 96 DPI.
|
||||
void (*Platform_OnChangedViewport)(ImGuiViewport* vp); // . F . . . // (Optional) [BETA] FIXME-DPI: DPI handling: Called during Begin() every time the viewport we are outputting into changes, so back-end has a chance to swap fonts to adjust style.
|
||||
void (*Platform_SetImeInputPos)(ImGuiViewport* vp, ImVec2 pos); // . F . . . // (Optional) Set IME (Input Method Editor, e.g. for Asian languages) input position, so text preview appears over the imgui input box. FIXME: The call timing of this is inconsistent because we want to support without multi-viewports.
|
||||
@ -2485,8 +2485,8 @@ struct ImGuiPlatformIO
|
||||
void (*Renderer_CreateWindow)(ImGuiViewport* vp); // . . U . . // Create swap chain, frame buffers etc. (called after Platform_CreateWindow)
|
||||
void (*Renderer_DestroyWindow)(ImGuiViewport* vp); // N . U . D // Destroy swap chain, frame buffers etc. (called before Platform_DestroyWindow)
|
||||
void (*Renderer_SetWindowSize)(ImGuiViewport* vp, ImVec2 size); // . . U . . // Resize swap chain, frame buffers etc. (called after Platform_SetWindowSize)
|
||||
void (*Renderer_RenderWindow)(ImGuiViewport* vp, void* render_arg); // . . . R . // (Optional) Clear framebuffer, setup render target, then render the viewport->DrawData. 'render_arg' is the value passed to PlatformWindowsRender().
|
||||
void (*Renderer_SwapBuffers)(ImGuiViewport* vp, void* render_arg); // . . . R . // (Optional) Call Present/SwapBuffers. 'render_arg' is the value passed to PlatformWindowsRender().
|
||||
void (*Renderer_RenderWindow)(ImGuiViewport* vp, void* render_arg); // . . . R . // (Optional) Clear framebuffer, setup render target, then render the viewport->DrawData. 'render_arg' is the value passed to RenderPlatformWindowsDefault().
|
||||
void (*Renderer_SwapBuffers)(ImGuiViewport* vp, void* render_arg); // . . . R . // (Optional) Call Present/SwapBuffers. 'render_arg' is the value passed to RenderPlatformWindowsDefault().
|
||||
|
||||
// (Optional) Monitor list
|
||||
// - Updated by: app/back-end. Update every frame to dynamically support changing monitor or DPI configuration.
|
||||
|
@ -1869,7 +1869,7 @@ namespace ImGui
|
||||
// Viewports
|
||||
IMGUI_API void TranslateWindowsInViewport(ImGuiViewportP* viewport, const ImVec2& old_pos, const ImVec2& new_pos);
|
||||
IMGUI_API void ScaleWindowsInViewport(ImGuiViewportP* viewport, float scale);
|
||||
IMGUI_API void PlatformWindowsDestroyOne(ImGuiViewportP* viewport);
|
||||
IMGUI_API void DestroyPlatformWindow(ImGuiViewportP* viewport);
|
||||
IMGUI_API void ShowViewportThumbnails();
|
||||
|
||||
// Settings
|
||||
|
Loading…
Reference in New Issue
Block a user