feat: add component library

This commit is contained in:
goat 2021-04-05 23:54:32 +02:00
parent 7d5680badd
commit 841e452aa2
4 changed files with 100 additions and 0 deletions

View file

@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using CheapLoc;
using Dalamud.Interface.Components;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using ImGuiNET;
@ -39,6 +40,7 @@ namespace Dalamud.Interface
private readonly PluginInstallerWindow pluginWindow;
private readonly DalamudPluginStatWindow pluginStatWindow;
private readonly DalamudChangelogWindow changelogWindow;
private readonly ComponentDemoWindow componentDemoWindow;
private readonly WindowSystem windowSystem = new WindowSystem("DalamudCore");
@ -92,6 +94,12 @@ namespace Dalamud.Interface
};
this.windowSystem.AddWindow(this.changelogWindow);
this.componentDemoWindow = new ComponentDemoWindow()
{
IsOpen = false,
};
this.windowSystem.AddWindow(this.componentDemoWindow);
Log.Information("[DUI] Windows added");
if (dalamud.Configuration.LogOpenAtStartup)
@ -195,6 +203,11 @@ namespace Dalamud.Interface
this.OpenChangelog();
}
if (ImGui.MenuItem("Open Components Demo"))
{
this.OpenComponentDemo();
}
ImGui.MenuItem("Draw ImGui demo", string.Empty, ref this.isImguiDrawDemoWindow);
ImGui.Separator();
@ -387,6 +400,14 @@ namespace Dalamud.Interface
this.pluginStatWindow.IsOpen ^= true;
}
/// <summary>
/// Open the component test window.
/// </summary>
internal void OpenComponentDemo()
{
this.componentDemoWindow.IsOpen ^= true;
}
public void Dispose()
{
this.windowSystem.RemoveAllWindows();