🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
How can i program in my engine how many fps i run??
Well, this really isn''t that hard at all. Basically, there are two ways of doing it.
You can either use a timer to keep up with each second and use a counter to keep track of each frame rendered in each second, or you can keep track of the amount of time that it takes to render each frame and just calculate how many frames per second that would be.
Now you just output it however you wish. Personlly, I just set a flag to toggle the display on or off.
If you need some more info on timers and your in Windows, use QueryPerformanceCounter() and QueryPerformanceFrequency(). You should look this up in the docs. (credit here goes to _dot_) You can also find some more information in the post "windows timers and other cheese."
You can either use a timer to keep up with each second and use a counter to keep track of each frame rendered in each second, or you can keep track of the amount of time that it takes to render each frame and just calculate how many frames per second that would be.
Now you just output it however you wish. Personlly, I just set a flag to toggle the display on or off.
If you need some more info on timers and your in Windows, use QueryPerformanceCounter() and QueryPerformanceFrequency(). You should look this up in the docs. (credit here goes to _dot_) You can also find some more information in the post "windows timers and other cheese."
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement