Files
RobustToolbox/Robust.Client/UserInterface/CustomControls/FpsCounter.cs
T
AcruidandGitHub 2183cd7ca1 Massive Namespace Cleanup (#1544)
* Removed the Interfaces folder.
* All objects inside the GameObjects subfolders are now in the GameObjects namespace.
* Added a Resharper DotSettings file to mark the GameObjects subfolders as not providing namespaces.
* Simplified Robust.client.Graphics namespace.
* Automated remove redundant using statements.
2021-02-10 23:27:19 -08:00

32 lines
763 B
C#

using Robust.Client.UserInterface.Controls;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
namespace Robust.Client.UserInterface.CustomControls
{
internal sealed class FpsCounter : Label
{
private readonly IGameTiming _gameTiming;
public FpsCounter(IGameTiming gameTiming)
{
_gameTiming = gameTiming;
FontColorShadowOverride = Color.Black;
ShadowOffsetXOverride = 1;
ShadowOffsetYOverride = 1;
}
protected override void Update(FrameEventArgs args)
{
if (!VisibleInTree)
{
return;
}
var fps = _gameTiming.FramesPerSecondAvg;
Text = $"FPS: {fps:N1}";
}
}
}