Start
Start the fps counter. defaultFps is the fps you're planning the game to run in. 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 FpsCounter. 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. 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. Examples // Start the fps counter such that the choosen default fps is 70.0 //
// (The actual fps can be several hundreds but the objects still appear to move // // at the same speed as if the fps was 70.0, but only far more accurately) // FpsCounter::Start( 70.0 ); Other functions of the class FpsCounter
Questions about Start? Click here. |