Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


fps counter

This topic is 6252 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You have to count the number of frames you draw in a static int for example

static int frames = 0;
static DWORD lastTimeFPS = 0; //time when the last calculation took place
DWORD curTime = timeGetTime();

// Update the scene stats once per second
if( curTime - lastTimeFPS > 1000 )
curFPS = 1000 * frames / (float)(curTime - lastTimeFPS);
lastTimeFPS = curTime;
frames = 0;

You must call this code every time you have finished to redraw a frame, then it will update "curFPS" every second. This you could printf or draw to the screen. The core of the code is the timeGetTime(); You must therefore #include "mmsystem.h" and link with winmm.lib

Sorry for my extraordinary bad english

Edited by - cha Mithrandir on September 8, 2001 11:31:05 AM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!