1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-28 19:13:38 +02:00

actually make this take a window, makes more sense

This commit is contained in:
Ellpeck 2020-04-19 03:24:43 +02:00
parent 0ee7f74efd
commit 9db6a52999
2 changed files with 3 additions and 3 deletions

View file

@ -27,7 +27,7 @@ namespace Demos.Android {
TextInputWrapper.Current = new TextInputWrapper.Mobile(); TextInputWrapper.Current = new TextInputWrapper.Mobile();
this.game = new GameImpl(); this.game = new GameImpl();
// reset MlemGame width and height to use device's aspect ratio // 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 // disable mouse handling for android to make emulator behavior more coherent
this.game.OnLoadContent += game => game.InputHandler.HandleMouse = false; this.game.OnLoadContent += game => game.InputHandler.HandleMouse = false;
this.view = this.game.Services.GetService(typeof(View)) as View; this.view = this.game.Services.GetService(typeof(View)) as View;

View file

@ -39,8 +39,8 @@ namespace MLEM.Extensions {
manager.ApplyChanges(); manager.ApplyChanges();
} }
public static void ResetWidthAndHeight(this GraphicsDeviceManager manager, Game game) { public static void ResetWidthAndHeight(this GraphicsDeviceManager manager, GameWindow window) {
var (_, _, width, height) = game.Window.ClientBounds; var (_, _, width, height) = window.ClientBounds;
manager.PreferredBackBufferWidth = Math.Max(height, width); manager.PreferredBackBufferWidth = Math.Max(height, width);
manager.PreferredBackBufferHeight = Math.Min(height, width); manager.PreferredBackBufferHeight = Math.Min(height, width);
manager.ApplyChanges(); manager.ApplyChanges();