Only wait as long as necessary for the current frame in the main loop