//Check the user input and performs the rendering void GameLoop() { int t1, t2; t1 = glutGet(GLUT_ELAPSED_TIME); if (glutGet(GLUT_ELAPSED_TIME) - earthquakeTime > 3000){ earthquake = false; } //Process Input if (input) { Player.Update(keys, mouseX, mouseY); glutWarpPointer(glutGet(GLUT_WINDOW_X) + glutGet(GLUT_WINDOW_WIDTH) / 2, glutGet(GLUT_WINDOW_Y) + glutGet(GLUT_WINDOW_HEIGHT) / 2); input = false; } //Do The Rendering GameRender(); // Frame rate sync: 1000/20 = 50 fps do { t2 = glutGet(GLUT_ELAPSED_TIME); } while (t2 - t1 < 20); }