osu/osu.Game/Rulesets/UI/Scrolling/Algorithms/ConstantScrollAlgorithm.cs

25 lines
1.0 KiB
C#
Raw Normal View History

2018-09-18 18:23:25 +00:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2018-11-02 10:52:40 +00:00
namespace osu.Game.Rulesets.UI.Scrolling.Algorithms
2018-09-18 18:23:25 +00:00
{
public class ConstantScrollAlgorithm : IScrollAlgorithm
2018-09-18 18:23:25 +00:00
{
public double GetDisplayStartTime(double time, double timeRange) => time - timeRange;
2018-09-18 18:23:25 +00:00
public float GetLength(double startTime, double endTime, double timeRange, float scrollLength)
2018-09-18 18:23:25 +00:00
{
// At the hitobject's end time, the hitobject will be positioned such that its end rests at the origin.
// This results in a negative-position value, and the absolute of it indicates the length of the hitobject.
return -PositionAt(startTime, endTime, timeRange, scrollLength);
2018-09-18 18:23:25 +00:00
}
public float PositionAt(double time, double currentTime, double timeRange, float scrollLength)
=> (float)((time - currentTime) / timeRange * scrollLength);
public void Reset()
{
}
2018-09-18 18:23:25 +00:00
}
}