Added SetCursorPosX, SetCursorPosY shortcuts

This commit is contained in:
ocornut 2014-08-29 13:36:31 +01:00
parent 2fb63b6068
commit dd5d251273
2 changed files with 14 additions and 0 deletions

View File

@ -2461,6 +2461,18 @@ void SetCursorPos(const ImVec2& pos)
window->DC.CursorPos = window->Pos + 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() ImVec2 GetCursorScreenPos()
{ {
ImGuiWindow* window = GetCurrentWindow(); ImGuiWindow* window = GetCurrentWindow();

View File

@ -168,6 +168,8 @@ namespace ImGui
float GetColumnWidth(int column_index = -1); float GetColumnWidth(int column_index = -1);
ImVec2 GetCursorPos(); // cursor position relative to window position ImVec2 GetCursorPos(); // cursor position relative to window position
void SetCursorPos(const ImVec2& pos); // " void SetCursorPos(const ImVec2& pos); // "
void SetCursorPosX(float x); // "
void SetCursorPosY(float y); // "
ImVec2 GetCursorScreenPos(); // cursor position in screen space 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. 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(); float GetTextLineSpacing();