Browse Source

Fixed assert introduced in 3b01b0a2f263445109dd9fe320e7641dfe6b19fc

ocornut 10 năm trước cách đây
mục cha
commit
08bfe9bc7c
1 tập tin đã thay đổi với 9 bổ sung9 xóa
  1. 9 9
      imgui.cpp

+ 9 - 9
imgui.cpp

@@ -2269,7 +2269,13 @@ void ImGui::EndFrame()
     IM_ASSERT(g.Initialized);                       // Forgot to call ImGui::NewFrame()
     IM_ASSERT(g.Initialized);                       // Forgot to call ImGui::NewFrame()
     IM_ASSERT(g.FrameCountEnded != g.FrameCount);   // ImGui::EndFrame() called multiple times, or forgot to call ImGui::NewFrame() again
     IM_ASSERT(g.FrameCountEnded != g.FrameCount);   // ImGui::EndFrame() called multiple times, or forgot to call ImGui::NewFrame() again
 
 
-    g.FrameCountEnded = g.FrameCount;
+    // Render tooltip
+    if (g.Tooltip[0])
+    {
+        ImGui::BeginTooltip();
+        ImGui::TextUnformatted(g.Tooltip);
+        ImGui::EndTooltip();
+    }
 
 
     // Hide implicit "Debug" window if it hasn't been used
     // Hide implicit "Debug" window if it hasn't been used
     IM_ASSERT(g.CurrentWindowStack.Size == 1);    // Mismatched Begin/End
     IM_ASSERT(g.CurrentWindowStack.Size == 1);    // Mismatched Begin/End
@@ -2319,6 +2325,8 @@ void ImGui::EndFrame()
     // Clear Input data for next frame
     // Clear Input data for next frame
     g.IO.MouseWheel = 0.0f;
     g.IO.MouseWheel = 0.0f;
     memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters));
     memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters));
+
+    g.FrameCountEnded = g.FrameCount;
 }
 }
 
 
 void ImGui::Render()
 void ImGui::Render()
@@ -2334,14 +2342,6 @@ void ImGui::Render()
     // Note that vertex buffers have been created and are wasted, so it is best practice that you don't create windows in the first place, or consistently respond to Begin() returning false.
     // Note that vertex buffers have been created and are wasted, so it is best practice that you don't create windows in the first place, or consistently respond to Begin() returning false.
     if (g.Style.Alpha > 0.0f)
     if (g.Style.Alpha > 0.0f)
     {
     {
-        // Render tooltip
-        if (g.Tooltip[0])
-        {
-            ImGui::BeginTooltip();
-            ImGui::TextUnformatted(g.Tooltip);
-            ImGui::EndTooltip();
-        }
-
         // Gather windows to render
         // Gather windows to render
         g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = g.IO.MetricsActiveWindows = 0;
         g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = g.IO.MetricsActiveWindows = 0;
         for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
         for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)