diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index e76038d818..cbb7a9fd35 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Drawing; using System.IO; using Newtonsoft.Json; using osu.Framework.Allocation; @@ -27,16 +28,20 @@ namespace osu.Game.Tournament [Cached] private readonly Bindable ruleset = new Bindable(); + private Bindable windowSize; + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { return dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); } [BackgroundDependencyLoader] - private void load(Storage storage) + private void load(Storage storage, FrameworkConfigManager frameworkConfig) { this.storage = storage; + windowSize = frameworkConfig.GetBindable(FrameworkSetting.WindowedSize); + string content = null; if (storage.Exists(bracket_filename)) using (Stream stream = storage.GetStream(bracket_filename, FileAccess.Read, FileMode.Open)) @@ -81,6 +86,18 @@ namespace osu.Game.Tournament MenuCursorContainer.Cursor.Alpha = 0; } + protected override void Update() + { + + base.Update(); + var minWidth = (int)(windowSize.Value.Height / 9f * 16 + 400); + if (windowSize.Value.Width < minWidth) + { + // todo: can be removed after ppy/osu-framework#1975 + windowSize.Value = Host.Window.ClientSize = new Size(minWidth, windowSize.Value.Height); + } + } + protected virtual void SaveChanges() { using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create))