diff --git a/imgui.cpp b/imgui.cpp index dedda758..8cb59e05 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2461,6 +2461,18 @@ void SetCursorPos(const ImVec2& pos) window->DC.CursorPos = window->Pos + pos; } +void SetCursorPosX(float x) +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DC.CursorPos.x = window->Pos.x + x; +} + +void SetCursorPosY(float y) +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DC.CursorPos.y = window->Pos.y + y; +} + ImVec2 GetCursorScreenPos() { ImGuiWindow* window = GetCurrentWindow(); diff --git a/imgui.h b/imgui.h index ee497e73..7ffc7dab 100644 --- a/imgui.h +++ b/imgui.h @@ -168,6 +168,8 @@ namespace ImGui float GetColumnWidth(int column_index = -1); ImVec2 GetCursorPos(); // cursor position relative to window position void SetCursorPos(const ImVec2& pos); // " + void SetCursorPosX(float x); // " + void SetCursorPosY(float y); // " ImVec2 GetCursorScreenPos(); // cursor position in screen space void AlignFirstTextHeightToWidgets(); // call once if the first item on the line is a Text() item and you want to vertically lower it to match higher widgets. float GetTextLineSpacing();