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

Merge pull request #15031 from Joehuu/ui-scaling-keybind

Add ability to change ui scaling via keyboard
This commit is contained in:
Dean Herbert 2021-10-29 01:48:08 +09:00 committed by GitHub
commit 7ab68525b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,6 +158,8 @@ namespace osu.Game
private Bindable<int> configRuleset;
private Bindable<float> uiScale;
private Bindable<int> configSkin;
private readonly string[] args;
@ -219,6 +221,7 @@ namespace osu.Game
// bind config int to database RulesetInfo
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
uiScale = LocalConfig.GetBindable<float>(OsuSetting.UIScale);
var preferredRuleset = RulesetStore.GetRuleset(configRuleset.Value);
@ -1020,6 +1023,28 @@ namespace osu.Game
return false;
}
public override bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
const float adjustment_increment = 0.05f;
switch (e.Action)
{
case PlatformAction.ZoomIn:
uiScale.Value += adjustment_increment;
return true;
case PlatformAction.ZoomOut:
uiScale.Value -= adjustment_increment;
return true;
case PlatformAction.ZoomDefault:
uiScale.SetDefault();
return true;
}
return base.OnPressed(e);
}
#region Inactive audio dimming
private readonly BindableDouble inactiveVolumeFade = new BindableDouble();