summaryrefslogtreecommitdiff
path: root/render_sdl.c
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2013-05-15 22:37:25 -0700
committerMike Pavone <pavone@retrodev.com>2013-05-15 22:37:25 -0700
commitf0460d04b948942c369592baf0160de5d9bf621e (patch)
treed65bff414fe2b95efe428fc7650d9e0bf2700a24 /render_sdl.c
parent3e9473a73d17bb3b71551c8eb053e8288eceb713 (diff)
Re-enable frame limit, but add a command line flag to disable it
Diffstat (limited to 'render_sdl.c')
-rw-r--r--render_sdl.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/render_sdl.c b/render_sdl.c
index a40887f..f71b929 100644
--- a/render_sdl.c
+++ b/render_sdl.c
@@ -232,7 +232,7 @@ void render_wait_quit(vdp_context * context)
#define MIN_DELAY 5
uint32_t frame_counter = 0;
uint32_t start = 0;
-int wait_render_frame(vdp_context * context)
+int wait_render_frame(vdp_context * context, int frame_limit)
{
FILE * outfile;
SDL_Event event;
@@ -358,18 +358,20 @@ int wait_render_frame(vdp_context * context)
exit(0);
}
}
- //TODO: Adjust frame delay so we actually get 60 FPS rather than 62.5 FPS
- /*uint32_t current = SDL_GetTicks();
- uint32_t desired = last_frame + FRAME_DELAY;
- if (current < desired) {
- uint32_t delay = last_frame + FRAME_DELAY - current;
- //TODO: Calculate MIN_DELAY at runtime
- if (delay > MIN_DELAY) {
- SDL_Delay((delay/MIN_DELAY)*MIN_DELAY);
- }
- while ((desired) >= SDL_GetTicks()) {
+ if (frame_limit) {
+ //TODO: Adjust frame delay so we actually get 60 FPS rather than 62.5 FPS
+ uint32_t current = SDL_GetTicks();
+ uint32_t desired = last_frame + FRAME_DELAY;
+ if (current < desired) {
+ uint32_t delay = last_frame + FRAME_DELAY - current;
+ //TODO: Calculate MIN_DELAY at runtime
+ if (delay > MIN_DELAY) {
+ SDL_Delay((delay/MIN_DELAY)*MIN_DELAY);
+ }
+ while ((desired) >= SDL_GetTicks()) {
+ }
}
- }*/
+ }
render_context(context);