1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
4
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
6
<title>SDL2_gfx: I:/Sources/sdl2gfx/SDL2_framerate.h Source File</title>
8
<link href="tabs.css" rel="stylesheet" type="text/css"/>
9
<link href="doxygen.css" rel="stylesheet" type="text/css" />
15
<div id="top"><!-- do not remove this div! -->
19
<table cellspacing="0" cellpadding="0">
21
<tr style="height: 56px;">
24
<td style="padding-left: 0.5em;">
25
<div id="projectname">SDL2_gfx
26
 <span id="projectnumber">1.0.0</span>
28
<div id="projectbrief">GraphicsprimitivesandsurfacefunctionsforSDL2</div>
38
<!-- Generated by Doxygen 1.8.0 -->
39
<div id="navrow1" class="tabs">
41
<li><a href="index.html"><span>Main Page</span></a></li>
42
<li><a href="annotated.html"><span>Data Structures</span></a></li>
43
<li class="current"><a href="files.html"><span>Files</span></a></li>
46
<div id="navrow2" class="tabs2">
48
<li><a href="files.html"><span>File List</span></a></li>
49
<li><a href="globals.html"><span>Globals</span></a></li>
54
<div class="headertitle">
55
<div class="title">I:/Sources/sdl2gfx/SDL2_framerate.h</div> </div>
57
<div class="contents">
58
<a href="_s_d_l2__framerate_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
59
<a name="l00002"></a>00002 <span class="comment"></span>
60
<a name="l00003"></a>00003 <span class="comment">SDL2_framerate.h: framerate manager</span>
61
<a name="l00004"></a>00004 <span class="comment"></span>
62
<a name="l00005"></a>00005 <span class="comment">Copyright (C) 2012 Andreas Schiffler</span>
63
<a name="l00006"></a>00006 <span class="comment"></span>
64
<a name="l00007"></a>00007 <span class="comment">This software is provided 'as-is', without any express or implied</span>
65
<a name="l00008"></a>00008 <span class="comment">warranty. In no event will the authors be held liable for any damages</span>
66
<a name="l00009"></a>00009 <span class="comment">arising from the use of this software.</span>
67
<a name="l00010"></a>00010 <span class="comment"></span>
68
<a name="l00011"></a>00011 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span>
69
<a name="l00012"></a>00012 <span class="comment">including commercial applications, and to alter it and redistribute it</span>
70
<a name="l00013"></a>00013 <span class="comment">freely, subject to the following restrictions:</span>
71
<a name="l00014"></a>00014 <span class="comment"></span>
72
<a name="l00015"></a>00015 <span class="comment">1. The origin of this software must not be misrepresented; you must not</span>
73
<a name="l00016"></a>00016 <span class="comment">claim that you wrote the original software. If you use this software</span>
74
<a name="l00017"></a>00017 <span class="comment">in a product, an acknowledgment in the product documentation would be</span>
75
<a name="l00018"></a>00018 <span class="comment">appreciated but is not required.</span>
76
<a name="l00019"></a>00019 <span class="comment"></span>
77
<a name="l00020"></a>00020 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be</span>
78
<a name="l00021"></a>00021 <span class="comment">misrepresented as being the original software.</span>
79
<a name="l00022"></a>00022 <span class="comment"></span>
80
<a name="l00023"></a>00023 <span class="comment">3. This notice may not be removed or altered from any source</span>
81
<a name="l00024"></a>00024 <span class="comment">distribution.</span>
82
<a name="l00025"></a>00025 <span class="comment"></span>
83
<a name="l00026"></a>00026 <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span>
84
<a name="l00027"></a>00027 <span class="comment"></span>
85
<a name="l00028"></a>00028 <span class="comment">*/</span>
86
<a name="l00029"></a>00029
87
<a name="l00030"></a>00030 <span class="preprocessor">#ifndef _SDL2_framerate_h</span>
88
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define _SDL2_framerate_h</span>
89
<a name="l00032"></a>00032 <span class="preprocessor"></span>
90
<a name="l00033"></a>00033 <span class="comment">/* Set up for C function definitions, even when using C++ */</span>
91
<a name="l00034"></a>00034 <span class="preprocessor">#ifdef __cplusplus</span>
92
<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
93
<a name="l00036"></a>00036 <span class="preprocessor">#endif</span>
94
<a name="l00037"></a>00037 <span class="preprocessor"></span>
95
<a name="l00038"></a>00038 <span class="comment">/* --- */</span>
96
<a name="l00039"></a>00039
97
<a name="l00040"></a>00040 <span class="preprocessor">#include "SDL.h"</span>
98
<a name="l00041"></a>00041
99
<a name="l00042"></a>00042 <span class="comment">/* --------- Definitions */</span>
100
<a name="l00043"></a>00043
101
<a name="l00047"></a><a class="code" href="_s_d_l2__framerate_8h.html#aeaeac0f0b439344496e29abf60904d58">00047</a> <span class="preprocessor">#define FPS_UPPER_LIMIT 200</span>
102
<a name="l00048"></a>00048 <span class="preprocessor"></span>
103
<a name="l00052"></a><a class="code" href="_s_d_l2__framerate_8h.html#a9555dceeaaffdd2669c991e6a300085b">00052</a> <span class="preprocessor">#define FPS_LOWER_LIMIT 1</span>
104
<a name="l00053"></a>00053 <span class="preprocessor"></span>
105
<a name="l00057"></a><a class="code" href="_s_d_l2__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90">00057</a> <span class="preprocessor">#define FPS_DEFAULT 30</span>
106
<a name="l00058"></a>00058 <span class="preprocessor"></span>
107
<a name="l00062"></a><a class="code" href="struct_f_p_smanager.html">00062</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
108
<a name="l00063"></a><a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">00063</a> Uint32 <a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">framecount</a>;
109
<a name="l00064"></a><a class="code" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">00064</a> <span class="keywordtype">float</span> <a class="code" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">rateticks</a>;
110
<a name="l00065"></a><a class="code" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">00065</a> Uint32 <a class="code" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">baseticks</a>;
111
<a name="l00066"></a><a class="code" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">00066</a> Uint32 <a class="code" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">lastticks</a>;
112
<a name="l00067"></a><a class="code" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">00067</a> Uint32 <a class="code" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">rate</a>;
113
<a name="l00068"></a>00068 } <a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a>;
114
<a name="l00069"></a>00069
115
<a name="l00070"></a>00070 <span class="comment">/* ---- Function Prototypes */</span>
116
<a name="l00071"></a>00071
117
<a name="l00072"></a>00072 <span class="preprocessor">#ifdef _MSC_VER</span>
118
<a name="l00073"></a>00073 <span class="preprocessor"></span><span class="preprocessor"># if defined(DLL_EXPORT) && !defined(LIBSDL2_GFX_DLL_IMPORT)</span>
119
<a name="l00074"></a>00074 <span class="preprocessor"></span><span class="preprocessor"># define SDL2_FRAMERATE_SCOPE __declspec(dllexport)</span>
120
<a name="l00075"></a>00075 <span class="preprocessor"></span><span class="preprocessor"># else</span>
121
<a name="l00076"></a>00076 <span class="preprocessor"></span><span class="preprocessor"># ifdef LIBSDL2_GFX_DLL_IMPORT</span>
122
<a name="l00077"></a>00077 <span class="preprocessor"></span><span class="preprocessor"># define SDL2_FRAMERATE_SCOPE __declspec(dllimport)</span>
123
<a name="l00078"></a>00078 <span class="preprocessor"></span><span class="preprocessor"># endif</span>
124
<a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor"># endif</span>
125
<a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
126
<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor">#ifndef SDL2_FRAMERATE_SCOPE</span>
127
<a name="l00082"></a><a class="code" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">00082</a> <span class="preprocessor"></span><span class="preprocessor"># define SDL2_FRAMERATE_SCOPE extern</span>
128
<a name="l00083"></a>00083 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
129
<a name="l00084"></a>00084 <span class="preprocessor"></span>
130
<a name="l00085"></a>00085 <span class="comment">/* Functions return 0 or value for sucess and -1 for error */</span>
131
<a name="l00086"></a>00086
132
<a name="l00087"></a>00087 <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_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);
133
<a name="l00088"></a>00088 <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_8c.html#afad4b503cf9719daced45fa4d9653d72" 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, Uint32 rate);
134
<a name="l00089"></a>00089 <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_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);
135
<a name="l00090"></a>00090 <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_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);
136
<a name="l00091"></a>00091 <a class="code" href="_s_d_l2__framerate_8h.html#af0b200240224bd14f4d63d0491176abe">SDL2_FRAMERATE_SCOPE</a> Uint32 <a class="code" href="_s_d_l2__framerate_8c.html#afce13fa3dd37130deb4975d8b230c3ba" 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);
137
<a name="l00092"></a>00092
138
<a name="l00093"></a>00093 <span class="comment">/* --- */</span>
139
<a name="l00094"></a>00094
140
<a name="l00095"></a>00095 <span class="comment">/* Ends C function definitions when using C++ */</span>
141
<a name="l00096"></a>00096 <span class="preprocessor">#ifdef __cplusplus</span>
142
<a name="l00097"></a>00097 <span class="preprocessor"></span>}
143
<a name="l00098"></a>00098 <span class="preprocessor">#endif</span>
144
<a name="l00099"></a>00099 <span class="preprocessor"></span>
145
<a name="l00100"></a>00100 <span class="preprocessor">#endif </span><span class="comment">/* _SDL2_framerate_h */</span>
146
</pre></div></div><!-- contents -->
149
<hr class="footer"/><address class="footer"><small>
150
Generated by  <a href="http://www.doxygen.org/index.html">
151
<img class="footer" src="doxygen.png" alt="doxygen"/>