Add ability for plugins to add ImGui fonts at runtime, though we should discourage this as much as possible. Also sneak in an api-matching update to part of ImGuiScene, to make more things useable in SamplePlugin

This commit is contained in:
meli 2020-04-29 17:13:05 -07:00
parent 0800cc4e91
commit fcd98ee2bb
3 changed files with 81 additions and 26 deletions

View file

@ -70,6 +70,26 @@ namespace Dalamud.Interface
public TextureWrap LoadImageRaw(byte[] imageData, int width, int height, int numChannels) =>
this.interfaceManager.LoadImageRaw(imageData, width, height, numChannels);
/// <summary>
/// An event that is called any time ImGui fonts need to be rebuilt.<br/>
/// Any ImFontPtr objects that you store <strong>can be invalidated</strong> when fonts are rebuilt
/// (at any time), so you should both reload your custom fonts and restore those
/// pointers inside this handler.
/// </summary>
public Action OnBuildFonts
{
get { return this.interfaceManager.OnBuildFonts; }
set { this.interfaceManager.OnBuildFonts = value; }
}
/// <summary>
/// Call this to queue a rebuild of the font atlas.<br/>
/// This will invoke any <see cref="OnBuildFonts"/> handlers and ensure that any loaded fonts are
/// ready to be used on the next UI frame.
/// </summary>
public void RebuildFonts() =>
this.interfaceManager.RebuildFonts();
/// <summary>
/// Event that is fired when the plugin should open its configuration interface.
/// </summary>