I just wanted to have a look in the API reference to find out the syntax
for Timers.
But to my surprise I had to find out that it wasn’t there?!?
Looks like the Doc is not very up to date!?
Maby one should fix this, as maybe other things are missing as well.
Yours, Christian–
Christian Biesinger
Get Paid To Surf: http://www.AdOne.de/startup.php?werber=45130
Hi! I’m a signature virus! Copy me into your signature file to help me
spread!
I just wanted to have a look in the API reference to find out the syntax
for Timers.
But to my surprise I had to find out that it wasn’t there?!?
Looks like the Doc is not very up to date!?
It is up to date, but the timers, endian, and file code are not documented.
The file code API may change in the future. The others are simple enough
that the example code and tutorials and headers should be enough.
Of course, I accept donations of documentation.
-Sam Lantinga (slouken at devolution.com)
Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec
The only timer I know of is SDL_GetTicks () … Just do something like:
Uint8 timer;
timer = SDL_GetTicks();
that will get the current ticks… then you can have a few more variables
to use timers, etc.
No, there is at least one more:
int SDL_SetTimer(Uint32 ms, SDL_TimerCallback callback)
Which defines a Callback function.
None of these two is even mentioned in the API Reference.–
Christian Biesinger
Get Paid To Surf: http://www.AdOne.de/startup.php?werber=45130
Hi! I’m a signature virus! Copy me into your signature file to help me
spread!
The only timer I know of is SDL_GetTicks () … Just do something like:
Uint8 timer;
timer = SDL_GetTicks();
Actually, it’s Uint32, not Uint8.
that will get the current ticks… then you can have a few more variables
to use timers, etc.
There’s also “void SDL_Delay(Uint32 ms)” which pauses the program (thread?)
for ‘ms’ milliseconds. (So use “SDL_Delay(1000);” to pause 1 second.)
Finally, and I haven’t played around with this, there’s “SDL_SetTimer()”.
(Note: To use this, you need to add “SDL_INIT_TIMER” when you call
"SDL_Init()")
It lets you have SDL call a function ever ‘interval’ milliseconds.
(“int SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback)”)