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
547 B

  1. using System;
  2. namespace SemiColinGames {
  3. public class FpsCounter {
  4. private readonly int[] frameTimes = new int[60];
  5. private double fps = 0;
  6. private int idx = 0;
  7. public int Fps {
  8. get => (int) Math.Ceiling(fps);
  9. }
  10. public void Update() {
  11. var now = Environment.TickCount; // ms
  12. if (frameTimes[idx] != 0) {
  13. var timeElapsed = now - frameTimes[idx];
  14. fps = 1000.0 * frameTimes.Length / timeElapsed;
  15. }
  16. frameTimes[idx] = now;
  17. idx = (idx + 1) % frameTimes.Length;
  18. }
  19. }
  20. }