diff options
| author | Pinapelz <donaldshan1@outlook.com> | 2024-08-26 00:57:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-26 00:57:05 -0700 |
| commit | b8c43fbe717d794284c6c4578c9c00ae8e26d711 (patch) | |
| tree | db3e449a3fd039b4935359eafb1f3ee9f61f5df7 /SamplePlugin/Windows/MainWindow.cs | |
Initial commit
Diffstat (limited to 'SamplePlugin/Windows/MainWindow.cs')
| -rw-r--r-- | SamplePlugin/Windows/MainWindow.cs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/SamplePlugin/Windows/MainWindow.cs b/SamplePlugin/Windows/MainWindow.cs new file mode 100644 index 0000000..9ac6a4d --- /dev/null +++ b/SamplePlugin/Windows/MainWindow.cs @@ -0,0 +1,58 @@ +using System; +using System.Numerics; +using Dalamud.Interface.Internal; +using Dalamud.Interface.Utility; +using Dalamud.Interface.Windowing; +using Dalamud.Plugin.Services; +using ImGuiNET; + +namespace SamplePlugin.Windows; + +public class MainWindow : Window, IDisposable +{ + private string GoatImagePath; + private Plugin Plugin; + + // We give this window a hidden ID using ## + // So that the user will see "My Amazing Window" as window title, + // but for ImGui the ID is "My Amazing Window##With a hidden ID" + public MainWindow(Plugin plugin, string goatImagePath) + : base("My Amazing Window##With a hidden ID", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse) + { + SizeConstraints = new WindowSizeConstraints + { + MinimumSize = new Vector2(375, 330), + MaximumSize = new Vector2(float.MaxValue, float.MaxValue) + }; + + GoatImagePath = goatImagePath; + Plugin = plugin; + } + + public void Dispose() { } + + public override void Draw() + { + ImGui.Text($"The random config bool is {Plugin.Configuration.SomePropertyToBeSavedAndWithADefault}"); + + if (ImGui.Button("Show Settings")) + { + Plugin.ToggleConfigUI(); + } + + ImGui.Spacing(); + + ImGui.Text("Have a goat:"); + var goatImage = Plugin.TextureProvider.GetFromFile(GoatImagePath).GetWrapOrDefault(); + if (goatImage != null) + { + ImGuiHelpers.ScaledIndent(55f); + ImGui.Image(goatImage.ImGuiHandle, new Vector2(goatImage.Width, goatImage.Height)); + ImGuiHelpers.ScaledIndent(-55f); + } + else + { + ImGui.Text("Image not found."); + } + } +} |
