Add user toggle for application of safe areas

This commit is contained in:
Dean Herbert
2022-10-28 13:52:45 +09:00
parent bdc6755ee2
commit f9d2c30c3e
6 changed files with 47 additions and 8 deletions

View File

@ -8,6 +8,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Configuration;
using osu.Game.Overlays.Settings;
using osuTK.Graphics;
@ -24,6 +25,8 @@ namespace osu.Game.Tests.Visual.UserInterface
private readonly Bindable<float> safeAreaPaddingLeft = new BindableFloat { MinValue = 0, MaxValue = 200 };
private readonly Bindable<float> safeAreaPaddingRight = new BindableFloat { MinValue = 0, MaxValue = 200 };
private readonly Bindable<bool> applySafeAreaConsiderations = new Bindable<bool>(true);
protected override void LoadComplete()
{
base.LoadComplete();
@ -84,6 +87,11 @@ namespace osu.Game.Tests.Visual.UserInterface
Current = safeAreaPaddingRight,
LabelText = "Right"
},
new SettingsCheckbox
{
LabelText = "Apply",
Current = applySafeAreaConsiderations,
},
}
}
}
@ -93,6 +101,7 @@ namespace osu.Game.Tests.Visual.UserInterface
safeAreaPaddingBottom.BindValueChanged(_ => updateSafeArea());
safeAreaPaddingLeft.BindValueChanged(_ => updateSafeArea());
safeAreaPaddingRight.BindValueChanged(_ => updateSafeArea());
applySafeAreaConsiderations.BindValueChanged(_ => updateSafeArea());
});
base.SetUpSteps();
@ -107,6 +116,8 @@ namespace osu.Game.Tests.Visual.UserInterface
Left = safeAreaPaddingLeft.Value,
Right = safeAreaPaddingRight.Value,
};
Game.LocalConfig.SetValue(OsuSetting.SafeAreaConsiderations, applySafeAreaConsiderations.Value);
}
[Test]