mirror of
https://github.com/ppy/osu.git
synced 2025-03-04 06:12:57 +08:00
Allow custom MaxCatchUpFrames to be specified
Also adjusts the default to allow for smoother seeking.
This commit is contained in:
parent
66594b7a1b
commit
3bcfc86b9c
@ -103,7 +103,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
checkFrameCount(0);
|
checkFrameCount(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createStabilityContainer() => AddStep("create container", () => mainContainer.Child = new FrameStabilityContainer().WithChild(consumer = new ClockConsumingChild()));
|
private const int max_frames_catchup = 50;
|
||||||
|
|
||||||
|
private void createStabilityContainer(double gameplayStartTime = double.MinValue) => AddStep("create container", () =>
|
||||||
|
mainContainer.Child = new FrameStabilityContainer(gameplayStartTime) { MaxCatchUpFrames = max_frames_catchup }
|
||||||
|
.WithChild(consumer = new ClockConsumingChild()));
|
||||||
|
|
||||||
private void seekManualTo(double time) => AddStep($"seek manual clock to {time}", () => manualClock.CurrentTime = time);
|
private void seekManualTo(double time) => AddStep($"seek manual clock to {time}", () => manualClock.CurrentTime = time);
|
||||||
|
|
||||||
|
@ -19,6 +19,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
{
|
{
|
||||||
private readonly double gameplayStartTime;
|
private readonly double gameplayStartTime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of frames (per parent frame) which can be run in an attempt to catch-up to real-time.
|
||||||
|
/// </summary>
|
||||||
|
public int MaxCatchUpFrames { get; set; } = 5;
|
||||||
|
|
||||||
public FrameStabilityContainer(double gameplayStartTime = double.MinValue)
|
public FrameStabilityContainer(double gameplayStartTime = double.MinValue)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
@ -68,8 +73,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
private bool isAttached => ReplayInputHandler != null;
|
private bool isAttached => ReplayInputHandler != null;
|
||||||
|
|
||||||
private const int max_catch_up_updates_per_frame = 50;
|
|
||||||
|
|
||||||
private const double sixty_frame_time = 1000.0 / 60;
|
private const double sixty_frame_time = 1000.0 / 60;
|
||||||
|
|
||||||
private bool firstConsumption = true;
|
private bool firstConsumption = true;
|
||||||
@ -81,7 +84,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
int loops = 0;
|
int loops = 0;
|
||||||
|
|
||||||
while (validState && requireMoreUpdateLoops && loops++ < max_catch_up_updates_per_frame)
|
while (validState && requireMoreUpdateLoops && loops++ < MaxCatchUpFrames)
|
||||||
{
|
{
|
||||||
updateClock();
|
updateClock();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user