diff options
Diffstat (limited to 'SamplePlugin/Windows')
| -rw-r--r-- | SamplePlugin/Windows/ConfigWindow.cs | 59 | ||||
| -rw-r--r-- | SamplePlugin/Windows/MainWindow.cs | 58 |
2 files changed, 0 insertions, 117 deletions
diff --git a/SamplePlugin/Windows/ConfigWindow.cs b/SamplePlugin/Windows/ConfigWindow.cs deleted file mode 100644 index 0a0af98..0000000 --- a/SamplePlugin/Windows/ConfigWindow.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Numerics; -using Dalamud.Interface.Windowing; -using ImGuiNET; - -namespace SamplePlugin.Windows; - -public class ConfigWindow : Window, IDisposable -{ - private Configuration Configuration; - - // We give this window a constant ID using ### - // This allows for labels being dynamic, like "{FPS Counter}fps###XYZ counter window", - // and the window ID will always be "###XYZ counter window" for ImGui - public ConfigWindow(Plugin plugin) : base("A Wonderful Configuration Window###With a constant ID") - { - Flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | - ImGuiWindowFlags.NoScrollWithMouse; - - Size = new Vector2(232, 90); - SizeCondition = ImGuiCond.Always; - - Configuration = plugin.Configuration; - } - - public void Dispose() { } - - public override void PreDraw() - { - // Flags must be added or removed before Draw() is being called, or they won't apply - if (Configuration.IsConfigWindowMovable) - { - Flags &= ~ImGuiWindowFlags.NoMove; - } - else - { - Flags |= ImGuiWindowFlags.NoMove; - } - } - - public override void Draw() - { - // can't ref a property, so use a local copy - var configValue = Configuration.SomePropertyToBeSavedAndWithADefault; - if (ImGui.Checkbox("Random Config Bool", ref configValue)) - { - Configuration.SomePropertyToBeSavedAndWithADefault = configValue; - // can save immediately on change, if you don't want to provide a "Save and Close" button - Configuration.Save(); - } - - var movable = Configuration.IsConfigWindowMovable; - if (ImGui.Checkbox("Movable Config Window", ref movable)) - { - Configuration.IsConfigWindowMovable = movable; - Configuration.Save(); - } - } -} diff --git a/SamplePlugin/Windows/MainWindow.cs b/SamplePlugin/Windows/MainWindow.cs deleted file mode 100644 index 9ac6a4d..0000000 --- a/SamplePlugin/Windows/MainWindow.cs +++ /dev/null @@ -1,58 +0,0 @@ -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."); - } - } -} |
