mirror of
https://github.com/ppy/osu.git
synced 2025-01-18 05:42:56 +08:00
Improve UI scale on iOS devices
This commit is contained in:
parent
8196325815
commit
c221a0c9f9
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user