diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index c47aba2f0c..ac76c0546b 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -3,6 +3,7 @@ #nullable disable +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -99,6 +100,10 @@ namespace osu.Game.Graphics.Containers this.applyUIScale = applyUIScale; } + [Resolved(canBeNull: true)] + [CanBeNull] + private OsuGame game { get; set; } + [BackgroundDependencyLoader] private void load(OsuConfigManager osuConfig) { @@ -111,6 +116,7 @@ namespace osu.Game.Graphics.Containers protected override void Update() { + TargetDrawSize = new Vector2(1024, 1024 / (game?.BaseAspectRatio ?? 1f)); Scale = new Vector2(CurrentScale); Size = new Vector2(1 / CurrentScale); diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index c20536a1ec..5227400694 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -831,6 +831,11 @@ namespace osu.Game protected virtual UpdateManager CreateUpdateManager() => new UpdateManager(); + /// + /// The base aspect ratio to use in all s. + /// + protected internal virtual float BaseAspectRatio => 4f / 3f; + protected override Container CreateScalingContainer() => new ScalingContainer(ScalingMode.Everything); #region Beatmap progression diff --git a/osu.iOS/OsuGameIOS.cs b/osu.iOS/OsuGameIOS.cs index a9ca1778a0..b3d9be04a1 100644 --- a/osu.iOS/OsuGameIOS.cs +++ b/osu.iOS/OsuGameIOS.cs @@ -10,6 +10,7 @@ using osu.Framework.Platform; using osu.Game; using osu.Game.Updater; using osu.Game.Utils; +using UIKit; namespace osu.iOS { @@ -19,6 +20,8 @@ namespace osu.iOS public override bool HideUnlicensedContent => true; + protected override float BaseAspectRatio => (float)(UIScreen.MainScreen.Bounds.Width / UIScreen.MainScreen.Bounds.Height); + protected override UpdateManager CreateUpdateManager() => new MobileUpdateNotifier(); protected override BatteryInfo CreateBatteryInfo() => new IOSBatteryInfo();