Implement half sync in iOS manually

This commit is contained in:
Benau 2019-10-16 16:46:40 +08:00
parent 3a007fd8af
commit f4e7ccccfd
2 changed files with 13 additions and 0 deletions

View File

@ -56,6 +56,11 @@ void override_default_params_for_mobile()
// Enable multitouch race GUI
UserConfigParams::m_multitouch_draw_gui = true;
#ifdef IOS_STK
// Default 30 fps for battery saving
UserConfigParams::m_swap_interval = 2;
#endif
#ifdef ANDROID
// Set multitouch device scale depending on actual screen size
int32_t screen_size = AConfiguration_getScreenSize(global_android_app->config);

View File

@ -205,12 +205,20 @@ float MainLoop::getLimitedDt()
// 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
#ifdef IOS_STK
// For iOS devices seems that they has fps locked at 60 anyway
const int max_fps =
UserConfigParams::m_swap_interval == 2 ? 30 :
UserConfigParams::m_swap_interval == 1 ? 60 :
UserConfigParams::m_max_fps;
#else
const int max_fps = (irr_driver->isRecording() &&
UserConfigParams::m_limit_game_fps )
? UserConfigParams::m_record_fps
: ( StateManager::get()->throttleFPS()
? 60
: UserConfigParams::m_max_fps );
#endif
const int current_fps = (int)(1000.0f / dt);
if (!m_throttle_fps || current_fps <= max_fps ||
ProfileWorld::isProfileMode() ) break;