mirror of
https://github.com/ppy/osu
synced 2024-12-27 01:12:45 +00:00
Make TargetFrameRate
nullable
This commit is contained in:
parent
c625c929e5
commit
613814c26c
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -27,11 +28,11 @@ namespace osu.Game.Screens.Utility
|
||||
|
||||
private readonly Key key;
|
||||
|
||||
public readonly int TargetFrameRate;
|
||||
public readonly int? TargetFrameRate;
|
||||
|
||||
public readonly BindableBool IsActiveArea = new BindableBool();
|
||||
|
||||
public LatencyArea(Key key, int targetFrameRate)
|
||||
public LatencyArea(Key key, int? targetFrameRate)
|
||||
{
|
||||
this.key = key;
|
||||
TargetFrameRate = targetFrameRate;
|
||||
@ -94,7 +95,7 @@ namespace osu.Game.Screens.Utility
|
||||
public override bool UpdateSubTree()
|
||||
{
|
||||
double elapsed = Clock.CurrentTime - lastFrameTime;
|
||||
if (TargetFrameRate > 0 && elapsed < 1000.0 / TargetFrameRate)
|
||||
if (TargetFrameRate.HasValue && elapsed < 1000.0 / TargetFrameRate)
|
||||
return false;
|
||||
|
||||
lastFrameTime = Clock.CurrentTime;
|
||||
|
@ -358,13 +358,13 @@ Do whatever you need to try and perceive the difference in latency, then choose
|
||||
|
||||
mainArea.AddRange(new[]
|
||||
{
|
||||
new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficultyLevel) : 0)
|
||||
new LatencyArea(Key.Number1, betterSide == 1 ? mapDifficultyToTargetFrameRate(difficultyLevel) : (int?)null)
|
||||
{
|
||||
Width = 0.5f,
|
||||
IsActiveArea = { Value = true },
|
||||
ReportUserBest = () => recordResult(betterSide == 0),
|
||||
},
|
||||
new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficultyLevel) : 0)
|
||||
new LatencyArea(Key.Number2, betterSide == 0 ? mapDifficultyToTargetFrameRate(difficultyLevel) : (int?)null)
|
||||
{
|
||||
Width = 0.5f,
|
||||
Anchor = Anchor.TopRight,
|
||||
|
Loading…
Reference in New Issue
Block a user