int CGameStartup::Update(bool haveFocus, unsigned int updateFlags) { #if defined(JOBMANAGER_SUPPORT_PROFILING) gEnv->GetJobManager()->SetFrameStartTime(gEnv->pTimer->GetAsyncTime()); #endif int returnCode = 0; if (gEnv->pConsole) { #if CRY_PLATFORM_WINDOWS if(gEnv && gEnv->pRenderer && gEnv->pRenderer->GetHWND()) { bool focus = (::GetFocus() == gEnv->pRenderer->GetHWND()); static bool focused = focus; if (focus != focused) { if (GetISystem()->GetISystemEventDispatcher()) { GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_CHANGE_FOCUS, focus, 0); } focused = focus; } } #endif } if (m_pGame) { returnCode = m_pGame->Update(haveFocus, updateFlags); } if (!m_fullScreenCVarSetup && gEnv->pConsole) { ICVar *pVar = gEnv->pConsole->GetCVar("r_Fullscreen"); if (pVar) { pVar->SetOnChangeCallback(FullScreenCVarChanged); m_fullScreenCVarSetup = true; } } #if ENABLE_AUTO_TESTER s_autoTesterSingleton.Update(); #endif return returnCode; }
int CGameStartup::Update(bool haveFocus, unsigned int updateFlags) { #if defined(JOBMANAGER_SUPPORT_PROFILING) gEnv->GetJobManager()->SetFrameStartTime(gEnv->pTimer->GetAsyncTime()); #endif int returnCode = 0; if (gEnv && gEnv->pSystem && gEnv->pConsole) { #ifdef WIN32 if(gEnv && gEnv->pRenderer && gEnv->pRenderer->GetHWND()) { bool focus = (::GetFocus() == gEnv->pRenderer->GetHWND()); static bool focused = focus; if (focus != focused) { if(gEnv->pSystem->GetISystemEventDispatcher()) { gEnv->pSystem->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_CHANGE_FOCUS, focus, 0); } focused = focus; } } #endif } // update the game if (m_pMod) { returnCode = m_pMod->Update(haveFocus, updateFlags); } #if defined(ENABLE_STATS_AGENT) CStatsAgent::Update(); #endif // ghetto fullscreen detection, because renderer does not provide any kind of listener if (gEnv && gEnv->pSystem && gEnv->pConsole) { ICVar *pVar = gEnv->pConsole->GetCVar("r_Fullscreen"); if (pVar) { static int fullscreen = pVar->GetIVal(); if (fullscreen != pVar->GetIVal()) { if(gEnv->pSystem->GetISystemEventDispatcher()) { gEnv->pSystem->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_TOGGLE_FULLSCREEN, pVar->GetIVal(), 0); } fullscreen = pVar->GetIVal(); } } } s_autoTesterSingleton.Update(); GCOV_FLUSH_UPDATE; return returnCode; }
int CGameStartup::Update(bool haveFocus, unsigned int updateFlags) { CRYPROFILE_SCOPE_PROFILE_MARKER("MT: MainLoop"); #if defined(JOBMANAGER_SUPPORT_PROFILING) gEnv->GetJobManager()->SetFrameStartTime(gEnv->pTimer->GetAsyncTime()); #endif int returnCode = 0; if (gEnv && gEnv->pSystem && gEnv->pConsole) { #ifdef WIN32 if(gEnv && gEnv->pRenderer && gEnv->pRenderer->GetHWND()) { bool focus = (::GetFocus() == gEnv->pRenderer->GetHWND()); static bool focused = focus; if (focus != focused) { if(gEnv->pSystem->GetISystemEventDispatcher()) { gEnv->pSystem->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_CHANGE_FOCUS, focus, 0); } focused = focus; } } #endif } // update the game if (m_pMod) { returnCode = m_pMod->Update(haveFocus, updateFlags); } #if defined(ENABLE_STATS_AGENT) CStatsAgent::Update(); #endif #if defined(JOBMANAGER_SUPPORT_FRAMEPROFILER) // Update Backend profilers uint32 timeSample = JobManager::IWorkerBackEndProfiler::GetTimeSample(); assert(gEnv); PREFAST_ASSUME(gEnv); const JobManager::IBackend * const __restrict pBackends[] = { gEnv->GetJobManager()->GetBackEnd(JobManager::eBET_Thread), gEnv->GetJobManager()->GetBackEnd(JobManager::eBET_Blocking), }; for(int i=0; i<sizeof(pBackends)/sizeof(pBackends[0]); ++i) { if(pBackends[i]) { JobManager::IWorkerBackEndProfiler* pWorkerProfiler = pBackends[i]->GetBackEndWorkerProfiler(); pWorkerProfiler->Update(timeSample); } } #endif // ghetto fullscreen detection, because renderer does not provide any kind of listener if (!m_fullScreenCVarSetup && gEnv && gEnv->pSystem && gEnv->pConsole) { ICVar *pVar = gEnv->pConsole->GetCVar("r_Fullscreen"); if (pVar) { pVar->SetOnChangeCallback(FullScreenCVarChanged); m_fullScreenCVarSetup = true; } } #if ENABLE_AUTO_TESTER s_autoTesterSingleton.Update(); #endif GCOV_FLUSH_UPDATE; return returnCode; }