updated docs
[sdlgit/SDL-Site.git] / pages / SDL-GFX-Framerate.html-inc
CommitLineData
cf23a5da 1<div class="pod">
2<!-- INDEX START -->
3<h3 id="TOP">Index</h3>
4
5<ul><li><a href="#NAME">NAME</a></li>
6<li><a href="#CATEGORY">CATEGORY</a></li>
5a0fe0a6 7<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
cf23a5da 8<li><a href="#METHODS">METHODS</a>
9<ul><li><a href="#init">init</a></li>
10<li><a href="#set">set</a></li>
11<li><a href="#get">get</a></li>
d5943b68 12<li><a href="#delay">delay</a></li>
cf23a5da 13</ul>
14</li>
d5943b68 15<li><a href="#AUTHORS">AUTHORS</a>
16</li>
cf23a5da 17</ul><hr />
18<!-- INDEX END -->
19
20<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
21<div id="NAME_CONTENT">
5a0fe0a6 22<p>SDL::GFX::Framerate - framerate calculating functions</p>
cf23a5da 23
24</div>
25<h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
26<div id="CATEGORY_CONTENT">
b5d537cc 27<p>GFX</p>
cf23a5da 28
29</div>
5a0fe0a6 30<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
31<div id="DESCRIPTION_CONTENT">
32<p>The framerate functions are used to insert delays into the graphics loop to maintain a constant framerate.</p>
33
34</div>
cf23a5da 35<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
36<div id="METHODS_CONTENT">
37
38</div>
39<h2 id="init">init</h2>
40<div id="init_CONTENT">
5a0fe0a6 41<pre> use SDL;
42 use SDL::GFX::Framerate;
43 use SDL::GFX::FPSManager;
44
45 my $fps = SDL::GFX::FPSManager-&gt;new(0, 0, 0, 0);
46
47 SDL::GFX::Framerate::init($fps);
48
49</pre>
50<p>Initialize the framerate manager, set default framerate of 30Hz and reset delay interpolation.</p>
cf23a5da 51
52</div>
53<h2 id="set">set</h2>
54<div id="set_CONTENT">
5a0fe0a6 55<pre> SDL::GFX::Framerate::set($fps, 60);
56
57</pre>
58<p>Sets the new desired framerate to 60 frames per second.</p>
cf23a5da 59
60</div>
61<h2 id="get">get</h2>
62<div id="get_CONTENT">
5a0fe0a6 63<pre> my $rate = SDL::GFX::Framerate::get($fps);
64
65</pre>
66<p>Get the currently set framerate of the manager.</p>
cf23a5da 67
68</div>
69<h2 id="delay">delay</h2>
70<div id="delay_CONTENT">
5a0fe0a6 71<pre> SDL::GFX::Framerate::delay($fps);
72
73</pre>
74<p>Generate a delay to accomodate currently set framerate. Call once in thegraphics/rendering loop.
75If the computer cannot keep up with the rate (i.e.drawing too slow), the delay is zero and the delay interpolation is reset.</p>
cf23a5da 76
d5943b68 77</div>
78<h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
79<div id="AUTHORS_CONTENT">
80<p>See <b>AUTHORS</b> in <cite>SDL</cite>.</p>
cf23a5da 81
82</div>
83</div>