no more windows??

This commit is contained in:
lewd-alt
2025-05-07 10:45:18 -07:00
parent eecd2a0399
commit 9d89d2cb6a
933 changed files with 408908 additions and 407973 deletions

View File

@@ -1,38 +1,39 @@
using System;
using System.Diagnostics;
namespace _2DGAMELIB;
public class FPS
namespace _2DGAMELIB
{
public Stopwatch sw = new Stopwatch();
public class FPS
{
public Stopwatch sw = new Stopwatch();
private long last_frame;
public double Value;
private long last_frame;
public double Value;
private int count;
private int count;
private double ticks_per_frame;
public FPS(double FPS)
{
Value = FPS;
ticks_per_frame = (double)Stopwatch.Frequency / FPS;
sw.Start();
last_frame = sw.ElapsedTicks;
}
private double ticks_per_frame;
public FPS(double FPS)
{
Value = FPS;
ticks_per_frame = (double)Stopwatch.Frequency / FPS;
sw.Start();
last_frame = sw.ElapsedTicks;
}
public void FPSFixed(Action Action)
{
long current_time = sw.ElapsedTicks;
public void FPSFixed(Action Action)
{
long current_time = sw.ElapsedTicks;
if (current_time - last_frame >= ticks_per_frame)
{
Action();
if (current_time - last_frame >= ticks_per_frame)
{
Action();
Value = (9 * Value + ((double)Stopwatch.Frequency / (sw.ElapsedTicks - last_frame)))/10;
Value = (9 * Value + ((double)Stopwatch.Frequency / (sw.ElapsedTicks - last_frame)))/10;
last_frame = current_time;
}
last_frame = current_time;
}
}
}
}
}