Show Editor window true framerate in the fps counter widget
This commit is contained in:
@@ -1241,6 +1241,10 @@ namespace FlaxEditor.Viewport
|
||||
|
||||
private class FpsCounter : Control
|
||||
{
|
||||
private int fps;
|
||||
private int accumFrames;
|
||||
private float lastUpdate;
|
||||
|
||||
public FpsCounter(float x, float y)
|
||||
: base(x, y, 64, 32)
|
||||
{
|
||||
@@ -1250,7 +1254,15 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
base.Draw();
|
||||
|
||||
int fps = Engine.FramesPerSecond;
|
||||
accumFrames++;
|
||||
float timeNow = Time.TimeSinceStartup;
|
||||
if (timeNow - lastUpdate >= 1.0f)
|
||||
{
|
||||
fps = accumFrames;
|
||||
lastUpdate = timeNow;
|
||||
accumFrames = 0;
|
||||
}
|
||||
|
||||
Color color = Color.Green;
|
||||
if (fps < 13)
|
||||
color = Color.Red;
|
||||
|
||||
Reference in New Issue
Block a user