1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Add ability to make cursor show even during touch input

I completely disagree with this from a UX perspective, but it's come up
so often that I figure we should just let users bone themselves.
This commit is contained in:
Dean Herbert 2022-07-26 14:07:33 +09:00
parent a7598c62ac
commit ee0c67e114
4 changed files with 25 additions and 2 deletions

View File

@ -91,6 +91,7 @@ namespace osu.Game.Configuration
// Input
SetDefault(OsuSetting.MenuCursorSize, 1.0f, 0.5f, 2f, 0.01f);
SetDefault(OsuSetting.GameplayCursorSize, 1.0f, 0.1f, 2f, 0.01f);
SetDefault(OsuSetting.GameplayCursorDuringTouch, false);
SetDefault(OsuSetting.AutoCursorSize, false);
SetDefault(OsuSetting.MouseDisableButtons, false);
@ -292,6 +293,7 @@ namespace osu.Game.Configuration
MenuCursorSize,
GameplayCursorSize,
AutoCursorSize,
GameplayCursorDuringTouch,
DimLevel,
BlurLevel,
LightenDuringBreaks,

View File

@ -3,16 +3,20 @@
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Input;
using osu.Framework.Input.StateChanges;
using osu.Game.Configuration;
namespace osu.Game.Graphics.Cursor
{
/// <summary>
/// A container which provides a <see cref="MenuCursor"/> which can be overridden by hovered <see cref="Drawable"/>s.
/// A container which provides a <see cref="MenuCursor"/>.
/// It also handles cases where a more localised cursor is provided by another component (via <see cref="IProvideCursor"/>).
/// </summary>
public class MenuCursorContainer : Container, IProvideCursor
{
@ -36,12 +40,19 @@ namespace osu.Game.Graphics.Cursor
});
}
private Bindable<bool> showDuringTouch;
private InputManager inputManager;
[Resolved]
private OsuConfigManager config { get; set; }
protected override void LoadComplete()
{
base.LoadComplete();
inputManager = GetContainingInputManager();
showDuringTouch = config.GetBindable<bool>(OsuSetting.GameplayCursorDuringTouch);
}
private IProvideCursor currentTarget;
@ -51,7 +62,7 @@ namespace osu.Game.Graphics.Cursor
base.Update();
var lastMouseSource = inputManager.CurrentState.Mouse.LastSource;
bool hasValidInput = lastMouseSource != null && !(lastMouseSource is ISourcedFromTouch);
bool hasValidInput = lastMouseSource != null && (showDuringTouch.Value || lastMouseSource is not ISourcedFromTouch);
if (!hasValidInput || !CanShowCursor)
{

View File

@ -34,6 +34,11 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString AutoCursorSize => new TranslatableString(getKey(@"auto_cursor_size"), @"Adjust gameplay cursor size based on current beatmap");
/// <summary>
/// "Show gameplay cursor during touch input"
/// </summary>
public static LocalisableString GameplayCursorDuringTouch => new TranslatableString(getKey(@"gameplay_cursor_during_touch"), @"Show gameplay cursor during touch input");
/// <summary>
/// "Beatmap skins"
/// </summary>

View File

@ -32,6 +32,11 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
LabelText = SkinSettingsStrings.AutoCursorSize,
Current = config.GetBindable<bool>(OsuSetting.AutoCursorSize)
},
new SettingsCheckbox
{
LabelText = SkinSettingsStrings.GameplayCursorDuringTouch,
Current = config.GetBindable<bool>(OsuSetting.GameplayCursorDuringTouch)
},
};
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)