Added some vars and funcs for testing. Added more fair fps counter and frame counter

This commit is contained in:
Absolutely disgusting
2026-03-07 11:27:29 +04:00
parent c88038e38a
commit d982bc836a
6 changed files with 201 additions and 70 deletions

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace _2DGAMELIB
{
internal class FrameTimeCounter
{
private readonly Stopwatch sw = Stopwatch.StartNew();
private long lastTicks;
public double FrameMs { get; private set; }
public void Frame()
{
long now = sw.ElapsedTicks;
if (lastTicks != 0)
{
FrameMs = (now - lastTicks) * 1000.0 / Stopwatch.Frequency;
}
lastTicks = now;
}
}
}