mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Add a sample way to have local cursors move beyond their bounds
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// 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;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
@ -81,10 +82,14 @@ namespace osu.Game.Tests.Visual
|
|||||||
};
|
};
|
||||||
|
|
||||||
returnUserInput();
|
returnUserInput();
|
||||||
|
|
||||||
|
AddToggleStep("Smooth transitions", b => cursorBoxes.ForEach(box => box.SmoothTransition = b));
|
||||||
|
|
||||||
testUserCursor();
|
testUserCursor();
|
||||||
testLocalCursor();
|
testLocalCursor();
|
||||||
testUserCursorOverride();
|
testUserCursorOverride();
|
||||||
testMultipleLocalCursors();
|
testMultipleLocalCursors();
|
||||||
|
returnUserInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -196,9 +201,13 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
private class CustomCursorBox : Container, IProvideCursor
|
private class CustomCursorBox : Container, IProvideCursor
|
||||||
{
|
{
|
||||||
|
public bool SmoothTransition;
|
||||||
|
|
||||||
public CursorContainer Cursor { get; }
|
public CursorContainer Cursor { get; }
|
||||||
public bool ProvidingUserCursor { get; }
|
public bool ProvidingUserCursor { get; }
|
||||||
|
|
||||||
|
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || SmoothTransition && !ProvidingUserCursor;
|
||||||
|
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
|
|
||||||
public CustomCursorBox(Color4 cursorColour, bool providesUserCursor = true)
|
public CustomCursorBox(Color4 cursorColour, bool providesUserCursor = true)
|
||||||
|
Reference in New Issue
Block a user