# HG changeset patch # User nenolod # Date 1130456990 25200 # Node ID 25e69f085ad9bd96317817e3ee9870ed9b10dc70 # Parent 710d8b266d7edf27b94ebd3190fef259b153ff73 [svn] This commit does the following: - Changes out static timings for a dynamic implementation which works via actively detecting how long it takes to render a frame - Cleans up a few warnings. diff -r 710d8b266d7e -r 25e69f085ad9 Visualization/libvisual-proxy/main.c --- a/Visualization/libvisual-proxy/main.c Thu Oct 27 12:54:05 2005 -0700 +++ b/Visualization/libvisual-proxy/main.c Thu Oct 27 16:49:50 2005 -0700 @@ -434,7 +434,7 @@ { visual_running = 1; visual_stopped = 0; - long render_time, now; + static long render_time, now; long frame_length; long idle_time; long frames; @@ -472,6 +472,8 @@ if (SDL_MUSTLOCK (screen) == SDL_TRUE) SDL_UnlockSurface (screen); } + + render_time = SDL_GetTicks(); if (gl_plug == 1) { visual_bin_run (bin); @@ -492,7 +494,11 @@ sdl_draw (screen); } - usleep(10000); + now = SDL_GetTicks(); + idle_time = now - render_time; + + if (idle_time < frame_length) + usleep(frame_length); sdl_event_handle ();