aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 2878c7f..7d87fd6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -292,11 +292,8 @@ int main(int argc, char *argv[]) {
game->frames = 0;
}
- /* Sleep for a bit to avoid hogging the CPU.
- * This is a fudge - ideally this delay would adapt so that the CPU is not hogged when the GPU is the
- * limiting factor, and be zero when the CPU is limiting. I don't know of a sensible way to tell which
- * is the case. */
- if ( !gameopts.no_framerate_limit ) usleep(30000);
+ /* Wait for how long it takes to render the frame at the most recent measurement. */
+ if ( !gameopts.no_framerate_limit ) usleep(game->time_to_render/1000);
}