feat: add config option for ImGui asserts

This commit is contained in:
goaaats 2021-10-07 19:08:15 +02:00
parent 87655d51cb
commit 521efe2bd7
No known key found for this signature in database
GPG key ID: F18F057873895461
2 changed files with 12 additions and 1 deletions

View file

@ -160,6 +160,11 @@ namespace Dalamud.Configuration.Internal
/// </summary> /// </summary>
public bool LogOpenAtStartup { get; set; } public bool LogOpenAtStartup { get; set; }
/// <summary>
/// Gets or sets a value indicating whether or not ImGui asserts should be enabled at startup.
/// </summary>
public bool AssertsEnabledAtStartup { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether or not docking should be globally enabled in ImGui. /// Gets or sets a value indicating whether or not docking should be globally enabled in ImGui.
/// </summary> /// </summary>

View file

@ -94,7 +94,7 @@ namespace Dalamud.Interface.Internal
this.WindowSystem.AddWindow(this.selfTestWindow); this.WindowSystem.AddWindow(this.selfTestWindow);
this.WindowSystem.AddWindow(this.styleEditorWindow); this.WindowSystem.AddWindow(this.styleEditorWindow);
ImGuiManagedAsserts.AssertsEnabled = true; ImGuiManagedAsserts.AssertsEnabled = configuration.AssertsEnabledAtStartup;
Service<InterfaceManager>.Get().Draw += this.OnDraw; Service<InterfaceManager>.Get().Draw += this.OnDraw;
} }
@ -492,6 +492,12 @@ namespace Dalamud.Interface.Internal
ImGuiManagedAsserts.AssertsEnabled = val; ImGuiManagedAsserts.AssertsEnabled = val;
} }
if (ImGui.MenuItem("Enable asserts at startup", null, configuration.AssertsEnabledAtStartup))
{
configuration.AssertsEnabledAtStartup = !configuration.AssertsEnabledAtStartup;
configuration.Save();
}
if (ImGui.MenuItem("Clear focus")) if (ImGui.MenuItem("Clear focus"))
{ {
ImGui.SetWindowFocus(null); ImGui.SetWindowFocus(null);