-
FPS 구하기 ( Frame Per Second )랭귀지/API 2008. 11. 17. 12:29
void Framework::UpdateFPS() { static DWORD FrameCnt = 0; static float TimeElapsed = 0; static DWORD lastTime = timeGetTime(); DWORD currTime = timeGetTime(); float timeDelta = (currTime - lastTime)*0.001f; FrameCnt++; TimeElapsed += timeDelta; if(TimeElapsed >= 1.0f) { m_fFPS = (float)FrameCnt / TimeElapsed; TimeElapsed = 0.0f; FrameCnt = 0; } lastTime = currTime; }