1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
<!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>SDL2_gfx: /cygdrive/i/Sources/sdl2gfx/SDL2_framerate.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">SDL2_gfx
 <span id="projectnumber">1.0.2</span>
</div>
<div id="projectbrief">GraphicsprimitivesandsurfacefunctionsforSDL2</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<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 id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">/cygdrive/i/Sources/sdl2gfx/SDL2_framerate.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="_s_d_l2__framerate_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"></span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">SDL2_framerate.h: framerate manager</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"></span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">Copyright (C) 2012-2014 Andreas Schiffler</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"></span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment">This software is provided 'as-is', without any express or implied</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment">warranty. In no event will the authors be held liable for any damages</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment">arising from the use of this software.</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"></span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">Permission is granted to anyone to use this software for any purpose,</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">including commercial applications, and to alter it and redistribute it</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">freely, subject to the following restrictions:</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"></span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">1. The origin of this software must not be misrepresented; you must not</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment">claim that you wrote the original software. If you use this software</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment">in a product, an acknowledgment in the product documentation would be</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment">appreciated but is not required.</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"></span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment">2. Altered source versions must be plainly marked as such, and must not be</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment">misrepresented as being the original software.</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"></span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment">3. This notice may not be removed or altered from any source</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="comment">distribution.</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="comment"></span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="comment"></span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="comment">*/</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#ifndef _SDL2_framerate_h</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#define _SDL2_framerate_h</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="comment">/* Set up for C function definitions, even when using C++ */</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="comment">/* --- */</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="preprocessor">#include "SDL.h"</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span> </div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="comment">/* --------- Definitions */</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> </div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="_s_d_l2__framerate_8h.html#aeaeac0f0b439344496e29abf60904d58"> 47</a></span> <span class="preprocessor">#define FPS_UPPER_LIMIT 200</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="_s_d_l2__framerate_8h.html#a9555dceeaaffdd2669c991e6a300085b"> 52</a></span> <span class="preprocessor">#define FPS_LOWER_LIMIT 1</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="_s_d_l2__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90"> 57</a></span> <span class="preprocessor">#define FPS_DEFAULT 30</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="struct_f_p_smanager.html"> 62</a></span>  <span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78"> 63</a></span>  Uint32 <a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">framecount</a>;</div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431"> 64</a></span>  <span class="keywordtype">float</span> <a class="code" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">rateticks</a>;</div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d"> 65</a></span>  Uint32 <a class="code" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">baseticks</a>;</div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55"> 66</a></span>  Uint32 <a class="code" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">lastticks</a>;</div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853"> 67</a></span>  Uint32 <a class="code" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">rate</a>;</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  } <a class="code" href="struct_f_p_smanager.html">FPSmanager</a>;</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span> </div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="comment">/* ---- Function Prototypes */</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span> </div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span> <span class="preprocessor">#ifdef _MSC_VER</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> <span class="preprocessor"># if defined(DLL_EXPORT) && !defined(LIBSDL2_GFX_DLL_IMPORT)</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span> <span class="preprocessor"># define SDL2_FRAMERATE_SCOPE __declspec(dllexport)</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> <span class="preprocessor"># else</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span> <span class="preprocessor"># ifdef LIBSDL2_GFX_DLL_IMPORT</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="preprocessor"># define SDL2_FRAMERATE_SCOPE __declspec(dllimport)</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="preprocessor"># endif</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span> <span class="preprocessor"># endif</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> <span class="preprocessor">#ifndef SDL2_FRAMERATE_SCOPE</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe"> 82</a></span> <span class="preprocessor"># define SDL2_FRAMERATE_SCOPE extern</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span> <span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="comment">/* Functions return 0 or value for sucess and -1 for error */</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> </div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <a class="code" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l2__framerate_8h.html#a843f0672446aff01ef03bbcd977fbedf">SDL_initFramerate</a>(<a class="code" href="struct_f_p_smanager.html">FPSmanager</a> * manager);</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <a class="code" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l2__framerate_8h.html#aa2f7f11e60d81489392707faf07c5ac5">SDL_setFramerate</a>(<a class="code" href="struct_f_p_smanager.html">FPSmanager</a> * manager, Uint32 rate);</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <a class="code" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l2__framerate_8h.html#aebe43457dbb9fbfec6de18e7adf49e21">SDL_getFramerate</a>(<a class="code" href="struct_f_p_smanager.html">FPSmanager</a> * manager);</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <a class="code" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l2__framerate_8h.html#a41de3f516b9633f102d7ba2e85d2bb98">SDL_getFramecount</a>(<a class="code" href="struct_f_p_smanager.html">FPSmanager</a> * manager);</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <a class="code" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> Uint32 <a class="code" href="_s_d_l2__framerate_8h.html#afc3b999d59d913771cd2588299096274">SDL_framerateDelay</a>(<a class="code" href="struct_f_p_smanager.html">FPSmanager</a> * manager);</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span> </div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="comment">/* --- */</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span> </div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  <span class="comment">/* Ends C function definitions when using C++ */</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span> <span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span> }</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span> <span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span> </div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> <span class="preprocessor">#endif </span><span class="comment">/* _SDL2_framerate_h */</span><span class="preprocessor"></span></div>
<div class="ttc" id="_s_d_l2__framerate_8h_html_a843f0672446aff01ef03bbcd977fbedf"><div class="ttname"><a href="_s_d_l2__framerate_8h.html#a843f0672446aff01ef03bbcd977fbedf">SDL_initFramerate</a></div><div class="ttdeci">SDL2_FRAMERATE_SCOPE void SDL_initFramerate(FPSmanager *manager)</div><div class="ttdoc">Initialize the framerate manager. </div><div class="ttdef"><b>Definition:</b> <a href="_s_d_l2__framerate_8c_source.html#l00062">SDL2_framerate.c:62</a></div></div>
<div class="ttc" id="_s_d_l2__framerate_8h_html_aebe43457dbb9fbfec6de18e7adf49e21"><div class="ttname"><a href="_s_d_l2__framerate_8h.html#aebe43457dbb9fbfec6de18e7adf49e21">SDL_getFramerate</a></div><div class="ttdeci">SDL2_FRAMERATE_SCOPE int SDL_getFramerate(FPSmanager *manager)</div><div class="ttdoc">Return the current target framerate in Hz. </div><div class="ttdef"><b>Definition:</b> <a href="_s_d_l2__framerate_8c_source.html#l00107">SDL2_framerate.c:107</a></div></div>
<div class="ttc" id="_s_d_l2__framerate_8h_html_aa2f7f11e60d81489392707faf07c5ac5"><div class="ttname"><a href="_s_d_l2__framerate_8h.html#aa2f7f11e60d81489392707faf07c5ac5">SDL_setFramerate</a></div><div class="ttdeci">SDL2_FRAMERATE_SCOPE int SDL_setFramerate(FPSmanager *manager, Uint32 rate)</div><div class="ttdoc">Set the framerate in Hz. </div><div class="ttdef"><b>Definition:</b> <a href="_s_d_l2__framerate_8c_source.html#l00086">SDL2_framerate.c:86</a></div></div>
<div class="ttc" id="struct_f_p_smanager_html_a05019faae5de8486dbb69d24b24eed78"><div class="ttname"><a href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">FPSmanager::framecount</a></div><div class="ttdeci">Uint32 framecount</div><div class="ttdef"><b>Definition:</b> <a href="_s_d_l2__framerate_8h_source.html#l00063">SDL2_framerate.h:63</a></div></div>
<div class="ttc" id="struct_f_p_smanager_html_aa7716779b7cc57dee24c15d7c5d62e55"><div class="ttname"><a href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">FPSmanager::lastticks</a></div><div class="ttdeci">Uint32 lastticks</div><div class="ttdef"><b>Definition:</b> <a href="_s_d_l2__framerate_8h_source.html#l00066">SDL2_framerate.h:66</a></div></div>
<div class="ttc" id="struct_f_p_smanager_html"><div class="ttname"><a href="struct_f_p_smanager.html">FPSmanager</a></div><div class="ttdoc">Structure holding the state and timing information of the framerate controller. </div><div class="ttdef"><b>Definition:</b> <a href="_s_d_l2__framerate_8h_source.html#l00062">SDL2_framerate.h:62</a></div></div>
<div class="ttc" id="struct_f_p_smanager_html_a48695d55d40900a197688bb773b9d431"><div class="ttname"><a href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">FPSmanager::rateticks</a></div><div class="ttdeci">float rateticks</div><div class="ttdef"><b>Definition:</b> <a href="_s_d_l2__framerate_8h_source.html#l00064">SDL2_framerate.h:64</a></div></div>
<div class="ttc" id="_s_d_l2__framerate_8h_html_a41de3f516b9633f102d7ba2e85d2bb98"><div class="ttname"><a href="_s_d_l2__framerate_8h.html#a41de3f516b9633f102d7ba2e85d2bb98">SDL_getFramecount</a></div><div class="ttdeci">SDL2_FRAMERATE_SCOPE int SDL_getFramecount(FPSmanager *manager)</div><div class="ttdoc">Return the current framecount. </div><div class="ttdef"><b>Definition:</b> <a href="_s_d_l2__framerate_8c_source.html#l00126">SDL2_framerate.c:126</a></div></div>
<div class="ttc" id="_s_d_l2__framerate_8h_html_afc3b999d59d913771cd2588299096274"><div class="ttname"><a href="_s_d_l2__framerate_8h.html#afc3b999d59d913771cd2588299096274">SDL_framerateDelay</a></div><div class="ttdeci">SDL2_FRAMERATE_SCOPE Uint32 SDL_framerateDelay(FPSmanager *manager)</div><div class="ttdoc">Delay execution to maintain a constant framerate and calculate fps. </div><div class="ttdef"><b>Definition:</b> <a href="_s_d_l2__framerate_8c_source.html#l00146">SDL2_framerate.c:146</a></div></div>
<div class="ttc" id="_s_d_l2__framerate_8h_html_af0b200240224bd14f4d63d0491176abe"><div class="ttname"><a href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a></div><div class="ttdeci">#define SDL2_FRAMERATE_SCOPE</div><div class="ttdef"><b>Definition:</b> <a href="_s_d_l2__framerate_8h_source.html#l00082">SDL2_framerate.h:82</a></div></div>
<div class="ttc" id="struct_f_p_smanager_html_ad853f9c03e200a77fd897c1ea3aec43d"><div class="ttname"><a href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">FPSmanager::baseticks</a></div><div class="ttdeci">Uint32 baseticks</div><div class="ttdef"><b>Definition:</b> <a href="_s_d_l2__framerate_8h_source.html#l00065">SDL2_framerate.h:65</a></div></div>
<div class="ttc" id="struct_f_p_smanager_html_af7eec7342fd8eb48d5f49ba7f5b91853"><div class="ttname"><a href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">FPSmanager::rate</a></div><div class="ttdeci">Uint32 rate</div><div class="ttdef"><b>Definition:</b> <a href="_s_d_l2__framerate_8h_source.html#l00067">SDL2_framerate.h:67</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
|