mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
feat: add MainViewport to ImGuiHelpers instead
This commit is contained in:
parent
c21e7efab7
commit
303ddf8d27
2 changed files with 7 additions and 17 deletions
|
|
@ -9,7 +9,10 @@ namespace Dalamud.Interface
|
|||
/// </summary>
|
||||
public static class ImGuiHelpers
|
||||
{
|
||||
private static uint mainViewportId;
|
||||
/// <summary>
|
||||
/// Gets the main viewport.
|
||||
/// </summary>
|
||||
public static ImGuiViewportPtr MainViewport { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the global Dalamud scale.
|
||||
|
|
@ -19,21 +22,7 @@ namespace Dalamud.Interface
|
|||
/// <summary>
|
||||
/// Force this ImGui window to stay inside the main game window.
|
||||
/// </summary>
|
||||
public static void ForceMainWindow() => ImGui.SetNextWindowViewport(GetMainViewportId());
|
||||
|
||||
/// <summary>
|
||||
/// Get the ID of the main game window viewport.
|
||||
/// </summary>
|
||||
/// <returns>The ID of the main game window viewport.</returns>
|
||||
public static uint GetMainViewportId()
|
||||
{
|
||||
if (mainViewportId == 0)
|
||||
mainViewportId = ImGui.GetMainViewport().ID;
|
||||
|
||||
return mainViewportId;
|
||||
}
|
||||
|
||||
public static Vector2 MainWindowPos { get; set; }
|
||||
public static void ForceMainWindow() => ImGui.SetNextWindowViewport(MainViewport.ID);
|
||||
|
||||
/// <summary>
|
||||
/// Create a dummy scaled by the global Dalamud scale.
|
||||
|
|
@ -55,7 +44,6 @@ namespace Dalamud.Interface
|
|||
internal static void NewFrame()
|
||||
{
|
||||
GlobalScale = ImGui.GetIO().FontGlobalScale;
|
||||
MainWindowPos = ImGui.GetMainViewport().Pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue