mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Make cursor test scene more automated
This commit is contained in:
parent
7adfae3784
commit
af09ed1b7f
@ -6,7 +6,9 @@ using System.Collections.Generic;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Testing.Input;
|
||||||
using osu.Game.Rulesets.Osu.UI.Cursor;
|
using osu.Game.Rulesets.Osu.UI.Cursor;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
{
|
{
|
||||||
@ -18,11 +20,35 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
SetContents(() => new OsuCursorContainer
|
SetContents(() => new MovingCursorInputManager
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
Child = new OsuCursorContainer
|
||||||
Masking = true,
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Masking = true,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class MovingCursorInputManager : ManualInputManager
|
||||||
|
{
|
||||||
|
public MovingCursorInputManager()
|
||||||
|
{
|
||||||
|
UseParentInput = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
const double spin_duration = 5000;
|
||||||
|
double currentTime = Time.Current;
|
||||||
|
|
||||||
|
double angle = (currentTime % spin_duration) / spin_duration * 2 * Math.PI;
|
||||||
|
Vector2 rPos = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));
|
||||||
|
|
||||||
|
MoveMouseTo(ToScreenSpace(DrawSize / 2 + DrawSize / 3 * rPos));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user