1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-30 09:22:54 +08:00
osu-lazer/osu.Game/Screens/Play/OffsetCorrectionClock.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.1 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Timing;
namespace osu.Game.Screens.Play
{
public class OffsetCorrectionClock : FramedOffsetClock
{
private double offset;
public new double Offset
{
get => offset;
set
{
if (value == offset)
return;
offset = value;
updateOffset();
}
}
public double RateAdjustedOffset => base.Offset;
2024-01-18 13:21:02 +08:00
public OffsetCorrectionClock(IClock source)
: base(source)
{
}
public override void ProcessFrame()
{
base.ProcessFrame();
updateOffset();
}
private void updateOffset()
{
2024-01-18 13:21:02 +08:00
// we always want to apply the same real-time offset, so it should be adjusted by the difference in playback rate (from realtime) to achieve this.
base.Offset = Offset * Rate;
}
}
}