<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>SDL_gfx: SDL_framerate.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.2 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <h1>SDL_framerate.h</h1><a href="_s_d_l__framerate_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00002"></a>00002 <span class="comment">/*</span> <a name="l00003"></a>00003 <span class="comment"></span> <a name="l00004"></a>00004 <span class="comment">SDL_framerate: framerate manager</span> <a name="l00005"></a>00005 <span class="comment"></span> <a name="l00006"></a>00006 <span class="comment">LGPL (c) A. Schiffler</span> <a name="l00007"></a>00007 <span class="comment"></span> <a name="l00008"></a>00008 <span class="comment">*/</span> <a name="l00009"></a>00009 <a name="l00010"></a>00010 <span class="preprocessor">#ifndef _SDL_framerate_h</span> <a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define _SDL_framerate_h</span> <a name="l00012"></a>00012 <span class="preprocessor"></span> <a name="l00013"></a>00013 <span class="comment">/* Set up for C function definitions, even when using C++ */</span> <a name="l00014"></a>00014 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00015"></a>00015 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> { <a name="l00016"></a>00016 <span class="preprocessor">#endif</span> <a name="l00017"></a>00017 <span class="preprocessor"></span> <a name="l00018"></a>00018 <span class="comment">/* --- */</span> <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="preprocessor">#include "SDL.h"</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="comment">/* --------- Definitions */</span> <a name="l00023"></a>00023 <a name="l00027"></a><a class="code" href="_s_d_l__framerate_8h.html#aeaeac0f0b439344496e29abf60904d58">00027</a> <span class="preprocessor">#define FPS_UPPER_LIMIT 200</span> <a name="l00028"></a>00028 <span class="preprocessor"></span> <a name="l00032"></a><a class="code" href="_s_d_l__framerate_8h.html#a9555dceeaaffdd2669c991e6a300085b">00032</a> <span class="preprocessor">#define FPS_LOWER_LIMIT 1</span> <a name="l00033"></a>00033 <span class="preprocessor"></span> <a name="l00037"></a><a class="code" href="_s_d_l__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90">00037</a> <span class="preprocessor">#define FPS_DEFAULT 30</span> <a name="l00038"></a>00038 <span class="preprocessor"></span> <a name="l00042"></a><a class="code" href="struct_f_p_smanager.html">00042</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ <a name="l00043"></a><a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">00043</a> Uint32 framecount; <a name="l00044"></a><a class="code" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">00044</a> <span class="keywordtype">float</span> rateticks; <a name="l00045"></a><a class="code" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">00045</a> Uint32 lastticks; <a name="l00046"></a><a class="code" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">00046</a> Uint32 rate; <a name="l00047"></a>00047 } <a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a>; <a name="l00048"></a>00048 <a name="l00049"></a>00049 <span class="comment">/* ---- Function Prototypes */</span> <a name="l00050"></a>00050 <a name="l00051"></a>00051 <span class="preprocessor">#if defined(WIN32) || defined(WIN64)</span> <a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor"># if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)</span> <a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor"># define SDL_FRAMERATE_SCOPE __declspec(dllexport)</span> <a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor"># else</span> <a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor"># ifdef LIBSDL_GFX_DLL_IMPORT</span> <a name="l00056"></a>00056 <span class="preprocessor"></span><span class="preprocessor"># define SDL_FRAMERATE_SCOPE __declspec(dllimport)</span> <a name="l00057"></a>00057 <span class="preprocessor"></span><span class="preprocessor"># endif</span> <a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor"># endif</span> <a name="l00059"></a>00059 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor">#ifndef SDL_FRAMERATE_SCOPE</span> <a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor"># define SDL_FRAMERATE_SCOPE extern</span> <a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00063"></a>00063 <span class="preprocessor"></span> <a name="l00064"></a>00064 <span class="comment">/* Functions return 0 or value for sucess and -1 for error */</span> <a name="l00065"></a>00065 <a name="l00066"></a>00066 SDL_FRAMERATE_SCOPE <span class="keywordtype">void</span> <a class="code" href="_s_d_l__framerate_8c.html#a444ebaaaa6b1ceeafa921562bdab1a44" title="Initialize the framerate manager.">SDL_initFramerate</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager); <a name="l00067"></a>00067 SDL_FRAMERATE_SCOPE <span class="keywordtype">int</span> <a class="code" href="_s_d_l__framerate_8c.html#a50935c9381b80ec7cce4613f4ac282e8" title="Set the framerate in Hz.">SDL_setFramerate</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager, <span class="keywordtype">int</span> rate); <a name="l00068"></a>00068 SDL_FRAMERATE_SCOPE <span class="keywordtype">int</span> <a class="code" href="_s_d_l__framerate_8c.html#a575bb511d6f817ad846a788cbd08ae91" title="Return the current target framerate in Hz.">SDL_getFramerate</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager); <a name="l00069"></a>00069 SDL_FRAMERATE_SCOPE <span class="keywordtype">int</span> <a class="code" href="_s_d_l__framerate_8c.html#a96b13e26f8436222e866904a592a6eec" title="Return the current framecount.">SDL_getFramecount</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager); <a name="l00070"></a>00070 SDL_FRAMERATE_SCOPE <span class="keywordtype">void</span> <a class="code" href="_s_d_l__framerate_8c.html#a6170d53a691468b70d73d349a1668291" title="Delay execution to maintain a constant framerate and calculate fps.">SDL_framerateDelay</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager); <a name="l00071"></a>00071 <a name="l00072"></a>00072 <span class="comment">/* --- */</span> <a name="l00073"></a>00073 <a name="l00074"></a>00074 <span class="comment">/* Ends C function definitions when using C++ */</span> <a name="l00075"></a>00075 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00076"></a>00076 <span class="preprocessor"></span>} <a name="l00077"></a>00077 <span class="preprocessor">#endif</span> <a name="l00078"></a>00078 <span class="preprocessor"></span> <a name="l00079"></a>00079 <span class="preprocessor">#endif </span><span class="comment">/* _SDL_framerate_h */</span> </pre></div></div> <hr size="1"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address> </body> </html>