A stealth-based 2D platformer where you don't have to kill anyone unless you want to.
https://www.semicolin.games
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
531 B
23 lines
531 B
using System;
|
|
|
|
namespace SemiColinGames {
|
|
class FpsCounter {
|
|
private double fps = 0;
|
|
private int[] frameTimes = new int[60];
|
|
private int idx = 0;
|
|
|
|
public int Fps {
|
|
get => (int) Math.Ceiling(fps);
|
|
}
|
|
|
|
public void Update() {
|
|
var now = Environment.TickCount; // ms
|
|
if (frameTimes[idx] != 0) {
|
|
var timeElapsed = now - frameTimes[idx];
|
|
fps = 1000.0 * frameTimes.Length / timeElapsed;
|
|
}
|
|
frameTimes[idx] = now;
|
|
idx = (idx + 1) % frameTimes.Length;
|
|
}
|
|
}
|
|
}
|