Viewport: Made platform_io.Monitors mandatory for proper multi-viewport use.

This commit is contained in:
omar 2019-01-15 21:20:00 +01:00
parent 73353fad64
commit 79d497edae
2 changed files with 4 additions and 3 deletions

View File

@ -3427,6 +3427,7 @@ void ImGui::NewFrame()
IM_ASSERT(g.PlatformIO.Platform_SetWindowPos != NULL && "Platform init didn't install handlers?"); IM_ASSERT(g.PlatformIO.Platform_SetWindowPos != NULL && "Platform init didn't install handlers?");
IM_ASSERT(g.PlatformIO.Platform_GetWindowSize != NULL && "Platform init didn't install handlers?"); IM_ASSERT(g.PlatformIO.Platform_GetWindowSize != NULL && "Platform init didn't install handlers?");
IM_ASSERT(g.PlatformIO.Platform_SetWindowSize != NULL && "Platform init didn't install handlers?"); IM_ASSERT(g.PlatformIO.Platform_SetWindowSize != NULL && "Platform init didn't install handlers?");
IM_ASSERT(g.PlatformIO.Monitors.Size > 0 && "Platform init didn't setup Monitors list?");
IM_ASSERT((g.Viewports[0]->PlatformUserData != NULL || g.Viewports[0]->PlatformHandle != NULL) && "Platform init didn't setup main viewport."); IM_ASSERT((g.Viewports[0]->PlatformUserData != NULL || g.Viewports[0]->PlatformHandle != NULL) && "Platform init didn't setup main viewport.");
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
IM_ASSERT(g.IO.RenderDrawListsFn == NULL); // Call ImGui::Render() then pass ImGui::GetDrawData() yourself to your render function! IM_ASSERT(g.IO.RenderDrawListsFn == NULL); // Call ImGui::Render() then pass ImGui::GetDrawData() yourself to your render function!
@ -10445,7 +10446,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
ImGui::Unindent(ImGui::GetTreeNodeToLabelSpacing()); ImGui::Unindent(ImGui::GetTreeNodeToLabelSpacing());
if (g.PlatformIO.Monitors.Size > 0 && ImGui::TreeNode("Monitors", "Monitors (%d)", g.PlatformIO.Monitors.Size)) if (g.PlatformIO.Monitors.Size > 0 && ImGui::TreeNode("Monitors", "Monitors (%d)", g.PlatformIO.Monitors.Size))
{ {
ImGui::TextWrapped("(When viewports are enabled, imgui optionally uses monitor data to position popup/tooltips so they don't straddle monitors.)"); ImGui::TextWrapped("(When viewports are enabled, imgui needs uses monitor data to position popup/tooltips so they don't straddle monitors.)");
for (int i = 0; i < g.PlatformIO.Monitors.Size; i++) for (int i = 0; i < g.PlatformIO.Monitors.Size; i++)
{ {
const ImGuiPlatformMonitor& mon = g.PlatformIO.Monitors[i]; const ImGuiPlatformMonitor& mon = g.PlatformIO.Monitors[i];

View File

@ -2174,8 +2174,8 @@ struct ImFont
// - if you are new to dear imgui and trying to integrate it into your engine, you should probably ignore this for now. // - if you are new to dear imgui and trying to integrate it into your engine, you should probably ignore this for now.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// (Optional) Represent the bounds of each connected monitor/display and their DPI // (Optional) This is required when enabling multi-viewport. Represent the bounds of each connected monitor/display and their DPI.
// This is used for: multiple DPI support + clamping the position of popups and tooltips so they don't straddle multiple monitors. // We use this information for multiple DPI support + clamping the position of popups and tooltips so they don't straddle multiple monitors.
struct ImGuiPlatformMonitor struct ImGuiPlatformMonitor
{ {
ImVec2 MainPos, MainSize; // Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right) ImVec2 MainPos, MainSize; // Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right)