1
0
vibe-plugin/FFXIV_Vibe_Plugin/Windows/ConfigWindow.cs
2023-01-24 22:50:56 +01:00

37 lines
1.1 KiB
C#

using System;
using System.Numerics;
using Dalamud.Interface.Windowing;
using ImGuiNET;
namespace FFXIV_Plugin_Vibe.Windows;
public class ConfigWindow : Window, IDisposable
{
private Configuration Configuration;
public ConfigWindow(Plugin plugin) : base(
"A Wonderful Configuration Window",
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar |
ImGuiWindowFlags.NoScrollWithMouse)
{
this.Size = new Vector2(232, 75);
this.SizeCondition = ImGuiCond.Always;
this.Configuration = plugin.Configuration;
}
public void Dispose() { }
public override void Draw()
{
// can't ref a property, so use a local copy
var configValue = this.Configuration.SomePropertyToBeSavedAndWithADefault;
if (ImGui.Checkbox("Random Config Bool", ref configValue))
{
this.Configuration.SomePropertyToBeSavedAndWithADefault = configValue;
// can save immediately on change, if you don't want to provide a "Save and Close" button
this.Configuration.Save();
}
}
}