From 9585a9105e3308fbe73e47f7e5ccb17fd8fd505a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 1 Sep 2016 19:06:09 +0900 Subject: [PATCH] Update resolution handling logic. --- osu.Game/OsuGame.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 355472c437..066a61c86a 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -1,6 +1,7 @@ //Copyright (c) 2007-2016 ppy Pty Ltd . //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using System.Drawing; using osu.Framework.Framework; @@ -10,6 +11,8 @@ using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Processing; using osu.Game.Online.API; using osu.Game.Online.API.Requests; +using OpenTK; +using osu.Framework.Graphics; namespace osu.Game { @@ -25,8 +28,7 @@ namespace osu.Game { base.Load(); - Window.Size = new Size(Config.Get(OsuConfig.Width), Config.Get(OsuConfig.Height)); - Window.OnSizeChanged += window_OnSizeChanged; + Parent.Size = new Vector2(Config.Get(OsuConfig.Width), Config.Get(OsuConfig.Height)); API = new APIAccess() { @@ -57,10 +59,16 @@ namespace osu.Game base.Dispose(isDisposing); } - private void window_OnSizeChanged() + public override bool Invalidate(bool affectsSize = true, bool affectsPosition = true, Drawable source = null) { - Config.Set(OsuConfig.Width, Window.Size.Width); - Config.Set(OsuConfig.Height, Window.Size.Height); + if (!base.Invalidate(affectsSize, affectsPosition, source)) return false; + + if (Parent != null) + { + Parent.Width = Config.Set(OsuConfig.Width, ActualSize.X).Value; + Parent.Height = Config.Set(OsuConfig.Height, ActualSize.Y).Value; + } + return true; } } }