mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:52:55 +08:00
Merge pull request #12447 from smoogipoo/fix-non-60fps-recording
Record every 60fps interval
This commit is contained in:
commit
fc41ad65f8
@ -118,8 +118,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
public void TestBasic()
|
public void TestBasic()
|
||||||
{
|
{
|
||||||
AddStep("move to center", () => InputManager.MoveMouseTo(recordingManager.ScreenSpaceDrawQuad.Centre));
|
AddStep("move to center", () => InputManager.MoveMouseTo(recordingManager.ScreenSpaceDrawQuad.Centre));
|
||||||
AddUntilStep("one frame recorded", () => replay.Frames.Count == 1);
|
AddUntilStep("at least one frame recorded", () => replay.Frames.Count > 0);
|
||||||
AddAssert("position matches", () => playbackManager.ChildrenOfType<Box>().First().Position == recordingManager.ChildrenOfType<Box>().First().Position);
|
AddUntilStep("position matches", () => playbackManager.ChildrenOfType<Box>().First().Position == recordingManager.ChildrenOfType<Box>().First().Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -139,14 +139,16 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
public void TestLimitedFrameRate()
|
public void TestLimitedFrameRate()
|
||||||
{
|
{
|
||||||
ScheduledDelegate moveFunction = null;
|
ScheduledDelegate moveFunction = null;
|
||||||
|
int initialFrameCount = 0;
|
||||||
|
|
||||||
AddStep("lower rate", () => recorder.RecordFrameRate = 2);
|
AddStep("lower rate", () => recorder.RecordFrameRate = 2);
|
||||||
|
AddStep("count frames", () => initialFrameCount = replay.Frames.Count);
|
||||||
AddStep("move to center", () => InputManager.MoveMouseTo(recordingManager.ScreenSpaceDrawQuad.Centre));
|
AddStep("move to center", () => InputManager.MoveMouseTo(recordingManager.ScreenSpaceDrawQuad.Centre));
|
||||||
AddStep("much move", () => moveFunction = Scheduler.AddDelayed(() =>
|
AddStep("much move", () => moveFunction = Scheduler.AddDelayed(() =>
|
||||||
InputManager.MoveMouseTo(InputManager.CurrentState.Mouse.Position + new Vector2(-1, 0)), 10, true));
|
InputManager.MoveMouseTo(InputManager.CurrentState.Mouse.Position + new Vector2(-1, 0)), 10, true));
|
||||||
AddWaitStep("move", 10);
|
AddWaitStep("move", 10);
|
||||||
AddStep("stop move", () => moveFunction.Cancel());
|
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]
|
[Test]
|
||||||
|
@ -58,6 +58,12 @@ namespace osu.Game.Rulesets.UI
|
|||||||
spectatorStreaming?.EndPlaying();
|
spectatorStreaming?.EndPlaying();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
recordFrame(false);
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||||
{
|
{
|
||||||
recordFrame(false);
|
recordFrame(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user