From 9db6a52999edc6f7486b6c5a30de4502dd233286 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 19 Apr 2020 03:24:43 +0200 Subject: [PATCH] actually make this take a window, makes more sense --- Demos.Android/Activity1.cs | 2 +- MLEM/Extensions/GraphicsExtensions.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Demos.Android/Activity1.cs b/Demos.Android/Activity1.cs index 91fdb3c..4d7e997 100644 --- a/Demos.Android/Activity1.cs +++ b/Demos.Android/Activity1.cs @@ -27,7 +27,7 @@ namespace Demos.Android { TextInputWrapper.Current = new TextInputWrapper.Mobile(); this.game = new GameImpl(); // reset MlemGame width and height to use device's aspect ratio - this.game.GraphicsDeviceManager.ResetWidthAndHeight(this.game); + this.game.GraphicsDeviceManager.ResetWidthAndHeight(this.game.Window); // disable mouse handling for android to make emulator behavior more coherent this.game.OnLoadContent += game => game.InputHandler.HandleMouse = false; this.view = this.game.Services.GetService(typeof(View)) as View; diff --git a/MLEM/Extensions/GraphicsExtensions.cs b/MLEM/Extensions/GraphicsExtensions.cs index a2ac8f6..3007efa 100644 --- a/MLEM/Extensions/GraphicsExtensions.cs +++ b/MLEM/Extensions/GraphicsExtensions.cs @@ -39,8 +39,8 @@ namespace MLEM.Extensions { manager.ApplyChanges(); } - public static void ResetWidthAndHeight(this GraphicsDeviceManager manager, Game game) { - var (_, _, width, height) = game.Window.ClientBounds; + public static void ResetWidthAndHeight(this GraphicsDeviceManager manager, GameWindow window) { + var (_, _, width, height) = window.ClientBounds; manager.PreferredBackBufferWidth = Math.Max(height, width); manager.PreferredBackBufferHeight = Math.Min(height, width); manager.ApplyChanges();