1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transistional//EN"><html><head><title>OpenLayer Offline Manual</title><style type="text/css" media="all">@import "../CrystalStyle.css";</style><body bgcolor="FFFFFF" ><div align="center" style="pagestyle"><table width="60%"><tr><td><div class="parentLinks"><a href="../index.html">OpenLayer</a> | <a href="../FpsCounter.html">FpsCounter</a> | <a href="../FpsCounter/Start.html">Start</a></div><br><div class="BigHeader">Start</div><br><div class=""><div class="Surrounded"><table><tr valign="top"><td align="right"><div class="FuncDef"><strong><font color="#777733">static</font> <font color="#777733">void</font> <a href="../FpsCounter/Start.html"><font color="#0000CC">Start</font></a>(</strong></div></td><td><div class="FuncDef"><strong><font color="#777733">float</font> defaultFps );
<br></strong></div></td></tr></table>
<br>Start the fps counter. defaultFps is the fps you're planning the game to run in.
<br></div>
<br>This function should be called right before the game loop starts. Note that the speed regulation requires you to multiply all speed and position and rotational changes with the delta time. For an example of how to do this see the definition of <a href="../FpsCounter.html"><font color="#0000CC">FpsCounter</font></a>.
<br>
<br>Note that the actual fps you get may differ a lot from the defaultFps. You can set the default fps to be 70.0 and get 500 fps. But it makes planning the game easier as you can design the speeds and accelerations of the game objects only related to the default fps, not to the actual fps the game runs in.
<br>
<br>So you could choose the default fps to be 100.0 and set the speed of an object to 0.05 or to choose the default fps to be 50.0 and set the speed of the object to be 0.10. In both cases the game will run exactly the same way. </div><br><div class="MediumHeader">Examples</div><br><div class="Code"><font color="#999922">// Start the fps counter such that the choosen default fps is 70.0 //</font>
<br><font color="#999922">// (The actual fps can be several hundreds but the objects still appear to move //</font>
<br><font color="#999922">// at the same speed as if the fps was 70.0, but only far more accurately) //</font>
<br><a href="../FpsCounter.html"><font color="#0000CC">FpsCounter</font></a>::<a href="../FpsCounter/Start.html"><font color="#0000CC">Start</font></a>( <font color="#994400">70.0</font> );</div><div class=""><br><br><div class="MediumHeader">Other functions of the class <a href="../FpsCounter.html"><font color="#0000CC">FpsCounter</font></a></div><div class="Surrounded"><table size="100%" cellpadding="0" cellspacing="0"><tr><td halign="center" class="funclist"><a href="../FpsCounter/Start.html">Start</a></td><td width="65%" halign="center"><div class="smalltext">Starts the FPS counter</div></td></tr><tr><td halign="center" class="funclist"><a href="../FpsCounter/NewFrameStarted.html">NewFrameStarted</a></td><td width="65%" halign="center"><div class="smalltext">Tells OpenLayer that a new game frame has started</div></td></tr><tr><td halign="center" class="funclist"><a href="../FpsCounter/GetDeltaTime.html">GetDeltaTime</a></td><td width="65%" halign="center"><div class="smalltext">
Get the elapsed game time between this and the previous frame</div></td></tr><tr><td halign="center" class="funclist"><a href="../FpsCounter/GetFps.html">GetFps</a></td><td width="65%" halign="center"><div class="smalltext">
Returns the frames per second the program runs at</div></td></tr><tr><td halign="center" class="funclist"><a href="../FpsCounter/Pause.html">Pause</a></td><td width="65%" halign="center"><div class="smalltext">Pauses the FPS counter</div></td></tr><tr><td halign="center" class="funclist"><a href="../FpsCounter/Resume.html">Resume</a></td><td width="65%" halign="center"><div class="smalltext">Resumes the paused FPS counter</div></td></tr></table></div><br><div class=""><a href="../index.html">Back to the main page of the manual</a></div><br>Questions about Start? Click <a href="http://crystalstorm.ath.cx/index.php?lan=en&page=CreateFeedback&subject=Start">here.</a></div></td></tr></table></body></html>
|