mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-28 09:30:56 +01:00
Renamed Window LastFrameDrawn to LastFrameActive, more correct
This commit is contained in:
parent
465e6839a4
commit
7a61b7dd57
24
imgui.cpp
24
imgui.cpp
@ -1527,7 +1527,7 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
|||||||
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiSetCond_Always | ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver | ImGuiSetCond_Appearing;
|
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiSetCond_Always | ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver | ImGuiSetCond_Appearing;
|
||||||
SetWindowPosCenterWanted = false;
|
SetWindowPosCenterWanted = false;
|
||||||
|
|
||||||
LastFrameDrawn = -1;
|
LastFrameActive = -1;
|
||||||
ItemWidthDefault = 0.0f;
|
ItemWidthDefault = 0.0f;
|
||||||
FontWindowScale = 1.0f;
|
FontWindowScale = 1.0f;
|
||||||
|
|
||||||
@ -3498,7 +3498,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
}
|
}
|
||||||
|
|
||||||
const int current_frame = ImGui::GetFrameCount();
|
const int current_frame = ImGui::GetFrameCount();
|
||||||
const bool first_begin_of_the_frame = (window->LastFrameDrawn != current_frame);
|
const bool first_begin_of_the_frame = (window->LastFrameActive != current_frame);
|
||||||
if (first_begin_of_the_frame)
|
if (first_begin_of_the_frame)
|
||||||
window->Flags = (ImGuiWindowFlags)flags;
|
window->Flags = (ImGuiWindowFlags)flags;
|
||||||
else
|
else
|
||||||
@ -3511,12 +3511,12 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
CheckStacksSize(window, true);
|
CheckStacksSize(window, true);
|
||||||
IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow));
|
IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow));
|
||||||
|
|
||||||
bool window_was_visible = (window->LastFrameDrawn == current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on
|
bool window_was_active = (window->LastFrameActive == current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on
|
||||||
if (flags & ImGuiWindowFlags_Popup)
|
if (flags & ImGuiWindowFlags_Popup)
|
||||||
{
|
{
|
||||||
ImGuiPopupRef& popup_ref = g.OpenedPopupStack[g.CurrentPopupStack.Size];
|
ImGuiPopupRef& popup_ref = g.OpenedPopupStack[g.CurrentPopupStack.Size];
|
||||||
window_was_visible &= (window->PopupID == popup_ref.PopupID);
|
window_was_active &= (window->PopupID == popup_ref.PopupID);
|
||||||
window_was_visible &= (window == popup_ref.Window);
|
window_was_active &= (window == popup_ref.Window);
|
||||||
popup_ref.Window = window;
|
popup_ref.Window = window;
|
||||||
g.CurrentPopupStack.push_back(popup_ref);
|
g.CurrentPopupStack.push_back(popup_ref);
|
||||||
window->PopupID = popup_ref.PopupID;
|
window->PopupID = popup_ref.PopupID;
|
||||||
@ -3527,7 +3527,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
if (g.SetNextWindowPosCond)
|
if (g.SetNextWindowPosCond)
|
||||||
{
|
{
|
||||||
const ImVec2 backup_cursor_pos = window->DC.CursorPos; // FIXME: not sure of the exact reason of this anymore :( need to look into that.
|
const ImVec2 backup_cursor_pos = window->DC.CursorPos; // FIXME: not sure of the exact reason of this anymore :( need to look into that.
|
||||||
if (!window_was_visible) window->SetWindowPosAllowFlags |= ImGuiSetCond_Appearing;
|
if (!window_was_active) window->SetWindowPosAllowFlags |= ImGuiSetCond_Appearing;
|
||||||
window_pos_set_by_api = (window->SetWindowPosAllowFlags & g.SetNextWindowPosCond) != 0;
|
window_pos_set_by_api = (window->SetWindowPosAllowFlags & g.SetNextWindowPosCond) != 0;
|
||||||
if (window_pos_set_by_api && ImLengthSqr(g.SetNextWindowPosVal - ImVec2(-FLT_MAX,-FLT_MAX)) < 0.001f)
|
if (window_pos_set_by_api && ImLengthSqr(g.SetNextWindowPosVal - ImVec2(-FLT_MAX,-FLT_MAX)) < 0.001f)
|
||||||
{
|
{
|
||||||
@ -3543,7 +3543,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
}
|
}
|
||||||
if (g.SetNextWindowSizeCond)
|
if (g.SetNextWindowSizeCond)
|
||||||
{
|
{
|
||||||
if (!window_was_visible) window->SetWindowSizeAllowFlags |= ImGuiSetCond_Appearing;
|
if (!window_was_active) window->SetWindowSizeAllowFlags |= ImGuiSetCond_Appearing;
|
||||||
window_size_set_by_api = (window->SetWindowSizeAllowFlags & g.SetNextWindowSizeCond) != 0;
|
window_size_set_by_api = (window->SetWindowSizeAllowFlags & g.SetNextWindowSizeCond) != 0;
|
||||||
ImGui::SetWindowSize(g.SetNextWindowSizeVal, g.SetNextWindowSizeCond);
|
ImGui::SetWindowSize(g.SetNextWindowSizeVal, g.SetNextWindowSizeCond);
|
||||||
g.SetNextWindowSizeCond = 0;
|
g.SetNextWindowSizeCond = 0;
|
||||||
@ -3559,7 +3559,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
}
|
}
|
||||||
if (g.SetNextWindowCollapsedCond)
|
if (g.SetNextWindowCollapsedCond)
|
||||||
{
|
{
|
||||||
if (!window_was_visible) window->SetWindowCollapsedAllowFlags |= ImGuiSetCond_Appearing;
|
if (!window_was_active) window->SetWindowCollapsedAllowFlags |= ImGuiSetCond_Appearing;
|
||||||
ImGui::SetWindowCollapsed(g.SetNextWindowCollapsedVal, g.SetNextWindowCollapsedCond);
|
ImGui::SetWindowCollapsed(g.SetNextWindowCollapsedVal, g.SetNextWindowCollapsedCond);
|
||||||
g.SetNextWindowCollapsedCond = 0;
|
g.SetNextWindowCollapsedCond = 0;
|
||||||
}
|
}
|
||||||
@ -3591,7 +3591,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
window->BeginCount = 0;
|
window->BeginCount = 0;
|
||||||
window->DrawList->Clear();
|
window->DrawList->Clear();
|
||||||
window->ClipRect = ImVec4(-FLT_MAX,-FLT_MAX,+FLT_MAX,+FLT_MAX);
|
window->ClipRect = ImVec4(-FLT_MAX,-FLT_MAX,+FLT_MAX,+FLT_MAX);
|
||||||
window->LastFrameDrawn = current_frame;
|
window->LastFrameActive = current_frame;
|
||||||
window->IDStack.resize(1);
|
window->IDStack.resize(1);
|
||||||
|
|
||||||
// Setup texture, outer clipping rectangle
|
// Setup texture, outer clipping rectangle
|
||||||
@ -3602,7 +3602,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
PushClipRect(GetVisibleRect());
|
PushClipRect(GetVisibleRect());
|
||||||
|
|
||||||
// New windows appears in front
|
// New windows appears in front
|
||||||
if (!window_was_visible)
|
if (!window_was_active)
|
||||||
{
|
{
|
||||||
window->AutoPosLastDirection = -1;
|
window->AutoPosLastDirection = -1;
|
||||||
|
|
||||||
@ -3644,7 +3644,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
window->SizeContents.y = (window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.y - window->Pos.y) + window->Scroll.y);
|
window->SizeContents.y = (window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.y - window->Pos.y) + window->Scroll.y);
|
||||||
|
|
||||||
// Hide popup/tooltip window when first appearing while we measure size (because we recycle them)
|
// Hide popup/tooltip window when first appearing while we measure size (because we recycle them)
|
||||||
if ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0 && !window_was_visible)
|
if ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0 && !window_was_active)
|
||||||
{
|
{
|
||||||
window->HiddenFrames = 1;
|
window->HiddenFrames = 1;
|
||||||
if (flags & ImGuiWindowFlags_AlwaysAutoResize)
|
if (flags & ImGuiWindowFlags_AlwaysAutoResize)
|
||||||
@ -3964,7 +3964,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
window->DC.TreeDepth = 0;
|
window->DC.TreeDepth = 0;
|
||||||
window->DC.StateStorage = &window->StateStorage;
|
window->DC.StateStorage = &window->StateStorage;
|
||||||
window->DC.GroupStack.resize(0);
|
window->DC.GroupStack.resize(0);
|
||||||
window->MenuColumns.Update(3, style.ItemSpacing.x, !window_was_visible);
|
window->MenuColumns.Update(3, style.ItemSpacing.x, !window_was_active);
|
||||||
|
|
||||||
if (window->AutoFitFramesX > 0)
|
if (window->AutoFitFramesX > 0)
|
||||||
window->AutoFitFramesX--;
|
window->AutoFitFramesX--;
|
||||||
|
@ -599,7 +599,7 @@ struct IMGUI_API ImGuiWindow
|
|||||||
ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack
|
ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack
|
||||||
ImRect ClipRect; // = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2.
|
ImRect ClipRect; // = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2.
|
||||||
ImRect ClippedWindowRect; // = ClipRect just after setup in Begin()
|
ImRect ClippedWindowRect; // = ClipRect just after setup in Begin()
|
||||||
int LastFrameDrawn;
|
int LastFrameActive;
|
||||||
float ItemWidthDefault;
|
float ItemWidthDefault;
|
||||||
ImGuiSimpleColumns MenuColumns; // Simplified columns storage for menu items
|
ImGuiSimpleColumns MenuColumns; // Simplified columns storage for menu items
|
||||||
ImGuiStorage StateStorage;
|
ImGuiStorage StateStorage;
|
||||||
|
Loading…
Reference in New Issue
Block a user