From 506343f23aacc35c986c631dfe9d64c1ed02e475 Mon Sep 17 00:00:00 2001 From: Topaz Whitelock Date: Mon, 11 Sep 2023 04:24:57 +0300 Subject: [PATCH] Add Re:Fined Ultrawide Viewports --- OpenKh.Tools.LayoutEditor/App.cs | 11 +++++++++++ OpenKh.Tools.LayoutEditor/AppLayoutEditor.cs | 17 ++++++++++++++++- .../Interfaces/IEditorSettings.cs | 1 + .../Settings.Designer.cs | 19 +++++++++++++++++-- 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/OpenKh.Tools.LayoutEditor/App.cs b/OpenKh.Tools.LayoutEditor/App.cs index 64bccd29e..fd84813b4 100644 --- a/OpenKh.Tools.LayoutEditor/App.cs +++ b/OpenKh.Tools.LayoutEditor/App.cs @@ -150,6 +150,16 @@ public bool ShowViewportRemix } } + public bool ShowViewportReFined + { + get => Settings.Default.ShowViewportReFined; + set + { + Settings.Default.ShowViewportReFined = value; + Settings.Default.Save(); + } + } + public bool IsViewportOnTop { get => Settings.Default.IsViewportOnTop; @@ -297,6 +307,7 @@ void MainMenu() ForMenuCheck("Show PS2 viewport", () => ShowViewportOriginal, x => ShowViewportOriginal = x); ForMenuCheck("Show ReMIX viewport", () => ShowViewportRemix, x => ShowViewportRemix = x); + ForMenuCheck("Show Re:Fined viewport", () => ShowViewportReFined, x => ShowViewportReFined = x); ForMenuCheck("Viewport always on top", () => IsViewportOnTop, x => IsViewportOnTop = x); }); ImGui.Separator(); diff --git a/OpenKh.Tools.LayoutEditor/AppLayoutEditor.cs b/OpenKh.Tools.LayoutEditor/AppLayoutEditor.cs index 3a3eca053..8f28ae14f 100644 --- a/OpenKh.Tools.LayoutEditor/AppLayoutEditor.cs +++ b/OpenKh.Tools.LayoutEditor/AppLayoutEditor.cs @@ -227,17 +227,32 @@ private void DrawGameViewport(ColorF backgroundColorInverse) { const float OriginalViewportWidth = 512f; const float RemixViewportWidth = 684f; + const float ReFinedViewportWidthFirst = 970.6F; + const float ReFinedViewportWidthSecond = 1479F; const float ViewportHeight = 416f; if (_settings.ShowViewportOriginal) _drawing.DrawRectangle(-1 + _renderer.PanFactorX, -1 + _renderer.PanFactorY, OriginalViewportWidth + 2, ViewportHeight + 2, backgroundColorInverse, 1); if (_settings.ShowViewportRemix) + { _drawing.DrawRectangle( -(RemixViewportWidth - OriginalViewportWidth) / 2 - 1 + _renderer.PanFactorX, -1 + _renderer.PanFactorY, RemixViewportWidth + 2, ViewportHeight + 2, backgroundColorInverse, 1); + } + + if (_settings.ShowViewportReFined) + { + _drawing.DrawRectangle( + -(ReFinedViewportWidthFirst - OriginalViewportWidth) / 2 - 1 + _renderer.PanFactorX, -1 + _renderer.PanFactorY, + ReFinedViewportWidthFirst + 2, ViewportHeight + 2, backgroundColorInverse, 1); + + _drawing.DrawRectangle( + -(ReFinedViewportWidthSecond - OriginalViewportWidth) / 2 - 1 + _renderer.PanFactorX, -1 + _renderer.PanFactorY, + ReFinedViewportWidthSecond + 2, ViewportHeight + 2, backgroundColorInverse, 1); + } - _drawing.Flush(); + _drawing.Flush(); } private unsafe void Timeline() diff --git a/OpenKh.Tools.LayoutEditor/Interfaces/IEditorSettings.cs b/OpenKh.Tools.LayoutEditor/Interfaces/IEditorSettings.cs index 9661f1e17..2dce5b34b 100644 --- a/OpenKh.Tools.LayoutEditor/Interfaces/IEditorSettings.cs +++ b/OpenKh.Tools.LayoutEditor/Interfaces/IEditorSettings.cs @@ -11,6 +11,7 @@ public interface IEditorSettings ColorF EditorBackground { get; } bool ShowViewportOriginal { get; } bool ShowViewportRemix { get; } + bool ShowViewportReFined { get; } bool IsViewportOnTop { get; } } } diff --git a/OpenKh.Tools.LayoutEditor/Settings.Designer.cs b/OpenKh.Tools.LayoutEditor/Settings.Designer.cs index 3fe158978..3c244a130 100644 --- a/OpenKh.Tools.LayoutEditor/Settings.Designer.cs +++ b/OpenKh.Tools.LayoutEditor/Settings.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 @@ -82,7 +82,22 @@ public bool ShowViewportRemix { this["ShowViewportRemix"] = value; } } - + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool ShowViewportReFined + { + get + { + return ((bool)(this["ShowViewportReFined"])); + } + set + { + this["ShowViewportReFined"] = value; + } + } + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")]