Advertisement

FPS-Counter

Started by February 05, 2003 07:32 AM
12 comments, last by not yet 21 years, 5 months ago
if you are satisfied with windowed mode, you can set the fps
as the caption. Other methods are more complicated. You should
try some NEHE tutorials about fonts.

char s[50];
sprintf(s,"FPS %f",fps); // fps is float
SetWindowText(hwnd,s); // hwnd is your window handle
thx its seems to work!
is there an easy way to control if the fps is correct?
Advertisement
i don''t think. You just have to compare it with other results,
which you believe are correct ;-)
I found this solution which I added to the end of my render() function.



frames++;
timeThisFrame=(int)time.GetTime()/1000;

if(timeThisFrame-timeLastFrame)
{
fps=frames;
frames=0;
}
timeLastFrame=(int)time.GetTime()/1000;

it is fairly simple and seems to work very well... then you just print the value of fps to the screen. it´ll show how many frames you had during the last second
--------------------------------------------------------------What's the problem? I don't got a problem, I got fuckin' problems! plurum!-Tim Roth, Four Rooms

This topic is closed to new replies.

Advertisement