[SDL] Increment after time

Alan Wolfe Atrix2 at cox.net
Fri Sep 22 21:34:47 PDT 2006

There is a function called SDL_GetTicks() which returns a number of
milliseconds that sdl has been running (I think that's what it measures but
am not 100% sure).


You can call that function to get the number of milliseconds of when your
program starts up and then you can check in your game loop to see if
SDL_GetTicks() is 5000 greater than your first measurement (5000 miliseconds
= 5 seconds), if it is then you can increment your variable or whatever you
want to do after 5 seconds.



From: sdl-bounces+atrix2=cox.net at libsdl.org
[mailto:sdl-bounces+atrix2=cox.net at libsdl.org] On Behalf Of Sahan
Sent: Friday, September 22, 2006 9:32 PM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: [SDL] Increment after time


My game has lots of bugs at the moment :(

The main problem I have right now is that I want the variable area,
initialized to 0 globally, to be incremented after five seconds.

Any idea how I would do this?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060922/45496e8d/attachment-0008.htm>

More information about the SDL mailing list