2018-04-13 17:19:50 +08: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 18:52:40 +08:00
|
|
|
|
namespace osu.Game.Rulesets.UI.Scrolling.Algorithms
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-11-02 18:51:34 +08:00
|
|
|
|
public interface IScrollAlgorithm
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-10-30 17:14:11 +08:00
|
|
|
|
/// <summary>
|
2018-10-30 17:33:24 +08:00
|
|
|
|
/// Given a point in time, computes the time at which it enters the time range.
|
2018-10-30 17:14:11 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
2018-10-30 17:33:24 +08:00
|
|
|
|
/// E.g. For a constant time range of 5000ms, the time at which t=7000ms enters the time range is 2000ms.
|
2018-10-30 17:14:11 +08:00
|
|
|
|
/// </remarks>
|
2018-10-30 17:33:24 +08:00
|
|
|
|
/// <param name="time">The point in time.</param>
|
|
|
|
|
/// <param name="timeRange">The amount of visible time.</param>
|
|
|
|
|
/// <returns>The time at which <paramref name="time"/> enters <see cref="timeRange"/>.</returns>
|
|
|
|
|
double GetDisplayStartTime(double time, double timeRange);
|
2018-10-30 16:31:43 +08:00
|
|
|
|
|
2018-10-30 17:14:11 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Computes the spatial length within a start and end time.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="startTime">The start time.</param>
|
|
|
|
|
/// <param name="endTime">The end time.</param>
|
2018-10-30 17:33:24 +08:00
|
|
|
|
/// <param name="timeRange">The amount of visible time.</param>
|
|
|
|
|
/// <param name="scrollLength">The absolute spatial length through <see cref="timeRange"/>.</param>
|
2018-10-30 17:14:11 +08:00
|
|
|
|
/// <returns>The absolute spatial length.</returns>
|
2018-10-30 17:33:24 +08:00
|
|
|
|
float GetLength(double startTime, double endTime, double timeRange, float scrollLength);
|
2018-10-30 16:31:43 +08:00
|
|
|
|
|
2018-10-30 17:14:11 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Given the current time, computes the spatial position of a point in time.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="time">The time to compute the spatial position of.</param>
|
|
|
|
|
/// <param name="currentTime">The current time.</param>
|
2018-10-30 17:33:24 +08:00
|
|
|
|
/// <param name="timeRange">The amount of visible time.</param>
|
|
|
|
|
/// <param name="scrollLength">The absolute spatial length through <see cref="timeRange"/>.</param>
|
2018-10-30 17:14:11 +08:00
|
|
|
|
/// <returns>The absolute spatial position.</returns>
|
2018-10-30 17:33:24 +08:00
|
|
|
|
float PositionAt(double time, double currentTime, double timeRange, float scrollLength);
|
|
|
|
|
|
2018-11-09 18:55:48 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Computes the time which brings a point to a provided spatial position given the current time.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="position">The absolute spatial position.</param>
|
|
|
|
|
/// <param name="currentTime">The current time.</param>
|
|
|
|
|
/// <param name="timeRange">The amount of visible time.</param>
|
|
|
|
|
/// <param name="scrollLength">The absolute spatial length through <see cref="timeRange"/>.</param>
|
|
|
|
|
/// <returns>The time at which <see cref="PositionAt(t)"/> == <paramref name="position"/>.</returns>
|
|
|
|
|
double TimeAt(float position, double currentTime, double timeRange, float scrollLength);
|
|
|
|
|
|
2018-10-30 17:33:24 +08:00
|
|
|
|
/// <summary>
|
2018-11-02 18:51:34 +08:00
|
|
|
|
/// Resets this <see cref="IScrollAlgorithm"/> to a default state.
|
2018-10-30 17:33:24 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
void Reset();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|