Update resolution handling logic.

This commit is contained in:
Dean Herbert 2016-09-01 19:06:09 +09:00
parent cb3dfe094e
commit 9585a9105e

View File

@ -1,6 +1,7 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. //Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using osu.Framework.Framework; using osu.Framework.Framework;
@ -10,6 +11,8 @@ using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.Processing; using osu.Game.Graphics.Processing;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using OpenTK;
using osu.Framework.Graphics;
namespace osu.Game namespace osu.Game
{ {
@ -25,8 +28,7 @@ namespace osu.Game
{ {
base.Load(); base.Load();
Window.Size = new Size(Config.Get<int>(OsuConfig.Width), Config.Get<int>(OsuConfig.Height)); Parent.Size = new Vector2(Config.Get<int>(OsuConfig.Width), Config.Get<int>(OsuConfig.Height));
Window.OnSizeChanged += window_OnSizeChanged;
API = new APIAccess() API = new APIAccess()
{ {
@ -57,10 +59,16 @@ namespace osu.Game
base.Dispose(isDisposing); 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); if (!base.Invalidate(affectsSize, affectsPosition, source)) return false;
Config.Set(OsuConfig.Height, Window.Size.Height);
if (Parent != null)
{
Parent.Width = Config.Set(OsuConfig.Width, ActualSize.X).Value;
Parent.Height = Config.Set(OsuConfig.Height, ActualSize.Y).Value;
}
return true;
} }
} }
} }