mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-18 14:44:16 +01:00
feat: cache viewport ID in ImGuiHelpers
This commit is contained in:
parent
562762da01
commit
efdf9ca1ee
1 changed files with 15 additions and 1 deletions
|
|
@ -7,9 +7,23 @@ namespace Dalamud.Interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class ImGuiHelpers
|
public static class ImGuiHelpers
|
||||||
{
|
{
|
||||||
|
private static uint mainViewportId;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Force this ImGui window to stay inside the main game window.
|
/// Force this ImGui window to stay inside the main game window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void ForceMainWindow() => ImGui.SetNextWindowViewport(ImGui.GetMainViewport().ID);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue