home *** CD-ROM | disk | FTP | other *** search
- <!-- manual page source format generated by PolyglotMan v3.0.8+X.Org, -->
- <!-- available at http://polyglotman.sourceforge.net/ -->
-
- <html>
- <head>
- <title>"SDL_SetTimer"("3") manual page</title>
- </head>
- <body bgcolor='#efefef' text='black' link='blue' vlink='#551A8B' alink='red'>
- <a href='#toc'>Table of Contents</a><p>
-
- <h2><a name='sect0' href='#toc0'>Name</a></h2>
- SDL_SetTimer- Set a callback to run after the specified number of milliseconds
- has elapsed.
- <h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
- <p>
- <b>#include "SDL.h" <p>
- </b><b>int <b>SDL_SetTimer</b></b>(<b>Uint32 interval, SDL_TimerCallback
- callback</b>);
- <h2><a name='sect2' href='#toc2'>Callback</a></h2>
- <p>
- /* Function prototype for the timer callback function
- */ typedef Uint32 (*SDL_TimerCallback)(Uint32 interval);
- <h2><a name='sect3' href='#toc3'>Description</a></h2>
- <p>
- Set
- a callback to run after the specified number of milliseconds has elapsed.
- The callback function is passed the current timer interval and returns
- the next timer interval. If the returned value is the same as the one passed
- in, the periodic alarm continues, otherwise a new alarm is scheduled. <p>
- To
- cancel a currently running timer, call <b>SDL_SetTimer(0, NULL);</b> <p>
- The timer
- callback function may run in a different thread than your main constant,
- and so shouldn't call any functions from within itself. <p>
- The maximum resolution
- of this timer is 10 ms, which means that if you request a 16 ms timer,
- your callback will run approximately 20 ms later on an unloaded system.
- If you wanted to set a flag signaling a frame update at 30 frames per second
- (every 33 ms), you might set a timer for 30 ms (see example below). <p>
- If you
- use this function, you need to pass <b>SDL_INIT_TIMER</b> to <b>SDL_Init()</b>. <p>
- <blockquote><b>Note:
- <p>
- This function is kept for compatibility but has been superseded by the
- new timer functions <i>SDL_AddTimer</i></b> and <i>SDL_RemoveTimer</i> which support multiple
- timers. </blockquote>
-
- <h2><a name='sect4' href='#toc4'>Examples</a></h2>
- <p>
- <p>
- <br>
- <pre>CWSDL_SetTimer((33/10)*10, my_callback);
- </pre><p>
-
- <h2><a name='sect5' href='#toc5'>See Also</a></h2>
- <p>
- <i><b>SDL_AddTimer</b></i>
- <!--
-
- <p>
-
- <hr><p>
- <a name='toc'><b>Table of Contents</b></a><p>
- <ul>
- <li><a name='toc0' href='#sect0'>Name</a></li>
- <li><a name='toc1' href='#sect1'>Synopsis</a></li>
- <li><a name='toc2' href='#sect2'>Callback</a></li>
- <li><a name='toc3' href='#sect3'>Description</a></li>
- <li><a name='toc4' href='#sect4'>Examples</a></li>
- <li><a name='toc5' href='#sect5'>See Also</a></li>
- </ul>
- </body>
- </html>
-