7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
10 TITLE="SDL Library Documentation"
11 HREF="index.html"><LINK
14 HREF="time.html"><LINK
17 HREF="sdldelay.html"><LINK
19 TITLE="SDL_RemoveTimer"
20 HREF="sdlremovetimer.html"></HEAD
31 SUMMARY="Header navigation table"
40 >SDL Library Documentation</TH
62 HREF="sdlremovetimer.html"
83 >SDL_AddTimer -- Add a timer which will call a callback after the specified number of milliseconds has
86 CLASS="REFSYNOPSISDIV"
100 CLASS="FUNCSYNOPSISINFO"
101 >#include "SDL.h"</PRE
110 >(Uint32 interval, SDL_NewTimerCallback callback, void *param);</CODE
119 NAME="SDLNEWTIMERCALLBACK"
124 CLASS="PROGRAMLISTING"
125 >/* type definition for the "new" timer callback function */
126 typedef Uint32 (*SDL_NewTimerCallback)(Uint32 interval, void *param);</PRE
136 >Adds a callback function to be run after the specified number of
137 milliseconds has elapsed. The callback function is passed the current
138 timer interval and the user supplied parameter from the
142 > call and returns the next timer
143 interval. If the returned value from the callback is the same as the one
144 passed in, the periodic alarm continues, otherwise a new alarm is
147 >To cancel a currently running timer call
149 HREF="sdlremovetimer.html"
152 timer ID returned from
158 >The timer callback function may run in a different thread than your
159 main program, and so shouldn't call any functions from within itself.
160 You may always call <A
161 HREF="sdlpushevent.html"
165 >The granularity of the timer is platform-dependent, but you should count
166 on it being at least 10 ms as this is the most common number.
168 you request a 16 ms timer, your callback will run approximately 20 ms
169 later on an unloaded system. If you wanted to set a flag signaling
170 a frame update at 30 frames per second (every 33 ms), you might set a
171 timer for 30 ms (see example below).
173 If you use this function, you need to pass <TT
190 >Returns an ID value for the added timer or
194 > if there was an error.</P
205 CLASS="PROGRAMLISTING"
206 >my_timer_id = SDL_AddTimer((33/10)*10, my_callbackfunc, my_callback_param);</PRE
218 HREF="sdlremovetimer.html"
225 HREF="sdlpushevent.html"
237 SUMMARY="Footer navigation table"
266 HREF="sdlremovetimer.html"