2
0
Эх сурвалжийг харах

Begin(): fixed calling Begin() more than once per frame setting `window_just_activated_by_user` which in turn would set Appearing to true for that frame.

omar 8 жил өмнө
parent
commit
2600b28f5d
1 өөрчлөгдсөн 2 нэмэгдсэн , 3 устгасан
  1. 2 3
      imgui.cpp

+ 2 - 3
imgui.cpp

@@ -3951,7 +3951,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
         window_is_new = true;
     }
 
-    const int current_frame = ImGui::GetFrameCount();
+    const int current_frame = g.FrameCount;
     const bool first_begin_of_the_frame = (window->LastFrameActive != current_frame);
     if (first_begin_of_the_frame)
         window->Flags = (ImGuiWindowFlags)flags;
@@ -3965,8 +3965,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
     CheckStacksSize(window, true);
     IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow));
 
-    // FIXME: This is currently true if we call Begin() multiple times in a row on a same window.
-    bool window_just_activated_by_user = (window->LastFrameActive != current_frame - 1);   // Not using !WasActive because the implicit "Debug" window would always toggle off->on
+    bool window_just_activated_by_user = (window->LastFrameActive < current_frame - 1);   // Not using !WasActive because the implicit "Debug" window would always toggle off->on
     if (flags & ImGuiWindowFlags_Popup)
     {
         ImGuiPopupRef& popup_ref = g.OpenPopupStack[g.CurrentPopupStack.Size];