From 56c7a4bb5f3045c7617218a04086d68eee1edf49 Mon Sep 17 00:00:00 2001 From: Takkkom <76614532+Takkkom@users.noreply.github.com> Date: Sun, 22 Oct 2023 20:08:52 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A6=E3=82=A4=E3=83=B3=E3=83=89=E3=82=A6?= =?UTF-8?q?=E3=81=AE=E3=82=A2=E3=82=B9=E3=83=9A=E3=82=AF=E3=83=88=E6=AF=94?= =?UTF-8?q?=E3=82=92=E7=B6=AD=E6=8C=81=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=20(#512)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ウインドウのアスペクト比を維持するように * 修正 * 修正2 --- FDK/src/01.Framework/Core/Game.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/FDK/src/01.Framework/Core/Game.cs b/FDK/src/01.Framework/Core/Game.cs index 705d7fe6..a416ef25 100644 --- a/FDK/src/01.Framework/Core/Game.cs +++ b/FDK/src/01.Framework/Core/Game.cs @@ -411,6 +411,7 @@ namespace SampleFramework { double fps = 1.0f / deltaTime; TimeMs = (long)(Window_.Time * 1000); + Update(); } @@ -428,6 +429,19 @@ namespace SampleFramework public void Window_Resize(Vector2D size) { + if (size.X > 0 && size.Y > 0 && Window_.WindowState == WindowState.Normal) + { + float resolutionAspect = (float)GameWindowSize.Width / GameWindowSize.Height; + if (WindowSize.X != size.X) + { + size.Y = (int)(size.X / (resolutionAspect)); + } + else + { + size.X = (int)(size.Y * (resolutionAspect)); + } + } + WindowSize = size; GraphicsDevice.SetViewPort(0, 0, (uint)size.X, (uint)size.Y); }