Original Post
Hi there! Anybody out there who made a MFC gameloop. My games jerks every few milliseconds / seconds... Here is the code of the application RUN() method: //////////////////////////////////////////////////////////////////////////// int cl_BdGameApp::Run() { MSG msg; // message while(1) { if(m_shutDown) { // user wants to end the game or an error occured ExitInstance(); return 0; } if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE)) { if(GetMessage(&msg,NULL,0,0) == FALSE) { // there was a WM_QUIT message ExitInstance(); return msg.wParam; } // WM_KEYUP if(msg.message == WM_KEYUP && (msg.wParam == VK_ESCAPE || msg.wParam == VK_F4)) { switch(msg.wParam) { case VK_ESCAPE: // quit app PostQuitMessage(0); break; case VK_F4: // toggle fullscreen m_pGame->ToggleFullscreen(); break; } } else { TranslateMessage(&msg); DispatchMessage(&msg); } } else { if(m_pGameWnd->IsActive()) { m_pGame->Activate(); if(m_pGameWnd->MustRedraw()) { m_pGame->Restore(); // we've to redraw the screen - in cause // of resizing, inactivity... m_pGameWnd->SetRedrawScreen(false); } // draw next frame of the game float timeDiff = m_pGame->GetTimer()->GetFrameTime(); if(!m_pGame->UpdateFrame( timeDiff )) AfxGetMainWnd()->PostMessage(WM_CLOSE,0,0); m_fps = 1.0 / timeDiff; #ifdef _DEBUG TRACE1("m_fps: %d\n",m_fps); #endif } else { m_pGame->Pause(); WaitMessage(); } } } } ////////////////////////////////////////////////////////////////////////////// Anybody an ides what's wrong with it?! Thx 4 ur answers!