From 0a3b393ba1eb37c57b23407cb228ff801eacea5e Mon Sep 17 00:00:00 2001 From: Takkkom <76614532+Takkkom@users.noreply.github.com> Date: Sat, 25 Jun 2022 17:03:38 +0900 Subject: [PATCH] =?UTF-8?q?FullHD=E3=81=AB=E5=AF=BE=E5=BF=9C=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=81=9F=E3=82=81=E3=81=AE=E4=B8=8B=E6=BA=96=E5=82=99?= =?UTF-8?q?=20(#270)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../01.フレームワーク/Core/GameWindow.cs | 16 +++++++- .../01.フレームワーク/Core/GameWindowSize.cs | 4 +- TJAPlayer3/Common/CSkin.cs | 13 +++++- TJAPlayer3/Common/TJAPlayer3.cs | 40 ++++++++++++++++--- 4 files changed, 61 insertions(+), 12 deletions(-) diff --git a/FDK19/コード/01.フレームワーク/Core/GameWindow.cs b/FDK19/コード/01.フレームワーク/Core/GameWindow.cs index e4cf1509..5abd21e8 100644 --- a/FDK19/コード/01.フレームワーク/Core/GameWindow.cs +++ b/FDK19/コード/01.フレームワーク/Core/GameWindow.cs @@ -293,8 +293,20 @@ namespace SampleFramework #region #23510 2010.11.14 yyagi add: 縦横比固定でのウインドウサイズ変更 定数定義 from http://www.vcskicks.com/maintain-aspect-ratio.php //double so division keeps decimal points - const double widthRatio = SampleFramework.GameWindowSize.Width; - const double heightRatio = SampleFramework.GameWindowSize.Height; + double widthRatio + { + get + { + return SampleFramework.GameWindowSize.Width; + } + } + double heightRatio + { + get + { + return SampleFramework.GameWindowSize.Height; + } + } const int WM_SIZING = 0x214; const int WMSZ_LEFT = 1; const int WMSZ_RIGHT = 2; diff --git a/FDK19/コード/01.フレームワーク/Core/GameWindowSize.cs b/FDK19/コード/01.フレームワーク/Core/GameWindowSize.cs index bd06fa4f..6f06826a 100644 --- a/FDK19/コード/01.フレームワーク/Core/GameWindowSize.cs +++ b/FDK19/コード/01.フレームワーク/Core/GameWindowSize.cs @@ -4,7 +4,7 @@ namespace SampleFramework { public static class GameWindowSize { - public const int Width = 1280; - public const int Height = 720; + public static int Width = 1280; + public static int Height = 720; } } diff --git a/TJAPlayer3/Common/CSkin.cs b/TJAPlayer3/Common/CSkin.cs index 40d8bdfb..c30f1829 100644 --- a/TJAPlayer3/Common/CSkin.cs +++ b/TJAPlayer3/Common/CSkin.cs @@ -1087,6 +1087,14 @@ namespace TJAPlayer3 { this.Skin_Creator = strParam; } + /*else if (strCommand == "Resolution") + { + string[] strSplit = strParam.Split(','); + for (int i = 0; i < 2; i++) + { + Resolution[i] = int.Parse(strSplit[i]); + } + }*/ #endregion #region [Background Scroll] @@ -2653,10 +2661,11 @@ namespace TJAPlayer3 public string Skin_Name = "Unknown"; public string Skin_Version = "Unknown"; public string Skin_Creator = "Unknown"; + public int[] Resolution = new int[] { 1280, 720 }; #endregion - + #region Config - + public int Config_ItemText_Correction_X = 0; public int Config_ItemText_Correction_Y = 0; diff --git a/TJAPlayer3/Common/TJAPlayer3.cs b/TJAPlayer3/Common/TJAPlayer3.cs index 4cbc157f..77672579 100644 --- a/TJAPlayer3/Common/TJAPlayer3.cs +++ b/TJAPlayer3/Common/TJAPlayer3.cs @@ -1042,6 +1042,7 @@ namespace TJAPlayer3 //----------------------------- #endregion } + return; } //----------------------------- #endregion @@ -2282,7 +2283,10 @@ for (int i = 0; i < 3; i++) { try { Skin = new CSkin( TJAPlayer3.ConfigIni.strSystemSkinSubfolderFullName, false); - TJAPlayer3.ConfigIni.strSystemSkinSubfolderFullName = TJAPlayer3.Skin.GetCurrentSkinSubfolderFullName( true ); // 旧指定のSkinフォルダが消滅していた場合に備える + TJAPlayer3.ConfigIni.strSystemSkinSubfolderFullName = TJAPlayer3.Skin.GetCurrentSkinSubfolderFullName( true ); // 旧指定のSkinフォルダが消滅していた場合に備える + + ChangeResolution(TJAPlayer3.Skin.Resolution[0], TJAPlayer3.Skin.Resolution[1]); + Trace.TraceInformation( "スキンの初期化を完了しました。" ); } catch (Exception e) @@ -3071,7 +3075,29 @@ for (int i = 0; i < 3; i++) { Trace.TraceInformation( this.listプラグイン.Count + " 個のプラグインを読み込みました。" ); } - public void RefleshSkin() + private void ChangeResolution(int nWidth, int nHeight) + { + if (base.GraphicsDeviceManager.CurrentSettings.BackBufferWidth == nWidth || + base.GraphicsDeviceManager.CurrentSettings.BackBufferHeight == nHeight) + return; + + currentClientSize = this.Window.ClientSize; + + var state = base.Window.WindowState; + + SampleFramework.GameWindowSize.Width = nWidth; + SampleFramework.GameWindowSize.Height = nHeight; + + base.GraphicsDeviceManager.CurrentSettings.BackBufferWidth = nWidth; + base.GraphicsDeviceManager.CurrentSettings.BackBufferHeight = nHeight; + + base.GraphicsDeviceManager.ChangeDevice(base.GraphicsDeviceManager.CurrentSettings); + + base.Window.ClientSize = new Size(currentClientSize.Width, currentClientSize.Height); + base.Window.WindowState = state; + } + + public void RefleshSkin() { Trace.TraceInformation("スキン変更:" + TJAPlayer3.Skin.GetCurrentSkinSubfolderFullName(false)); @@ -3080,10 +3106,12 @@ for (int i = 0; i < 3; i++) { TJAPlayer3.Skin.Dispose(); TJAPlayer3.Skin = null; TJAPlayer3.Skin = new CSkin(TJAPlayer3.ConfigIni.strSystemSkinSubfolderFullName, false); - - - TJAPlayer3.Tx.DisposeTexture(); - TJAPlayer3.Tx.LoadTexture(); + + TJAPlayer3.Tx.DisposeTexture(); + + ChangeResolution(TJAPlayer3.Skin.Resolution[0], TJAPlayer3.Skin.Resolution[1]); + + TJAPlayer3.Tx.LoadTexture(); TJAPlayer3.act文字コンソール.On活性化(); }