mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 03:58:47 +02:00
Internals: swapped blocks in TextEx() to make it easier to step through common cases. Tweak demo.
This commit is contained in:
13
imgui.cpp
13
imgui.cpp
@ -8301,20 +8301,22 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu
|
||||
// spacing_w >= 0 : enforce spacing amount
|
||||
void ImGui::SameLine(float offset_from_start_x, float spacing_w)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (offset_from_start_x != 0.0f)
|
||||
{
|
||||
if (spacing_w < 0.0f) spacing_w = 0.0f;
|
||||
if (spacing_w < 0.0f)
|
||||
spacing_w = 0.0f;
|
||||
window->DC.CursorPos.x = window->Pos.x - window->Scroll.x + offset_from_start_x + spacing_w + window->DC.GroupOffset.x + window->DC.ColumnsOffset.x;
|
||||
window->DC.CursorPos.y = window->DC.CursorPosPrevLine.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (spacing_w < 0.0f) spacing_w = g.Style.ItemSpacing.x;
|
||||
if (spacing_w < 0.0f)
|
||||
spacing_w = g.Style.ItemSpacing.x;
|
||||
window->DC.CursorPos.x = window->DC.CursorPosPrevLine.x + spacing_w;
|
||||
window->DC.CursorPos.y = window->DC.CursorPosPrevLine.y;
|
||||
}
|
||||
@ -8464,7 +8466,8 @@ float ImGui::CalcItemWidth()
|
||||
// The 4.0f here may be changed to match CalcItemWidth() and/or BeginChild() (right now we have a mismatch which is harmless but undesirable)
|
||||
ImVec2 ImGui::CalcItemSize(ImVec2 size, float default_w, float default_h)
|
||||
{
|
||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
|
||||
ImVec2 region_max;
|
||||
if (size.x < 0.0f || size.y < 0.0f)
|
||||
|
Reference in New Issue
Block a user