mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 03:58:47 +02:00
Added extra comments and assertions to avoid user combining ImGuiCond flags. (#1694)
This commit is contained in:
@ -6846,6 +6846,8 @@ static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond)
|
||||
// Test condition (NB: bit 0 is always true) and clear flags for next time
|
||||
if (cond && (window->SetWindowPosAllowFlags & cond) == 0)
|
||||
return;
|
||||
|
||||
IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
|
||||
window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);
|
||||
window->SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX);
|
||||
|
||||
@ -6880,6 +6882,8 @@ static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond con
|
||||
// Test condition (NB: bit 0 is always true) and clear flags for next time
|
||||
if (cond && (window->SetWindowSizeAllowFlags & cond) == 0)
|
||||
return;
|
||||
|
||||
IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
|
||||
window->SetWindowSizeAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);
|
||||
|
||||
// Set
|
||||
@ -6971,6 +6975,7 @@ void ImGui::SetWindowFocus(const char* name)
|
||||
void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiCond cond, const ImVec2& pivot)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
|
||||
g.NextWindowData.PosVal = pos;
|
||||
g.NextWindowData.PosPivotVal = pivot;
|
||||
g.NextWindowData.PosCond = cond ? cond : ImGuiCond_Always;
|
||||
@ -6979,6 +6984,7 @@ void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiCond cond, const ImVec2& pi
|
||||
void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiCond cond)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
|
||||
g.NextWindowData.SizeVal = size;
|
||||
g.NextWindowData.SizeCond = cond ? cond : ImGuiCond_Always;
|
||||
}
|
||||
@ -7002,6 +7008,7 @@ void ImGui::SetNextWindowContentSize(const ImVec2& size)
|
||||
void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiCond cond)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
|
||||
g.NextWindowData.CollapsedVal = collapsed;
|
||||
g.NextWindowData.CollapsedCond = cond ? cond : ImGuiCond_Always;
|
||||
}
|
||||
|
Reference in New Issue
Block a user