diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs index a82204651..ea730669e 100644 --- a/Dalamud/Interface/Internal/InterfaceManager.cs +++ b/Dalamud/Interface/Internal/InterfaceManager.cs @@ -133,10 +133,15 @@ namespace Dalamud.Interface.Internal private delegate void InstallRTSSHook(); /// - /// This event gets called by a plugin UiBuilder when read + /// This event gets called each frame to facilitate ImGui drawing. /// public event RawDX11Scene.BuildUIDelegate Draw; + /// + /// This event gets called when ResizeBuffers is called. + /// + public event Action ResizeBuffers; + /// /// Gets or sets an action that is executed when fonts are rebuilt. /// @@ -545,6 +550,8 @@ namespace Dalamud.Interface.Internal Log.Verbose($"Calling resizebuffers swap@{swapChain.ToInt64():X}{bufferCount} {width} {height} {newFormat} {swapChainFlags}"); #endif + this.ResizeBuffers?.Invoke(); + // We have to ensure we're working with the main swapchain, // as viewports might be resizing as well if (this.scene == null || swapChain != this.scene.SwapChain.NativePointer) diff --git a/Dalamud/Interface/UiBuilder.cs b/Dalamud/Interface/UiBuilder.cs index 048dac266..00ef46260 100644 --- a/Dalamud/Interface/UiBuilder.cs +++ b/Dalamud/Interface/UiBuilder.cs @@ -38,14 +38,20 @@ namespace Dalamud.Interface var interfaceManager = Service.Get(); interfaceManager.Draw += this.OnDraw; interfaceManager.BuildFonts += this.OnBuildFonts; + interfaceManager.ResizeBuffers += this.OnResizeBuffers; } /// - /// 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. /// public event Action Draw; + /// + /// The event that is called when the game's DirectX device is requesting you to resize your buffers. + /// + public event Action ResizeBuffers; + /// /// Event that is fired when the plugin should open its configuration interface. /// @@ -219,7 +225,8 @@ namespace Dalamud.Interface var interfaceManager = Service.Get(); interfaceManager.Draw -= this.OnDraw; - interfaceManager.BuildFonts -= this.BuildFonts; + interfaceManager.BuildFonts -= this.OnBuildFonts; + interfaceManager.BuildFonts -= this.OnResizeBuffers; } /// @@ -292,5 +299,10 @@ namespace Dalamud.Interface { this.BuildFonts?.Invoke(); } + + private void OnResizeBuffers() + { + this.ResizeBuffers?.Invoke(); + } } }