Allow to config whether to limit game framerate with recordings

This commit is contained in:
Benau 2017-03-22 07:43:00 +08:00
parent 196b2b722c
commit 668b28f632
3 changed files with 9 additions and 2 deletions

View File

@ -563,6 +563,11 @@ namespace UserConfigParams
&m_video_group, "Record video using uncompressed bitmap, notice: this "
"will require a lot of space and fast disk access."));
PARAM_PREFIX BoolUserConfigParam m_limit_game_fps
PARAM_DEFAULT(BoolUserConfigParam(true, "limit_game_fps",
&m_video_group, "Limit game framerate not beyond the fps of recording "
"video."));
PARAM_PREFIX IntUserConfigParam m_record_compression
PARAM_DEFAULT(IntUserConfigParam(90, "record_compression",
&m_video_group, "Specify the compression level of recording video"));

View File

@ -1908,7 +1908,7 @@ void IrrDriver::setRecording(bool val)
if (m_recording == val)
return;
m_recording = val;
if (val == true)
if (m_recording == true)
{
std::string track_name = World::getWorld() != NULL ?
race_manager->getTrackName() : "menu";

View File

@ -117,7 +117,9 @@ float MainLoop::getLimitedDt()
// Throttle fps if more than maximum, which can reduce
// the noise the fan on a graphics card makes.
// When in menus, reduce FPS much, it's not necessary to push to the maximum for plain menus
const int max_fps = (StateManager::get()->throttleFPS() ? 30 : UserConfigParams::m_max_fps);
const int max_fps = (irr_driver->isRecording() &&
UserConfigParams::m_limit_game_fps ? UserConfigParams::m_record_fps :
StateManager::get()->throttleFPS() ? 30 : UserConfigParams::m_max_fps);
if (dt > 0)
{
const int current_fps = (int)(1000.0f / dt);