mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-01 17:47:24 +02:00
* Refactor Controls to default to MouseFilterMode.Ignore * Clean up MouseFilterMode.Ignore from Controls * Fix BoxContainer eating UI clicks * Fix ScrollContainer using the wrong variable * Refactor ContainerButtons to use a StyleClass for formatting instead of typeof * Refactor BaseButton to work when child has MouseFilter.Pass
33 lines
802 B
C#
33 lines
802 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;
|
|
}
|
|
|
|
protected override void Update(FrameEventArgs args)
|
|
{
|
|
if (!VisibleInTree)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var fps = _gameTiming.FramesPerSecondAvg;
|
|
Text = $"FPS: {fps:N1}";
|
|
}
|
|
}
|
|
}
|