[SDL] Misuse of SDL_Delay?
jimmy at jimmysworld.org
Tue Jan 13 11:22:13 PST 2004
On Tue, 2004-01-13 at 10:59, Abril Nieto wrote:
> But in my short life as SDL fan (I'm a newbie) I have seen several times
> lines like SDL_Delay(1),
> SDL_Delay(5), etc. What for?
> I've also seen SDL_Delay(20-elapsed_time) in order to synchronize blitting
> and 50Hz display scan
> (e.g.in the archives
> http://www.libsdl.org/pipermail/sdl/2003-September/056520.html ), but it
> to me that it could worsen badly the flickering because with elapsed_time=19
> it's equivalent to
> What point am I missing?
A) Some people don't realize that SDL_Delay isn't precise and just never
check. That is, they're making false assumptions.
B) Windows has a smaller timer granularity, so SDL_Delay(5) gives you a
5 ms delay on that platform. Lots and lots and lots of people don't
care about linux.
C) The linux 2.6+ kernel has a smaller timer granularity too... which
means that they might be writing for the future.
C pt2) Games often want to give up control, but as little as possible.
Since the whole SDL_Delay(0) trick will (I've heard) piss off the
scheduler in linux 2.6, the next best thing is to delay 1, take the 10ms
hit for now and recompile when 2.6 is more common.
> Thank you,
> Nieto Abril.
> Tired of spam? Get advanced junk mail protection with MSN 8.
> SDL mailing list
> SDL at libsdl.org
More information about the SDL