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.");
// 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)
// Note: You may use GetWindowViewport() to get the current viewport of the current window.
IMGUI_APIImGuiPlatformIO&GetPlatformIO();// platform/renderer functions, for back-end to setup + viewports list.
IMGUI_APIImGuiViewport*GetMainViewport();// main viewport. same as GetPlatformIO().MainViewport == GetPlatformIO().Viewports[0].
IMGUI_APIvoidPlatformWindowsUpdate();// call in main loop. will call CreateWindow/ResizeWindow/etc. platform functions for each secondary viewport, and DestroyWindow for each inactive viewport.
IMGUI_APIvoidPlatformWindowsRender(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_APIvoidPlatformWindowsDestroy();// 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_APIImGuiViewport*FindViewportByID(ImGuiIDid);// helper for back-ends to find a viewport.
IMGUI_APIImGuiViewport*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_APIvoidUpdatePlatformWindows();// call in main loop. will call CreateWindow/ResizeWindow/etc. platform functions for each secondary viewport, and DestroyWindow for each inactive viewport.
IMGUI_APIvoidRenderPlatformWindowsDefault(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_APIvoidDestroyPlatformWindows();// 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_APIImGuiViewport*FindViewportByID(ImGuiIDid);// this is a helper for back-ends.
IMGUI_APIImGuiViewport*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:
// 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,constchar*str);// . . U . . // Set platform window title (given an UTF-8 string)
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,ImVec2pos);// . 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,ImVec2size);// . . 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.