fps counter
You have to count the number of frames you draw in a static int for example
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
static int frames = 0;static DWORD lastTimeFPS = 0; //time when the last calculation took placeDWORD curTime = timeGetTime();++frames;// Update the scene stats once per secondif( 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
quote:Original post by EddieCai
that''s to say, you must manage your fps counter all by yourself, right?
Yes.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement