1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:43:05 +08:00

Allow switching between latency and menu cursor using IProvideCursor

This commit is contained in:
Salman Ahmed 2022-06-16 19:46:31 +03:00
parent 52538dc708
commit ed6817ae6a
2 changed files with 10 additions and 6 deletions

View File

@ -8,8 +8,10 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics.Cursor;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Screens.Utility.SampleComponents; using osu.Game.Screens.Utility.SampleComponents;
using osuTK.Input; using osuTK.Input;
@ -17,7 +19,7 @@ using osuTK.Input;
namespace osu.Game.Screens.Utility namespace osu.Game.Screens.Utility
{ {
[Cached] [Cached]
public class LatencyArea : CompositeDrawable public class LatencyArea : CompositeDrawable, IProvideCursor
{ {
[Resolved] [Resolved]
private OverlayColourProvider overlayColourProvider { get; set; } = null!; private OverlayColourProvider overlayColourProvider { get; set; } = null!;
@ -36,6 +38,10 @@ namespace osu.Game.Screens.Utility
public readonly Bindable<LatencyVisualMode> VisualMode = new Bindable<LatencyVisualMode>(); public readonly Bindable<LatencyVisualMode> VisualMode = new Bindable<LatencyVisualMode>();
public CursorContainer? Cursor { get; private set; }
public bool ProvidingUserCursor => IsActiveArea.Value;
public LatencyArea(Key key, int? targetFrameRate) public LatencyArea(Key key, int? targetFrameRate)
{ {
this.key = key; this.key = key;
@ -87,7 +93,7 @@ namespace osu.Game.Screens.Utility
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new LatencyCursorContainer Cursor = new LatencyCursorContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
@ -101,7 +107,7 @@ namespace osu.Game.Screens.Utility
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new LatencyCursorContainer Cursor = new LatencyCursorContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
@ -115,7 +121,7 @@ namespace osu.Game.Screens.Utility
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new LatencyCursorContainer Cursor = new LatencyCursorContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },

View File

@ -41,8 +41,6 @@ namespace osu.Game.Screens.Utility
public override bool HideOverlaysOnEnter => true; public override bool HideOverlaysOnEnter => true;
public override bool CursorVisible => mainArea.Count == 0;
public override float BackgroundParallaxAmount => 0; public override float BackgroundParallaxAmount => 0;
private readonly LinkFlowContainer explanatoryText; private readonly LinkFlowContainer explanatoryText;