mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
Checking for correct image size in Image Tester
This commit is contained in:
parent
eb12fe8b2a
commit
0f2937a3dd
1 changed files with 22 additions and 0 deletions
|
|
@ -1300,12 +1300,34 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
|||
|
||||
ImGuiHelpers.ScaledDummy(20);
|
||||
|
||||
static void CheckImageSize(TextureWrap? image, int maxWidth, int maxHeight, bool requireSquare)
|
||||
{
|
||||
if (image == null)
|
||||
return;
|
||||
if (image.Width > maxWidth || image.Height > maxHeight)
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, $"Image is larger than the maximum allowed resolution ({image.Width}x{image.Height} > {maxWidth}x{maxHeight})");
|
||||
if (requireSquare && image.Width != image.Height)
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, $"Image must be square! Current size: {image.Width}x{image.Height}");
|
||||
}
|
||||
|
||||
ImGui.InputText("Icon Path", ref this.testerIconPath, 1000);
|
||||
if (this.testerIcon != null)
|
||||
CheckImageSize(this.testerIcon, PluginImageCache.PluginIconWidth, PluginImageCache.PluginIconHeight, true);
|
||||
ImGui.InputText("Image 1 Path", ref this.testerImagePaths[0], 1000);
|
||||
if (this.testerImages?.Length > 0)
|
||||
CheckImageSize(this.testerImages[0], PluginImageCache.PluginImageWidth, PluginImageCache.PluginImageHeight, false);
|
||||
ImGui.InputText("Image 2 Path", ref this.testerImagePaths[1], 1000);
|
||||
if (this.testerImages?.Length > 1)
|
||||
CheckImageSize(this.testerImages[1], PluginImageCache.PluginImageWidth, PluginImageCache.PluginImageHeight, false);
|
||||
ImGui.InputText("Image 3 Path", ref this.testerImagePaths[2], 1000);
|
||||
if (this.testerImages?.Length > 2)
|
||||
CheckImageSize(this.testerImages[2], PluginImageCache.PluginImageWidth, PluginImageCache.PluginImageHeight, false);
|
||||
ImGui.InputText("Image 4 Path", ref this.testerImagePaths[3], 1000);
|
||||
if (this.testerImages?.Length > 3)
|
||||
CheckImageSize(this.testerImages[3], PluginImageCache.PluginImageWidth, PluginImageCache.PluginImageHeight, false);
|
||||
ImGui.InputText("Image 5 Path", ref this.testerImagePaths[4], 1000);
|
||||
if (this.testerImages?.Length > 4)
|
||||
CheckImageSize(this.testerImages[4], PluginImageCache.PluginImageWidth, PluginImageCache.PluginImageHeight, false);
|
||||
|
||||
var im = Service<InterfaceManager>.Get();
|
||||
if (ImGui.Button("Load"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue