diff options
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."); + } + } +} |
