mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 13:32:54 +08:00
Always show counter temporarily when aim FPS changes
This commit is contained in:
parent
705ff06ea5
commit
311a0a3de0
@ -127,6 +127,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private ScheduledDelegate? fadeOutDelegate;
|
private ScheduledDelegate? fadeOutDelegate;
|
||||||
|
|
||||||
|
private double aimDrawFPS;
|
||||||
|
private double aimUpdateFPS;
|
||||||
|
|
||||||
private void displayTemporarily()
|
private void displayTemporarily()
|
||||||
{
|
{
|
||||||
if (!isDisplayed)
|
if (!isDisplayed)
|
||||||
@ -155,13 +158,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
double aimDrawFPS = gameHost.DrawThread.Clock.MaximumUpdateHz;
|
// Handle the case where the window has become inactive or the user changed the
|
||||||
double aimUpdateFPS = gameHost.UpdateThread.Clock.MaximumUpdateHz;
|
// frame limiter (we want to show the FPS as it's changing, even if it isn't an outlier).
|
||||||
|
bool aimRatesChanged = updateAimFPS();
|
||||||
if (!gameHost.UpdateThread.Clock.Throttling)
|
|
||||||
{
|
|
||||||
aimUpdateFPS = aimDrawFPS = gameHost.InputThread.Clock.MaximumUpdateHz;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: this is wrong (elapsed clock time, not actual run time).
|
// TODO: this is wrong (elapsed clock time, not actual run time).
|
||||||
double newUpdateFrameTime = gameHost.UpdateThread.Clock.ElapsedFrameTime;
|
double newUpdateFrameTime = gameHost.UpdateThread.Clock.ElapsedFrameTime;
|
||||||
@ -189,7 +188,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
double displayedUpdateFPS = 1000 / counterUpdateFrameTime.DisplayedCount;
|
double displayedUpdateFPS = 1000 / counterUpdateFrameTime.DisplayedCount;
|
||||||
counterUpdateFrameTime.Colour = getColour(displayedUpdateFPS / aimUpdateFPS);
|
counterUpdateFrameTime.Colour = getColour(displayedUpdateFPS / aimUpdateFPS);
|
||||||
|
|
||||||
bool hasSignificantChanges = hasDrawSpike
|
bool hasSignificantChanges = aimRatesChanged
|
||||||
|
|| hasDrawSpike
|
||||||
|| hasUpdateSpike
|
|| hasUpdateSpike
|
||||||
|| counterDrawFPS.DisplayedCount < aimDrawFPS * 0.8
|
|| counterDrawFPS.DisplayedCount < aimDrawFPS * 0.8
|
||||||
|| displayedUpdateFPS < aimUpdateFPS * 0.8;
|
|| displayedUpdateFPS < aimUpdateFPS * 0.8;
|
||||||
@ -198,6 +198,34 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
displayTemporarily();
|
displayTemporarily();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool updateAimFPS()
|
||||||
|
{
|
||||||
|
if (gameHost.UpdateThread.Clock.Throttling)
|
||||||
|
{
|
||||||
|
double newAimDrawFPS = gameHost.DrawThread.Clock.MaximumUpdateHz;
|
||||||
|
double newAimUpdateFPS = gameHost.UpdateThread.Clock.MaximumUpdateHz;
|
||||||
|
|
||||||
|
if (aimDrawFPS != newAimDrawFPS || aimUpdateFPS != newAimUpdateFPS)
|
||||||
|
{
|
||||||
|
aimDrawFPS = newAimDrawFPS;
|
||||||
|
aimUpdateFPS = newAimUpdateFPS;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double newAimFPS = gameHost.InputThread.Clock.MaximumUpdateHz;
|
||||||
|
|
||||||
|
if (aimDrawFPS != newAimFPS || aimUpdateFPS != newAimFPS)
|
||||||
|
{
|
||||||
|
aimUpdateFPS = aimDrawFPS = newAimFPS;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private ColourInfo getColour(double performanceRatio)
|
private ColourInfo getColour(double performanceRatio)
|
||||||
{
|
{
|
||||||
if (performanceRatio < 0.5f)
|
if (performanceRatio < 0.5f)
|
||||||
|
Loading…
Reference in New Issue
Block a user