The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_AddTimer
Jack Andrews
Guest

Hi Guys,


I'm using the SDL_PushEvent() technique at https://wiki.libsdl.org/SDL_AddTimer so that my timer is processed on the main thread.


The only problem is that it seems I lose the convenience of changing (or deleting) the timer using the return value of the callback.


How could I write a callback to use SDL_PushEvent() and then get the result of my event loop function to reset the timer interval?


Of course, I could RemoveTimer and AddTimer, but it would be nice to have a more compact solution.


cheers,
jack