mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 13:37:25 +08:00
commit
cee7604a5e
@ -105,6 +105,8 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
Set(OsuSetting.ScalingPositionX, 0.5f, 0f, 1f);
|
Set(OsuSetting.ScalingPositionX, 0.5f, 0f, 1f);
|
||||||
Set(OsuSetting.ScalingPositionY, 0.5f, 0f, 1f);
|
Set(OsuSetting.ScalingPositionY, 0.5f, 0f, 1f);
|
||||||
|
|
||||||
|
Set(OsuSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OsuConfigManager(Storage storage)
|
public OsuConfigManager(Storage storage)
|
||||||
@ -167,6 +169,7 @@ namespace osu.Game.Configuration
|
|||||||
ScalingPositionX,
|
ScalingPositionX,
|
||||||
ScalingPositionY,
|
ScalingPositionY,
|
||||||
ScalingSizeX,
|
ScalingSizeX,
|
||||||
ScalingSizeY
|
ScalingSizeY,
|
||||||
|
UIScale
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,10 +46,37 @@ namespace osu.Game.Graphics.Containers
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
RelativePositionAxes = Axes.Both,
|
RelativePositionAxes = Axes.Both,
|
||||||
CornerRadius = 10,
|
CornerRadius = 10,
|
||||||
Child = content = new DrawSizePreservingFillContainer()
|
Child = content = new ScalingDrawSizePreservingFillContainer(targetMode != ScalingMode.Gameplay)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ScalingDrawSizePreservingFillContainer : DrawSizePreservingFillContainer
|
||||||
|
{
|
||||||
|
private readonly bool applyUIScale;
|
||||||
|
private Bindable<float> uiScale;
|
||||||
|
|
||||||
|
public ScalingDrawSizePreservingFillContainer(bool applyUIScale)
|
||||||
|
{
|
||||||
|
this.applyUIScale = applyUIScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuConfigManager osuConfig)
|
||||||
|
{
|
||||||
|
if (applyUIScale)
|
||||||
|
{
|
||||||
|
uiScale = osuConfig.GetBindable<float>(OsuSetting.UIScale);
|
||||||
|
uiScale.BindValueChanged(scaleChanged, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void scaleChanged(float value)
|
||||||
|
{
|
||||||
|
this.ScaleTo(new Vector2(value), 500, Easing.Out);
|
||||||
|
this.ResizeTo(new Vector2(1 / value), 500, Easing.Out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
|
@ -359,7 +359,10 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
mainContent = new DrawSizePreservingFillContainer(),
|
mainContent = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
overlayContent = new Container { RelativeSizeAxes = Axes.Both, Depth = float.MinValue },
|
overlayContent = new Container { RelativeSizeAxes = Axes.Both, Depth = float.MinValue },
|
||||||
idleTracker = new IdleTracker(6000)
|
idleTracker = new IdleTracker(6000)
|
||||||
});
|
});
|
||||||
|
@ -63,9 +63,16 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y
|
AutoSizeAxes = Axes.Y
|
||||||
},
|
},
|
||||||
|
new SettingsSlider<float, UIScaleSlider>
|
||||||
|
{
|
||||||
|
LabelText = "UI Scaling",
|
||||||
|
TransferValueOnCommit = true,
|
||||||
|
Bindable = osuConfig.GetBindable<float>(OsuSetting.UIScale),
|
||||||
|
KeyboardStep = 0.01f
|
||||||
|
},
|
||||||
new SettingsEnumDropdown<ScalingMode>
|
new SettingsEnumDropdown<ScalingMode>
|
||||||
{
|
{
|
||||||
LabelText = "Scaling",
|
LabelText = "Screen Scaling",
|
||||||
Bindable = osuConfig.GetBindable<ScalingMode>(OsuSetting.Scaling),
|
Bindable = osuConfig.GetBindable<ScalingMode>(OsuSetting.Scaling),
|
||||||
},
|
},
|
||||||
scalingSettings = new FillFlowContainer<SettingsSlider<float>>
|
scalingSettings = new FillFlowContainer<SettingsSlider<float>>
|
||||||
@ -202,6 +209,11 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class UIScaleSlider : OsuSliderBar<float>
|
||||||
|
{
|
||||||
|
public override string TooltipText => base.TooltipText + "x";
|
||||||
|
}
|
||||||
|
|
||||||
private class ResolutionSettingsDropdown : SettingsDropdown<Size>
|
private class ResolutionSettingsDropdown : SettingsDropdown<Size>
|
||||||
{
|
{
|
||||||
protected override OsuDropdown<Size> CreateDropdown() => new ResolutionDropdownControl { Items = Items };
|
protected override OsuDropdown<Size> CreateDropdown() => new ResolutionDropdownControl { Items = Items };
|
||||||
|
Loading…
Reference in New Issue
Block a user