From 4dd0672aa5a5dd0865497ceae68723e4a2f83b46 Mon Sep 17 00:00:00 2001 From: Daniel Power Date: Mon, 16 Dec 2024 21:04:08 -0330 Subject: [PATCH] Address screen scale positioning --- .../Settings/Sections/Input/TabletSettings.cs | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs index 22e0bc99b9..db670a0939 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs @@ -36,7 +36,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input private readonly Bindable areaOffset = new Bindable(); private readonly Bindable areaSize = new Bindable(); - private readonly Bindable outputSize = new Bindable(); + private readonly Bindable outputAreaSize = new Bindable(); + private readonly Bindable outputAreaPosition = new Bindable(); private readonly IBindable tablet = new Bindable(); private readonly BindableNumber offsetX = new BindableNumber { MinValue = 0 }; @@ -50,6 +51,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input private Bindable scalingMode = null!; private Bindable scalingSizeX = null!; private Bindable scalingSizeY = null!; + private Bindable scalingPositionX = new Bindable(); + private Bindable scalingPositionY = new Bindable(); [Resolved] private GameHost host { get; set; } @@ -87,6 +90,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input scalingMode = osuConfig.GetBindable(OsuSetting.Scaling); scalingSizeX = osuConfig.GetBindable(OsuSetting.ScalingSizeX); scalingSizeY = osuConfig.GetBindable(OsuSetting.ScalingSizeY); + scalingPositionX = osuConfig.GetBindable(OsuSetting.ScalingPositionX); + scalingPositionY = osuConfig.GetBindable(OsuSetting.ScalingPositionY); Children = new Drawable[] { @@ -254,7 +259,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input sizeY.Value = val.NewValue.Y; }), true); - outputSize.BindTo(tabletHandler.OutputSize); + outputAreaSize.BindTo(tabletHandler.OutputAreaSize); + outputAreaPosition.BindTo(tabletHandler.OutputAreaPosition); sizeX.BindValueChanged(val => { @@ -280,9 +286,11 @@ namespace osu.Game.Overlays.Settings.Sections.Input }); updateScaling(); - scalingSizeX.BindValueChanged(size => updateScaling()); - scalingSizeY.BindValueChanged(size => updateScaling()); - scalingMode.BindValueChanged(mode => updateScaling()); + scalingMode.BindValueChanged(_ => updateScaling()); + scalingSizeX.BindValueChanged(_ => updateScaling()); + scalingSizeY.BindValueChanged(_ => updateScaling()); + scalingPositionX.BindValueChanged(_ => updateScaling()); + scalingPositionY.BindValueChanged(_ => updateScaling()); tablet.BindTo(tabletHandler.Tablet); tablet.BindValueChanged(val => Schedule(() => @@ -371,17 +379,15 @@ namespace osu.Game.Overlays.Settings.Sections.Input private void updateScaling() { - switch (scalingMode.Value) + if (scalingMode.Value == ScalingMode.Everything) { - case ScalingMode.Everything: - outputSize.Value = new Vector2( - host.Window.ClientSize.Width * scalingSizeX.Value, - host.Window.ClientSize.Height * scalingSizeY.Value); - break; - - default: - outputSize.Value = new Vector2(host.Window.ClientSize.Width, host.Window.ClientSize.Height); - break; + outputAreaSize.Value = new Vector2(scalingSizeX.Value, scalingSizeY.Value); + outputAreaPosition.Value = new Vector2(scalingPositionX.Value, scalingPositionY.Value); + } + else + { + outputAreaSize.Value = new Vector2(1, 1); + outputAreaPosition.Value = new Vector2(0.5f, 0.5f); } }