1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 10:53:21 +08:00

Sync cursor trail rotation with the cursor

This commit is contained in:
Andrei Zavatski 2025-01-14 22:51:17 +03:00
parent 208824e9f4
commit 7a6355d7cf
2 changed files with 9 additions and 2 deletions

View File

@ -11,6 +11,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{
public partial class LegacyCursor : SkinnableCursor
{
public static readonly int REVOLUTION_DURATION = 10000;
private const float pressed_scale = 1.3f;
private const float released_scale = 1f;
@ -52,7 +54,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
protected override void LoadComplete()
{
if (spin)
ExpandTarget.Spin(10000, RotationDirection.Clockwise);
ExpandTarget.Spin(REVOLUTION_DURATION, RotationDirection.Clockwise);
}
public override void Expand()

View File

@ -18,6 +18,7 @@ using osu.Framework.Graphics.Visualisation;
using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Framework.Timing;
using osu.Game.Rulesets.Osu.Skinning.Legacy;
using osuTK;
using osuTK.Graphics;
using osuTK.Graphics.ES30;
@ -79,9 +80,12 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
shader = shaders.Load(@"CursorTrail", FragmentShaderDescriptor.TEXTURE);
}
private double loadCompleteTime;
protected override void LoadComplete()
{
base.LoadComplete();
loadCompleteTime = Parent!.Clock.CurrentTime; // using parent's clock since our is overridden
resetTime();
}
@ -241,7 +245,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
texture = Source.texture;
time = Source.time;
fadeExponent = Source.FadeExponent;
angle = Source.Spin ? time / 10 : 0;
// The goal is to sync trail rotation with the cursor. Cursor uses spin transform which starts rotation at LoadComplete time.
angle = Source.Spin ? (float)((Source.Parent!.Clock.CurrentTime - Source.loadCompleteTime) * 2 * Math.PI / LegacyCursor.REVOLUTION_DURATION) : 0;
originPosition = Vector2.Zero;