Added animated
[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>
12<li><a href="#delay">delay</a>
13</li>
14</ul>
15</li>
16</ul><hr />
17<!-- INDEX END -->
18
19<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
20<div id="NAME_CONTENT">
5a0fe0a6 21<p>SDL::GFX::Framerate - framerate calculating functions</p>
cf23a5da 22
23</div>
24<h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
25<div id="CATEGORY_CONTENT">
b5d537cc 26<p>GFX</p>
cf23a5da 27
28</div>
5a0fe0a6 29<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
30<div id="DESCRIPTION_CONTENT">
31<p>The framerate functions are used to insert delays into the graphics loop to maintain a constant framerate.</p>
32
33</div>
cf23a5da 34<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
35<div id="METHODS_CONTENT">
36
37</div>
38<h2 id="init">init</h2>
39<div id="init_CONTENT">
5a0fe0a6 40<pre> use SDL;
41 use SDL::GFX::Framerate;
42 use SDL::GFX::FPSManager;
43
44 my $fps = SDL::GFX::FPSManager-&gt;new(0, 0, 0, 0);
45
46 SDL::GFX::Framerate::init($fps);
47
48</pre>
49<p>Initialize the framerate manager, set default framerate of 30Hz and reset delay interpolation.</p>
cf23a5da 50
51</div>
52<h2 id="set">set</h2>
53<div id="set_CONTENT">
5a0fe0a6 54<pre> SDL::GFX::Framerate::set($fps, 60);
55
56</pre>
57<p>Sets the new desired framerate to 60 frames per second.</p>
cf23a5da 58
59</div>
60<h2 id="get">get</h2>
61<div id="get_CONTENT">
5a0fe0a6 62<pre> my $rate = SDL::GFX::Framerate::get($fps);
63
64</pre>
65<p>Get the currently set framerate of the manager.</p>
cf23a5da 66
67</div>
68<h2 id="delay">delay</h2>
69<div id="delay_CONTENT">
5a0fe0a6 70<pre> SDL::GFX::Framerate::delay($fps);
71
72</pre>
73<p>Generate a delay to accomodate currently set framerate. Call once in thegraphics/rendering loop.
74If 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 75
76
77
78
79
80</div>
81</div>