staf
This commit is contained in:
@@ -14,9 +14,12 @@ namespace Game
|
||||
private Label label;
|
||||
|
||||
private Stopwatch stopwatch;
|
||||
private Stopwatch stopwatch2;
|
||||
|
||||
private double updateTimeAvg;
|
||||
private double updateTimeAvg2;
|
||||
private ulong updateTimeCount;
|
||||
private ulong updateTimeCount2;
|
||||
|
||||
public override void OnAwake()
|
||||
{
|
||||
@@ -25,10 +28,20 @@ namespace Game
|
||||
control.HideFlags = HideFlags.None;
|
||||
|
||||
stopwatch = Stopwatch.StartNew();
|
||||
stopwatch2 = Stopwatch.StartNew();
|
||||
}
|
||||
|
||||
public override void OnUpdate()
|
||||
{
|
||||
updateTimeCount2++;
|
||||
double elapsed2 = stopwatch2.Elapsed.TotalSeconds;
|
||||
if (elapsed2 >= updateInterval * 10)
|
||||
{
|
||||
stopwatch2.Restart();
|
||||
updateTimeAvg2 = elapsed2 / updateTimeCount2;
|
||||
updateTimeCount2 = 0;
|
||||
}
|
||||
|
||||
updateTimeCount++;
|
||||
double elapsed = stopwatch.Elapsed.TotalSeconds;
|
||||
if (elapsed >= updateInterval)
|
||||
@@ -52,7 +65,7 @@ namespace Game
|
||||
#endif
|
||||
|
||||
label.Text += $"{triangles} tris\n {drawCalls} drawcalls\n";
|
||||
|
||||
label.Text += $"{(int)Math.Round(1.0f / updateTimeAvg2)}fps2\n";
|
||||
label.Text += $"{(int)Math.Round(1.0f / updateTimeAvg)}fps";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user