mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 20:33:40 +01:00
feat: add ResizeBuffers event to UiBuilder
This commit is contained in:
parent
8820f84d2b
commit
395328eb17
2 changed files with 22 additions and 3 deletions
|
|
@ -133,10 +133,15 @@ namespace Dalamud.Interface.Internal
|
||||||
private delegate void InstallRTSSHook();
|
private delegate void InstallRTSSHook();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This event gets called by a plugin UiBuilder when read
|
/// This event gets called each frame to facilitate ImGui drawing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event RawDX11Scene.BuildUIDelegate Draw;
|
public event RawDX11Scene.BuildUIDelegate Draw;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This event gets called when ResizeBuffers is called.
|
||||||
|
/// </summary>
|
||||||
|
public event Action ResizeBuffers;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets an action that is executed when fonts are rebuilt.
|
/// Gets or sets an action that is executed when fonts are rebuilt.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -545,6 +550,8 @@ namespace Dalamud.Interface.Internal
|
||||||
Log.Verbose($"Calling resizebuffers swap@{swapChain.ToInt64():X}{bufferCount} {width} {height} {newFormat} {swapChainFlags}");
|
Log.Verbose($"Calling resizebuffers swap@{swapChain.ToInt64():X}{bufferCount} {width} {height} {newFormat} {swapChainFlags}");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
this.ResizeBuffers?.Invoke();
|
||||||
|
|
||||||
// We have to ensure we're working with the main swapchain,
|
// We have to ensure we're working with the main swapchain,
|
||||||
// as viewports might be resizing as well
|
// as viewports might be resizing as well
|
||||||
if (this.scene == null || swapChain != this.scene.SwapChain.NativePointer)
|
if (this.scene == null || swapChain != this.scene.SwapChain.NativePointer)
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,20 @@ namespace Dalamud.Interface
|
||||||
var interfaceManager = Service<InterfaceManager>.Get();
|
var interfaceManager = Service<InterfaceManager>.Get();
|
||||||
interfaceManager.Draw += this.OnDraw;
|
interfaceManager.Draw += this.OnDraw;
|
||||||
interfaceManager.BuildFonts += this.OnBuildFonts;
|
interfaceManager.BuildFonts += this.OnBuildFonts;
|
||||||
|
interfaceManager.ResizeBuffers += this.OnResizeBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The delegate that gets called when Dalamud is ready to draw your windows or overlays.
|
/// The event that gets called when Dalamud is ready to draw your windows or overlays.
|
||||||
/// When it is called, you can use static ImGui calls.
|
/// When it is called, you can use static ImGui calls.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action Draw;
|
public event Action Draw;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The event that is called when the game's DirectX device is requesting you to resize your buffers.
|
||||||
|
/// </summary>
|
||||||
|
public event Action ResizeBuffers;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Event that is fired when the plugin should open its configuration interface.
|
/// Event that is fired when the plugin should open its configuration interface.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -219,7 +225,8 @@ namespace Dalamud.Interface
|
||||||
var interfaceManager = Service<InterfaceManager>.Get();
|
var interfaceManager = Service<InterfaceManager>.Get();
|
||||||
|
|
||||||
interfaceManager.Draw -= this.OnDraw;
|
interfaceManager.Draw -= this.OnDraw;
|
||||||
interfaceManager.BuildFonts -= this.BuildFonts;
|
interfaceManager.BuildFonts -= this.OnBuildFonts;
|
||||||
|
interfaceManager.BuildFonts -= this.OnResizeBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -292,5 +299,10 @@ namespace Dalamud.Interface
|
||||||
{
|
{
|
||||||
this.BuildFonts?.Invoke();
|
this.BuildFonts?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnResizeBuffers()
|
||||||
|
{
|
||||||
|
this.ResizeBuffers?.Invoke();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue