This commit is contained in:
hiker 2015-09-29 07:58:24 +10:00
parent 344912ac2a
commit 449e754849
3 changed files with 23 additions and 0 deletions

View File

@ -520,6 +520,9 @@ namespace UserConfigParams
/** True if physics debugging should be enabled. */
PARAM_PREFIX bool m_physics_debug PARAM_DEFAULT( false );
/** True if fps should be printed each frame. */
PARAM_PREFIX bool m_fps_debug PARAM_DEFAULT(false);
/** True if slipstream debugging is activated. */
PARAM_PREFIX bool m_slipstream_debug PARAM_DEFAULT( false );

View File

@ -762,6 +762,8 @@ int handleCmdLine()
UserConfigParams::m_rendering_debug=true;
if(CommandLine::has("--ai-debug"))
AIBaseController::enableDebug();
if (CommandLine::has("--fps-debug"))
UserConfigParams::m_fps_debug = true;
if(UserConfigParams::m_artist_debug_mode)
{

View File

@ -67,6 +67,24 @@ float MainLoop::getLimitedDt()
{
m_curr_time = device->getTimer()->getRealTime();
dt = (float)(m_curr_time - m_prev_time);
const World* const world = World::getWorld();
if (UserConfigParams::m_fps_debug && world)
{
const LinearWorld *lw = dynamic_cast<const LinearWorld*>(world);
if (lw)
{
Log::verbose("fps", "time %f distance %f dt %f fps %f",
lw->getTime(),
lw->getDistanceDownTrackForKart(0),
dt*0.001f, 1000.0f / dt);
}
else
{
Log::verbose("fps", "time %f dt %f fps %f",
world->getTime(), dt*0.001f, 1000.0f / dt);
}
}
// don't allow the game to run slower than a certain amount.
// when the computer can't keep it up, slow down the shown time instead