updated docs
[sdlgit/SDL-Site.git] / pages / SDL-GFX-Framerate.html-inc
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>
7 <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
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></li>
13 </ul>
14 </li>
15 <li><a href="#AUTHORS">AUTHORS</a>
16 </li>
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">
22 <p>SDL::GFX::Framerate - framerate calculating functions</p>
23
24 </div>
25 <h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
26 <div id="CATEGORY_CONTENT">
27 <p>GFX</p>
28
29 </div>
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>
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">
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>
51
52 </div>
53 <h2 id="set">set</h2>
54 <div id="set_CONTENT">
55 <pre> SDL::GFX::Framerate::set($fps, 60);
56
57 </pre>
58 <p>Sets the new desired framerate to 60 frames per second.</p>
59
60 </div>
61 <h2 id="get">get</h2>
62 <div id="get_CONTENT">
63 <pre> my $rate = SDL::GFX::Framerate::get($fps);
64
65 </pre>
66 <p>Get the currently set framerate of the manager.</p>
67
68 </div>
69 <h2 id="delay">delay</h2>
70 <div id="delay_CONTENT">
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. 
75 If the computer cannot keep up with the rate (i.e.drawing too slow), the delay is zero and the delay interpolation is reset.</p>
76
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>
81
82 </div>
83 </div>