home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue4 / SDL / gcc346 / !SDL / man / SDL_SetTimer.3 < prev    next >
Encoding:
Text File  |  2006-09-20  |  2.5 KB  |  74 lines

  1. <!-- manual page source format generated by PolyglotMan v3.0.8+X.Org, -->
  2. <!-- available at http://polyglotman.sourceforge.net/ -->
  3.  
  4. <html>
  5. <head>
  6. <title>"SDL_SetTimer"("3") manual page</title>
  7. </head>
  8. <body bgcolor='#efefef' text='black' link='blue' vlink='#551A8B' alink='red'>
  9. <a href='#toc'>Table of Contents</a><p>
  10.  
  11. <h2><a name='sect0' href='#toc0'>Name</a></h2>
  12. SDL_SetTimer- Set a callback to run after the specified number of milliseconds
  13. has elapsed. 
  14. <h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
  15. <p>
  16. <b>#include "SDL.h" <p>
  17. </b><b>int <b>SDL_SetTimer</b></b>(<b>Uint32 interval, SDL_TimerCallback
  18. callback</b>); 
  19. <h2><a name='sect2' href='#toc2'>Callback</a></h2>
  20. <p>
  21. /* Function prototype for the timer callback function
  22. */ typedef Uint32 (*SDL_TimerCallback)(Uint32 interval); 
  23. <h2><a name='sect3' href='#toc3'>Description</a></h2>
  24. <p>
  25. Set
  26. a callback to run after the specified number of milliseconds has elapsed.
  27. The callback function is passed the current timer interval and returns
  28. the next timer interval. If the returned value is the same as the one passed
  29. in, the periodic alarm continues, otherwise a new alarm is scheduled. <p>
  30. To
  31. cancel a currently running timer, call <b>SDL_SetTimer(0, NULL);</b> <p>
  32. The timer
  33. callback function may run in a different thread than your main constant,
  34. and so shouldn't call any functions from within itself. <p>
  35. The maximum resolution
  36. of this timer is 10 ms, which means that if you request a 16 ms timer,
  37. your callback will run approximately 20 ms later on an unloaded system.
  38. If you wanted to set a flag signaling a frame update at 30 frames per second
  39. (every 33 ms), you might set a timer for 30 ms (see example below). <p>
  40. If you
  41. use this function, you need to pass <b>SDL_INIT_TIMER</b> to <b>SDL_Init()</b>. <p>
  42. <blockquote><b>Note:
  43.   <p>
  44. This function is kept for compatibility but has been superseded by the
  45. new timer functions <i>SDL_AddTimer</i></b> and <i>SDL_RemoveTimer</i> which support multiple
  46. timers. </blockquote>
  47.  
  48. <h2><a name='sect4' href='#toc4'>Examples</a></h2>
  49. <p>
  50. <p>
  51. <br>
  52. <pre>CWSDL_SetTimer((33/10)*10, my_callback);
  53. </pre><p>
  54.  
  55. <h2><a name='sect5' href='#toc5'>See Also</a></h2>
  56. <p>
  57. <i><b>SDL_AddTimer</b></i> 
  58. <!--
  59.   
  60.  <p>
  61.  
  62. <hr><p>
  63. <a name='toc'><b>Table of Contents</b></a><p>
  64. <ul>
  65. <li><a name='toc0' href='#sect0'>Name</a></li>
  66. <li><a name='toc1' href='#sect1'>Synopsis</a></li>
  67. <li><a name='toc2' href='#sect2'>Callback</a></li>
  68. <li><a name='toc3' href='#sect3'>Description</a></li>
  69. <li><a name='toc4' href='#sect4'>Examples</a></li>
  70. <li><a name='toc5' href='#sect5'>See Also</a></li>
  71. </ul>
  72. </body>
  73. </html>
  74.