mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 16:12:54 +08:00
Automatic gameplay cursor size
This commit is contained in:
parent
08f980ccae
commit
ca6df533bd
@ -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,
|
||||
|
@ -42,6 +42,9 @@ namespace osu.Game.Graphics.Cursor
|
||||
{
|
||||
private Container cursorContainer;
|
||||
private Bindable<double> cursorScale;
|
||||
private Bindable<bool> 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<double>(OsuConfig.GameplayCursorSize);
|
||||
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)cursorScale);
|
||||
cursorScale.TriggerChange();
|
||||
|
||||
autoCursorScale = config.GetBindable<bool>(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,11 @@ namespace osu.Game.Overlays.Options.Sections
|
||||
LabelText = "Gameplay cursor size",
|
||||
Bindable = config.GetBindable<double>(OsuConfig.GameplayCursorSize)
|
||||
},
|
||||
new OptionCheckbox
|
||||
{
|
||||
LabelText = "Automatic gameplay cursor size",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.AutoCursorSize)
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user