1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 02:03:01 +08:00

Improve UI scale on iOS devices

This commit is contained in:
Salman Alshamrani 2025-01-01 01:43:43 -05:00
parent 8196325815
commit c221a0c9f9
3 changed files with 14 additions and 0 deletions

View File

@ -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);

View File

@ -831,6 +831,11 @@ namespace osu.Game
protected virtual UpdateManager CreateUpdateManager() => new UpdateManager();
/// <summary>
/// The base aspect ratio to use in all <see cref="ScalingContainer"/>s.
/// </summary>
protected internal virtual float BaseAspectRatio => 4f / 3f;
protected override Container CreateScalingContainer() => new ScalingContainer(ScalingMode.Everything);
#region Beatmap progression

View File

@ -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();