feat: add SetWindowPosRelativeMainViewport to ImGuiHelpers

This commit is contained in:
goat 2021-04-06 15:41:34 +02:00
parent 633fe68046
commit 3076e13920

View file

@ -37,10 +37,26 @@ namespace Dalamud.Interface
public static void ScaledRelativeSameLine(float offset, float spacing = -1.0f) =>
ImGui.SameLine(ImGui.GetCursorPosX() + (offset * GlobalScale));
/// <summary>
/// Set the position of the next window relative to the main viewport.
/// </summary>
/// <param name="position">The position of the next window.</param>
/// <param name="condition">When to set the position.</param>
/// <param name="pivot">The pivot to set the position around.</param>
public static void SetNextWindowPosRelativeMainViewport(
Vector2 position, ImGuiCond condition = ImGuiCond.None, Vector2 pivot = default)
=> ImGui.SetNextWindowPos(position + MainViewport.Pos, condition, pivot);
/// <summary>
/// Set the position of a window relative to the main viewport.
/// </summary>
/// <param name="name">The name/ID of the window.</param>
/// <param name="position">The position of the window.</param>
/// <param name="condition">When to set the position.</param>
public static void SetWindowPosRelativeMainViewport(
string name, Vector2 position, ImGuiCond condition = ImGuiCond.None)
=> ImGui.SetWindowPos(position + MainViewport.Pos, condition);
/// <summary>
/// Get data needed for each new frame.
/// </summary>