From 1809c996bbede491ce99aea838122e589f770c3e Mon Sep 17 00:00:00 2001 From: HoLLy Date: Mon, 13 May 2019 12:09:19 +0200 Subject: [PATCH] Use Interpolation.ValueAt instead of manually interpolating FL position. --- osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index c3c1e86c18..084959f775 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -37,7 +37,6 @@ namespace osu.Game.Rulesets.Osu.Mods private class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition { private const double follow_delay = 120; - private double lastPositionUpdate; public OsuFlashlight() { @@ -55,13 +54,8 @@ namespace osu.Game.Rulesets.Osu.Mods var position = FlashlightPosition; var destination = e.MousePosition; - double frameTime = Clock.CurrentTime - lastPositionUpdate; - double interp = Interpolation.ApplyEasing(Easing.Out, MathHelper.Clamp(frameTime / follow_delay, 0, 1)); - FlashlightPosition = new Vector2( - (float)Interpolation.Lerp(position.X, destination.X, interp), - (float)Interpolation.Lerp(position.Y, destination.Y, interp) - ); - lastPositionUpdate = Clock.CurrentTime; + FlashlightPosition = Interpolation.ValueAt(MathHelper.Clamp(Clock.ElapsedFrameTime, 0, follow_delay), position, destination, 0, follow_delay, Easing.Out); + return base.OnMouseMove(e); }