com.jme.app
Class FixedFramerateGame
java.lang.Object
com.jme.app.AbstractGame
com.jme.app.FixedFramerateGame
public abstract class FixedFramerateGame
- extends AbstractGame
FixedFramerateGame attempts to run the game at a fixed frame
rate. The main loop makes every effort to render at the specified rate,
however it is not guaranteed that the frame rate will not dip below the
desired value. Game logic is updated at the same rate as the rendering. For
example, if the rendering is running at 60 frames per second, the logic will
also be updated 60 times per second.
Note that setFrameRate(int) cannot be called prior to calling
start() or a NullPointerException will be
thrown. If no frame rate is specified, the game will run at 60 frames per
second.
- Version:
- $Id: FixedFramerateGame.java,v 1.15 2007/08/02 21:36:19 nca Exp $
- Author:
- Eric Woroshow
|
Method Summary |
float |
getFramesPerSecond()
Gets the current frame rate. |
void |
setFrameRate(int fps)
Set preferred frame rate. |
void |
start()
Render and update logic at a specified fixed rate. |
FixedFramerateGame
public FixedFramerateGame()
setFrameRate
public void setFrameRate(int fps)
- Set preferred frame rate. The main loop will make every attempt to
maintain the given frame rate. This should not be called prior to the
application being
start() -ed.
- Parameters:
fps - the desired frame rate in frames per second
getFramesPerSecond
public float getFramesPerSecond()
- Gets the current frame rate.
- Returns:
- the current number of frames rendering per second
start
public final void start()
- Render and update logic at a specified fixed rate.
- Specified by:
start in class AbstractGame