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

Add a sample way to have local cursors move beyond their bounds

This commit is contained in:
smoogipoo 2018-01-16 20:35:39 +09:00
parent a5415b99ae
commit 06f0f2093c

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
@ -81,10 +82,14 @@ namespace osu.Game.Tests.Visual
};
returnUserInput();
AddToggleStep("Smooth transitions", b => cursorBoxes.ForEach(box => box.SmoothTransition = b));
testUserCursor();
testLocalCursor();
testUserCursorOverride();
testMultipleLocalCursors();
returnUserInput();
}
/// <summary>
@ -196,9 +201,13 @@ namespace osu.Game.Tests.Visual
private class CustomCursorBox : Container, IProvideCursor
{
public bool SmoothTransition;
public CursorContainer Cursor { get; }
public bool ProvidingUserCursor { get; }
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || SmoothTransition && !ProvidingUserCursor;
private readonly Box background;
public CustomCursorBox(Color4 cursorColour, bool providesUserCursor = true)