Hello everyone,
Im writing a engine in C# using Visual Studio 2005 (.NET 2.0). Right now I am using QueryPerformanceCounter().
Im not sure exactly how to calculate FPS with QueryPerformanceCounter, but I know how with timeGetTime. Here is my code for timegettime:
I never even tested it, so i dont know if it works. But I was told to use QueryPerformanceCounter instead.
Anyhow, if someone can provide me with a nice example to get me started Id apperciate it =)!
Im writing a engine in C# using Visual Studio 2005 (.NET 2.0). Right now I am using QueryPerformanceCounter().
Im not sure exactly how to calculate FPS with QueryPerformanceCounter, but I know how with timeGetTime. Here is my code for timegettime:
Code:
public struct FPSManager {
public int fps;
public int CurrentTime;
public int LastTime;
public int frames;
}
public void MainLoop() {
while (GameLoop) {
fps.CurrentTime = timeGetTime();
fps.frames++;
Application.DoEvents();
if (fps.CurrentTime - fps.LastTime >= 1000) {
fps.LastTime = fps.CurrentTime;
fps.fps = fps.frames;
fps.frames = 0;
}
}
}
I never even tested it, so i dont know if it works. But I was told to use QueryPerformanceCounter instead.
Anyhow, if someone can provide me with a nice example to get me started Id apperciate it =)!