refactor: OnBuildFonts -> BuildFonts

This commit is contained in:
goat 2021-08-24 15:00:55 +02:00
parent 33cbad9f16
commit 8256e5431a
No known key found for this signature in database
GPG key ID: F18F057873895461
2 changed files with 29 additions and 23 deletions

View file

@ -48,7 +48,7 @@ namespace Dalamud.Interface.Internal
private readonly ManualResetEvent fontBuildSignal;
private readonly ISwapChainAddressResolver address;
private RawDX11Scene scene;
private RawDX11Scene? scene;
// can't access imgui IO before first present call
private bool lastWantCapture = false;
@ -136,6 +136,11 @@ namespace Dalamud.Interface.Internal
/// </summary>
public event RawDX11Scene.BuildUIDelegate Draw;
/// <summary>
/// Gets or sets an action that is executed when fonts are rebuilt.
/// </summary>
public event Action BuildFonts;
/// <summary>
/// Gets the default ImGui font.
/// </summary>
@ -151,11 +156,6 @@ namespace Dalamud.Interface.Internal
/// </summary>
public static ImFontPtr MonoFont { get; private set; }
/// <summary>
/// Gets or sets an action that is exexuted when fonts are rebuilt.
/// </summary>
public Action OnBuildFonts { get; set; }
/// <summary>
/// Gets or sets the pointer to ImGui.IO(), when it was last used.
/// </summary>
@ -164,7 +164,7 @@ namespace Dalamud.Interface.Internal
/// <summary>
/// Gets the D3D11 device instance.
/// </summary>
public Device Device => this.scene.Device;
public Device? Device => this.scene?.Device;
/// <summary>
/// Gets the address handle to the main process window.
@ -494,7 +494,7 @@ namespace Dalamud.Interface.Internal
MonoFont = ImGui.GetIO().Fonts.AddFontFromFileTTF(fontPathMono, 16.0f);
Log.Verbose("[FONT] Invoke OnBuildFonts");
this.OnBuildFonts?.Invoke();
this.BuildFonts?.Invoke();
Log.Verbose("[FONT] OnBuildFonts OK!");
for (var i = 0; i < ImGui.GetIO().Fonts.Fonts.Size; i++)