// Draw List API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData)
// Draw List API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData)
// Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFontAtlasFlags, ImFontAtlas, ImFont)
// Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFontAtlasFlags, ImFontAtlas, ImFont)
// Platform interface for multi-viewport support (ImGuiPlatformMonitor, ImGuiPlatformIO, ImGuiViewport)
// Platform interface for multi-viewport support (ImGuiPlatformIO, ImGuiPlatformMonitor, ImGuiViewportFlags, ImGuiViewport)
*/
*/
@ -775,11 +775,12 @@ namespace ImGui
IMGUI_APIvoidMemFree(void*ptr);
IMGUI_APIvoidMemFree(void*ptr);
// (Optional) Platform/OS interface for multi-viewport support
// (Optional) Platform/OS interface for multi-viewport support
// Read comments around the ImGuiPlatformIO structure for more details.
// Note: You may use GetWindowViewport() to get the current viewport of the current window.
// 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_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_APIImGuiViewport*GetMainViewport();// main viewport. same as GetPlatformIO().MainViewport == GetPlatformIO().Viewports[0].
IMGUI_APIvoidUpdatePlatformWindows();// call in main loop. will call CreateWindow/ResizeWindow/etc. platform functions for each secondary viewport, and DestroyWindow for each inactive viewport.
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_arg =NULL,void*renderer_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_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_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*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.)
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.)
// (Optional) This is required when enabling multi-viewport. Represent the bounds of each connected monitor/display and their DPI.
// (Optional) Access via ImGui::GetPlatformIO()
// We use this information for multiple DPI support + clamping the position of popups and tooltips so they don't straddle multiple monitors.
structImGuiPlatformMonitor
{
ImVec2MainPos,MainSize;// Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right)
ImVec2WorkPos,WorkSize;// (Optional) Coordinates without task bars / side bars / menu bars. imgui uses this to avoid positioning popups/tooltips inside this region.
// Platform function --------------------------------------------------- Called by -----
void(*Platform_UpdateWindow)(ImGuiViewport*vp);// (Optional) Called in UpdatePlatforms(). Optional hook to allow the platform back-end from doing general book-keeping every frame.
void(*Platform_CreateWindow)(ImGuiViewport*vp);// . . U . . // Create a new platform window for the given viewport
void(*Platform_RenderWindow)(ImGuiViewport*vp,void*render_arg);// (Optional) Setup for render
void(*Platform_DestroyWindow)(ImGuiViewport*vp);// N . U . D //
void(*Platform_ShowWindow)(ImGuiViewport*vp);// . . U . . // Newly created windows are initially hidden so SetWindowPos/Size/Title can be called on them before showing the window
float(*Platform_GetWindowDpiScale)(ImGuiViewport*vp);// (Optional) [BETA] (FIXME-DPI) DPI handling: Return DPI scale for this viewport. 1.0f = 96 DPI.
void(*Platform_SetWindowPos)(ImGuiViewport*vp,ImVec2pos);// . . U . . // Set platform window position (given the upper-left corner of client area)
void(*Platform_OnChangedViewport)(ImGuiViewport*vp);// (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.
ImVec2(*Platform_GetWindowPos)(ImGuiViewport*vp);// N . . . . //
void(*Platform_SetImeInputPos)(ImGuiViewport*vp,ImVec2pos);// (Optional) Set IME (Input Method Editor, e.g. for Asian languages) input position, so text preview appears over the imgui input box.
void(*Platform_SetWindowSize)(ImGuiViewport*vp,ImVec2size);// . . U . . // Set platform window client area size (ignoring OS decorations such as OS title bar etc.)
int(*Platform_CreateVkSurface)(ImGuiViewport*vp,ImU64vk_inst,constvoid*vk_allocators,ImU64*out_vk_surface);// (Optional) For Renderer to call into Platform code
ImVec2(*Platform_GetWindowSize)(ImGuiViewport*vp);// N . . . . // Get platform window client area size
void(*Platform_SetWindowFocus)(ImGuiViewport*vp);// N . . . . // Move window to front and set input focus
bool(*Platform_GetWindowFocus)(ImGuiViewport*vp);// . . U . . //
void(*Renderer_CreateWindow)(ImGuiViewport*vp);// Create swap chains, frame buffers etc.
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(*Renderer_DestroyWindow)(ImGuiViewport*vp);
void(*Platform_SetWindowTitle)(ImGuiViewport*vp,constchar*str);// . . U . . // Set platform window title (given an UTF-8 string)
void(*Renderer_SetWindowSize)(ImGuiViewport*vp,ImVec2size);// Resize swap chain, frame buffers etc.
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().
// (Optional) List of monitors (updated by: app/back-end, used by: imgui to clamp popups/tooltips within same monitor and not have them straddle monitors)
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.
int(*Platform_CreateVkSurface)(ImGuiViewport*vp,ImU64vk_inst,constvoid*vk_allocators,ImU64*out_vk_surface);// (Optional) For a Vulkan Renderer to call into Platform code (since the surface creation needs to tie them both).
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 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.
// - Used by: dear imgui to query DPI info, clamp popups/tooltips within same monitor and not have them straddle monitors.
// List of viewports (the list is updated by calling ImGui::EndFrame or ImGui::Render)
// Viewports list (the list is updated by calling ImGui::EndFrame or ImGui::Render)
// (in the future we will attempt to organize this feature to remove the need for a "main viewport")
ImGuiViewport*MainViewport;// Guaranteed to be == Viewports[0]
ImGuiViewport*MainViewport;// Guaranteed to be == Viewports[0]
ImVector<ImGuiViewport*>Viewports;// Main viewports, followed by all secondary viewports.
ImVector<ImGuiViewport*>Viewports;// Main viewports, followed by all secondary viewports.
ImGuiPlatformIO(){memset(this,0,sizeof(*this));}// Zero clear
ImGuiPlatformIO(){memset(this,0,sizeof(*this));}// Zero clear
};
};
// (Optional) This is required when enabling multi-viewport. Represent the bounds of each connected monitor/display and their DPI.
// We use this information for multiple DPI support + clamping the position of popups and tooltips so they don't straddle multiple monitors.
structImGuiPlatformMonitor
{
ImVec2MainPos,MainSize;// Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right)
ImVec2WorkPos,WorkSize;// (Optional) Coordinates without task bars / side bars / menu bars. imgui uses this to avoid positioning popups/tooltips inside this region.
// Flags stored in ImGuiViewport::Flags, giving indications to the platform back-ends.
// Flags stored in ImGuiViewport::Flags, giving indications to the platform back-ends.
enumImGuiViewportFlags_
enumImGuiViewportFlags_
{
{
@ -2498,9 +2546,11 @@ struct ImGuiViewport
ImGuiIDParentViewportId;// (Advanced) 0: no parent. Instruct the platform back-end to setup a parent/child relationship between platform windows.
ImGuiIDParentViewportId;// (Advanced) 0: no parent. Instruct the platform back-end to setup a parent/child relationship between platform windows.
// Our design separate the Renderer and Platform back-ends to facilitate combining default back-ends with each others.
// Our design separate the Renderer and Platform back-ends to facilitate combining default back-ends with each others.
// When our create your own back-end for a custom engine, it is possible that both Renderer and Platform will be handled by the same system and you may not need to use all the UserData/Handle fields.
// When our create your own back-end for a custom engine, it is possible that both Renderer and Platform will be handled
void*RendererUserData;// void* to hold custom data structure for the renderer (e.g. swap chain, framebuffers etc.).
// by the same system and you may not need to use all the UserData/Handle fields.
void*PlatformUserData;// void* to hold custom data structure for the OS / platform (e.g. windowing info, render context).
// The library never uses those fields, they are merely storage to facilitate back-end implementation.
void*RendererUserData;// void* to hold custom data structure for the renderer (e.g. swap chain, framebuffers etc.). generally set by your Renderer_CreateWindow function.
void*PlatformUserData;// void* to hold custom data structure for the OS / platform (e.g. windowing info, render context). generally set by your Platform_CreateWindow function.
void*PlatformHandle;// void* for FindViewportByPlatformHandle(). (e.g. suggested to use natural platform handle such as HWND, GLFWWindow*, SDL_Window*)
void*PlatformHandle;// void* for FindViewportByPlatformHandle(). (e.g. suggested to use natural platform handle such as HWND, GLFWWindow*, SDL_Window*)
void*PlatformHandleRaw;// void* to hold lower-level, platform-native window handle (e.g. the HWND) when using an abstraction layer like GLFW or SDL (where PlatformHandle would be a SDL_Window*)
void*PlatformHandleRaw;// void* to hold lower-level, platform-native window handle (e.g. the HWND) when using an abstraction layer like GLFW or SDL (where PlatformHandle would be a SDL_Window*)
boolPlatformRequestMove;// Platform window requested move (e.g. window was moved by the OS / host window manager, authoritative position will be OS window position)
boolPlatformRequestMove;// Platform window requested move (e.g. window was moved by the OS / host window manager, authoritative position will be OS window position)