diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index ba19d8592a..8df054712b 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -50,6 +50,7 @@ namespace osu.Game.Configuration Set(OsuConfig.MenuCursorSize, 1.0, 0.5f, 2); Set(OsuConfig.GameplayCursorSize, 1.0, 0.5f, 2); + Set(OsuConfig.AutoCursorSize, false); Set(OsuConfig.MouseDisableButtons, false); Set(OsuConfig.MouseDisableWheel, false); @@ -86,6 +87,7 @@ namespace osu.Game.Configuration Token, MenuCursorSize, GameplayCursorSize, + AutoCursorSize, DimLevel, KeyOverlay, ShowInterface, diff --git a/osu.Game/Graphics/Cursor/GameplayCursor.cs b/osu.Game/Graphics/Cursor/GameplayCursor.cs index 3f699219a4..1ef2ad5910 100644 --- a/osu.Game/Graphics/Cursor/GameplayCursor.cs +++ b/osu.Game/Graphics/Cursor/GameplayCursor.cs @@ -42,6 +42,9 @@ namespace osu.Game.Graphics.Cursor { private Container cursorContainer; private Bindable cursorScale; + private Bindable autoCursorScale; + + private const int scaling_factor = 5; public OsuCursor() { @@ -49,8 +52,8 @@ namespace osu.Game.Graphics.Cursor Size = new Vector2(42); } - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + [BackgroundDependencyLoader(permitNulls:true)] + private void load(OsuConfigManager config, OsuGame game) { Children = new Drawable[] { @@ -117,6 +120,16 @@ namespace osu.Game.Graphics.Cursor cursorScale = config.GetBindable(OsuConfig.GameplayCursorSize); cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)cursorScale); cursorScale.TriggerChange(); + + autoCursorScale = config.GetBindable(OsuConfig.AutoCursorSize); + autoCursorScale.ValueChanged += newScale => + { + if (newScale) + cursorContainer.Scale *= scaling_factor / (game?.Beatmap?.Value.Beatmap.BeatmapInfo.Difficulty.CircleSize ?? scaling_factor); + else + cursorScale.TriggerChange(); + }; + autoCursorScale.TriggerChange(); } } } diff --git a/osu.Game/Overlays/Options/Sections/SkinSection.cs b/osu.Game/Overlays/Options/Sections/SkinSection.cs index b3c225d00c..a3645d03de 100644 --- a/osu.Game/Overlays/Options/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Options/Sections/SkinSection.cs @@ -31,6 +31,11 @@ namespace osu.Game.Overlays.Options.Sections LabelText = "Gameplay cursor size", Bindable = config.GetBindable(OsuConfig.GameplayCursorSize) }, + new OptionCheckbox + { + LabelText = "Automatic gameplay cursor size", + Bindable = config.GetBindable(OsuConfig.AutoCursorSize) + }, }; }