Skip to main content
gamedev.net
🔒 Locked

testing fps

Started by OoMMMoO Oct 17, 2000 at 1:23 PM 1 replies 150+ views
Original Post
OoMMMoO
OoMMMoO
How do you test hoiw many frames per second your program is running at? like on the demo programs where it shows an animation and in the corner it tells your fps in directx by the way Brendon Edited by - OoMMMoO on 10/17/00 1:24:46 PM
Muzzafarath
Muzzafarath
It's pretty simple really. Every time you finished drawing a frame, you increase a counter (fps_count++). Every second you draw the number in the counter variable to the screen and then reset the counter (fps_count = 0). Of course, you don't _have_ to draw it to the screen, you can do whatever you want with it...

Edited by - Muzzafarath on October 17, 2000 2:47:20 PM
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Tornado
Tornado
Yeah, That''s the way to do it
Here''s some code to do it:

    
int fps=0; // the fps you draw to the screen

int old_fps=0;
DWORD last_time=GetTickCount(); // keep track of the time


// End of main loop comes here


old_fps++;
if (GetTickCount()-last_time >= 1000)
{
fps = old_fps; // give the fps

old_fps = 0;
last_time = GetTickCount();
}





- Goblineye Entertainment
The road to success is always under construction
Goblineye EntertainmentThe road to success is always under construction

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.