#include // ... static DWORD flNewElapsedTime; flNewElapsedTime = timeGetTime(); // and when all the stuff is done: flFrameRate = (int)(1000/(flNewElapsedTime - flOldElapsedTime)); // And there it is
#include
static DWORD flOldElapsedTime = 1;
static int flFrameRate = 0;
// In the main game loop (before the render/calc/AI):
flOldElapsedTime = flNewElapsedTime;
flNewElapsedTime = timeGetTime();
frame rates
Well, I use timeGetTime to determine the fps and I have heard that alot of other ppl use it to. So I include a snippet of a fps counter
Death is lifes way saying your fired.
December 02, 1999 08:33 AM
You could also use the Performance timer. Which to me, seems more to be a more accurate timer.
QueryPerformanceCounter and QueryPerformanceFrequency should be the only two functions you need.
This has probably been covered before but I couldn't find any previous posts on it..
how to determine the fps in a directX app. do you just have a static counter in your game loop and use windows' timer functions to determine when a second passes, then show the value and reset it to zero? are windows' timer functions very accurate? or how could you accomplish this using GetTickCount() ?
Thanks
------------------
"can't waste the day when the night brings a hearse"
"can't waste the day when the night brings a hearse"
December 08, 1999 05:16 PM
why did you repeat the line..
flNewElapsedTime = timeGetTime(); ??
flNewElapsedTime = timeGetTime(); ??
Do I have to include any .lib files for it to work?
error LNK2001: unresolved external symbol __imp__timeGetTime@0
Debug/blabla.exe : fatal error LNK1120: 1 unresolved externals
error LNK2001: unresolved external symbol __imp__timeGetTime@0
Debug/blabla.exe : fatal error LNK1120: 1 unresolved externals
When you see link errors like this, just do a search in the online help for the function to see what import lib you need. In this case, you''ll find (amoungst other things)
Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
Thanks,
Notwen
Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
Thanks,
Notwen
Notwenwww.xbox.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement