Hacky FPS reporting (look for lastFPS to see the code involved). It is off by

default, with #if 0, but this way anybody can enable it. When we get "on game"
text, speed, etc it must be moved to the right place (and better code, the
chain of "->" is pretty ugly).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3323 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
mbjornstk 2009-03-30 18:09:33 +00:00
parent a32dd4c5aa
commit 3f4e171872

View File

@ -36,6 +36,11 @@
MainLoop* main_loop = 0;
// FIXME hacky hacky FPS info
int minFPS = 999;
int lastFPS = -1;
int maxFPS = 0;
MainLoop::MainLoop() :
m_abort(false),
m_frame_count(0),
@ -108,8 +113,8 @@ void MainLoop::run()
if (!music_on && !race_manager->raceIsActive())
{
sound_manager->stopMusic(); // stop potential 'left over' music from race
sound_manager->startMusic(stk_config->m_title_music);
music_on = true;
sound_manager->startMusic(stk_config->m_title_music);
music_on = true;
}
network_manager->update(dt);
@ -212,6 +217,26 @@ void MainLoop::run()
#ifdef HAVE_IRRLICHT
if(!user_config->m_bullet_debug)
irr_driver->update(dt);
// FIXME hacky hacky FPS reporting
// it should be moved to the right place when on screen display is done
#if 0
int fps = irr_driver->getDevice()->getVideoDriver()->getFPS();
bool printFPS = false;
if((fps < minFPS) && (fps > 1)) { // First report seems to be always 1, so not useful
minFPS = fps;
printFPS = true;
}
if(fps > maxFPS) {
maxFPS = fps;
printFPS = true;
}
if ((lastFPS+5 <= fps) || (lastFPS-5 >= fps)) {
lastFPS = fps;
printFPS = true;
}
// First print per run will be really silly, as in 999 1 1, just ignore it ;]
if (printFPS) printf("FPS %3d<%3d<%3d\n", minFPS, fps, maxFPS);
#endif
#else
glFlush();
SDL_GL_SwapBuffers();