MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / SetWindowPos

Method SetWindowPos

KBotExt/imgui/imgui.cpp:7382–7403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7380}
7381
7382void ImGui::SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond)
7383{
7384 // Test condition (NB: bit 0 is always true) and clear flags for next time
7385 if (cond && (window->SetWindowPosAllowFlags & cond) == 0)
7386 return;
7387
7388 IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
7389 window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);
7390 window->SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX);
7391
7392 // Set
7393 const ImVec2 old_pos = window->Pos;
7394 window->Pos = ImFloor(pos);
7395 ImVec2 offset = window->Pos - old_pos;
7396 if (offset.x == 0.0f && offset.y == 0.0f)
7397 return;
7398 MarkIniSettingsDirty(window);
7399 window->DC.CursorPos += offset; // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor
7400 window->DC.CursorMaxPos += offset; // And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected.
7401 window->DC.IdealMaxPos += offset;
7402 window->DC.CursorStartPos += offset;
7403}
7404
7405void ImGui::SetWindowPos(const ImVec2& pos, ImGuiCond cond)
7406{

Callers

nothing calls this directly

Calls 4

ImIsPowerOfTwoFunction · 0.85
ImVec2Function · 0.85
ImFloorFunction · 0.85
GetCurrentWindowReadFunction · 0.85

Tested by

no test coverage detected