void IMainGame::run() { if (!init()) return; FPSLimiter limiter; limiter.setMaxFPS(60.0f); m_isRunning = true; while (m_isRunning) { limiter.begin(); inputManager.update(); update(); if (m_isRunning) { draw(); m_fps = limiter.end(); m_window.swapBuffer(); } } }
void App::run() { FPSLimiter fps; fps.setMaxFPS(60.0f); while (state == State::PLAY) { fps.begin(); long rightNowTick = SDL_GetTicks(); _step = (_now == 0 ? 0 : rightNowTick - _now); _now = rightNowTick; processInput(); update(); draw(); SDL_GL_SwapWindow(_window); _fps = fps.end(); } }