mirror of
https://github.com/ppy/osu.git
synced 2025-02-07 14:23:21 +08:00
Address screen scale positioning
This commit is contained in:
parent
66eff14d2b
commit
4dd0672aa5
@ -36,7 +36,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
|
|
||||||
private readonly Bindable<Vector2> areaOffset = new Bindable<Vector2>();
|
private readonly Bindable<Vector2> areaOffset = new Bindable<Vector2>();
|
||||||
private readonly Bindable<Vector2> areaSize = new Bindable<Vector2>();
|
private readonly Bindable<Vector2> areaSize = new Bindable<Vector2>();
|
||||||
private readonly Bindable<Vector2> outputSize = new Bindable<Vector2>();
|
private readonly Bindable<Vector2> outputAreaSize = new Bindable<Vector2>();
|
||||||
|
private readonly Bindable<Vector2> outputAreaPosition = new Bindable<Vector2>();
|
||||||
private readonly IBindable<TabletInfo> tablet = new Bindable<TabletInfo>();
|
private readonly IBindable<TabletInfo> tablet = new Bindable<TabletInfo>();
|
||||||
|
|
||||||
private readonly BindableNumber<float> offsetX = new BindableNumber<float> { MinValue = 0 };
|
private readonly BindableNumber<float> offsetX = new BindableNumber<float> { MinValue = 0 };
|
||||||
@ -50,6 +51,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
private Bindable<ScalingMode> scalingMode = null!;
|
private Bindable<ScalingMode> scalingMode = null!;
|
||||||
private Bindable<float> scalingSizeX = null!;
|
private Bindable<float> scalingSizeX = null!;
|
||||||
private Bindable<float> scalingSizeY = null!;
|
private Bindable<float> scalingSizeY = null!;
|
||||||
|
private Bindable<float> scalingPositionX = new Bindable<float>();
|
||||||
|
private Bindable<float> scalingPositionY = new Bindable<float>();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private GameHost host { get; set; }
|
private GameHost host { get; set; }
|
||||||
@ -87,6 +90,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
scalingMode = osuConfig.GetBindable<ScalingMode>(OsuSetting.Scaling);
|
scalingMode = osuConfig.GetBindable<ScalingMode>(OsuSetting.Scaling);
|
||||||
scalingSizeX = osuConfig.GetBindable<float>(OsuSetting.ScalingSizeX);
|
scalingSizeX = osuConfig.GetBindable<float>(OsuSetting.ScalingSizeX);
|
||||||
scalingSizeY = osuConfig.GetBindable<float>(OsuSetting.ScalingSizeY);
|
scalingSizeY = osuConfig.GetBindable<float>(OsuSetting.ScalingSizeY);
|
||||||
|
scalingPositionX = osuConfig.GetBindable<float>(OsuSetting.ScalingPositionX);
|
||||||
|
scalingPositionY = osuConfig.GetBindable<float>(OsuSetting.ScalingPositionY);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -254,7 +259,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
sizeY.Value = val.NewValue.Y;
|
sizeY.Value = val.NewValue.Y;
|
||||||
}), true);
|
}), true);
|
||||||
|
|
||||||
outputSize.BindTo(tabletHandler.OutputSize);
|
outputAreaSize.BindTo(tabletHandler.OutputAreaSize);
|
||||||
|
outputAreaPosition.BindTo(tabletHandler.OutputAreaPosition);
|
||||||
|
|
||||||
sizeX.BindValueChanged(val =>
|
sizeX.BindValueChanged(val =>
|
||||||
{
|
{
|
||||||
@ -280,9 +286,11 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
});
|
});
|
||||||
|
|
||||||
updateScaling();
|
updateScaling();
|
||||||
scalingSizeX.BindValueChanged(size => updateScaling());
|
scalingMode.BindValueChanged(_ => updateScaling());
|
||||||
scalingSizeY.BindValueChanged(size => updateScaling());
|
scalingSizeX.BindValueChanged(_ => updateScaling());
|
||||||
scalingMode.BindValueChanged(mode => updateScaling());
|
scalingSizeY.BindValueChanged(_ => updateScaling());
|
||||||
|
scalingPositionX.BindValueChanged(_ => updateScaling());
|
||||||
|
scalingPositionY.BindValueChanged(_ => updateScaling());
|
||||||
|
|
||||||
tablet.BindTo(tabletHandler.Tablet);
|
tablet.BindTo(tabletHandler.Tablet);
|
||||||
tablet.BindValueChanged(val => Schedule(() =>
|
tablet.BindValueChanged(val => Schedule(() =>
|
||||||
@ -371,17 +379,15 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
|
|
||||||
private void updateScaling()
|
private void updateScaling()
|
||||||
{
|
{
|
||||||
switch (scalingMode.Value)
|
if (scalingMode.Value == ScalingMode.Everything)
|
||||||
{
|
{
|
||||||
case ScalingMode.Everything:
|
outputAreaSize.Value = new Vector2(scalingSizeX.Value, scalingSizeY.Value);
|
||||||
outputSize.Value = new Vector2(
|
outputAreaPosition.Value = new Vector2(scalingPositionX.Value, scalingPositionY.Value);
|
||||||
host.Window.ClientSize.Width * scalingSizeX.Value,
|
}
|
||||||
host.Window.ClientSize.Height * scalingSizeY.Value);
|
else
|
||||||
break;
|
{
|
||||||
|
outputAreaSize.Value = new Vector2(1, 1);
|
||||||
default:
|
outputAreaPosition.Value = new Vector2(0.5f, 0.5f);
|
||||||
outputSize.Value = new Vector2(host.Window.ClientSize.Width, host.Window.ClientSize.Height);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user