1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Merge pull request #12447 from smoogipoo/fix-non-60fps-recording

Record every 60fps interval
This commit is contained in:
Dean Herbert 2021-04-19 23:26:58 +09:00 committed by GitHub
commit fc41ad65f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -118,8 +118,8 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestBasic()
{
AddStep("move to center", () => InputManager.MoveMouseTo(recordingManager.ScreenSpaceDrawQuad.Centre));
AddUntilStep("one frame recorded", () => replay.Frames.Count == 1);
AddAssert("position matches", () => playbackManager.ChildrenOfType<Box>().First().Position == recordingManager.ChildrenOfType<Box>().First().Position);
AddUntilStep("at least one frame recorded", () => replay.Frames.Count > 0);
AddUntilStep("position matches", () => playbackManager.ChildrenOfType<Box>().First().Position == recordingManager.ChildrenOfType<Box>().First().Position);
}
[Test]
@ -139,14 +139,16 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestLimitedFrameRate()
{
ScheduledDelegate moveFunction = null;
int initialFrameCount = 0;
AddStep("lower rate", () => recorder.RecordFrameRate = 2);
AddStep("count frames", () => initialFrameCount = replay.Frames.Count);
AddStep("move to center", () => InputManager.MoveMouseTo(recordingManager.ScreenSpaceDrawQuad.Centre));
AddStep("much move", () => moveFunction = Scheduler.AddDelayed(() =>
InputManager.MoveMouseTo(InputManager.CurrentState.Mouse.Position + new Vector2(-1, 0)), 10, true));
AddWaitStep("move", 10);
AddStep("stop move", () => moveFunction.Cancel());
AddAssert("less than 10 frames recorded", () => replay.Frames.Count < 10);
AddAssert("less than 10 frames recorded", () => replay.Frames.Count - initialFrameCount < 10);
}
[Test]

View File

@ -58,6 +58,12 @@ namespace osu.Game.Rulesets.UI
spectatorStreaming?.EndPlaying();
}
protected override void Update()
{
base.Update();
recordFrame(false);
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
recordFrame(false);