mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-02 18:17:09 +02:00
* Refactor UI system. Deferred updating is used for styling & layout. This fixes the awful time complexity of containers. Removed SetDefaults and Initialize. They were a bad idea alright. * Fix build on .NET Framework.
35 lines
853 B
C#
35 lines
853 B
C#
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Shared.Interfaces.Timing;
|
|
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;
|
|
|
|
MouseFilter = MouseFilterMode.Ignore;
|
|
}
|
|
|
|
protected override void Update(FrameEventArgs args)
|
|
{
|
|
if (!VisibleInTree)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var fps = _gameTiming.FramesPerSecondAvg;
|
|
Text = $"FPS: {fps:N1}";
|
|
}
|
|
}
|
|
}
|