CommandReference/SamplePlugin/Windows/MainWindow.cs

57 lines
1.3 KiB
C#
Raw Normal View History

2024-02-07 07:13:53 +00:00
using System;
2024-02-06 22:21:01 +00:00
using System.Numerics;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Windowing;
using ImGuiNET;
namespace SamplePlugin.Windows;
public class MainWindow : Window, IDisposable
{
private IDalamudTextureWrap GoatImage;
private Plugin Plugin;
2024-02-07 07:13:53 +00:00
public MainWindow(Plugin plugin, IDalamudTextureWrap goatImage)
: base(
"My Amazing Window",
ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse
)
2024-02-06 22:21:01 +00:00
{
this.SizeConstraints = new WindowSizeConstraints
{
MinimumSize = new Vector2(375, 330),
MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
};
this.GoatImage = goatImage;
this.Plugin = plugin;
}
public void Dispose()
{
this.GoatImage.Dispose();
}
public override void Draw()
{
2024-02-07 07:13:53 +00:00
ImGui.Text(
$"The random config bool is {this.Plugin.configuration.SomePropertyToBeSavedAndWithADefault}"
);
2024-02-06 22:21:01 +00:00
if (ImGui.Button("Show Settings"))
{
this.Plugin.DrawConfigUI();
}
ImGui.Spacing();
ImGui.Text("Have a goat:");
ImGui.Indent(55);
2024-02-07 07:13:53 +00:00
ImGui.Image(
this.GoatImage.ImGuiHandle,
new Vector2(this.GoatImage.Width, this.GoatImage.Height)
);
2024-02-06 22:21:01 +00:00
ImGui.Unindent(55);
}
}