|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.app.AbstractGame
com.jme.app.FixedFramerateGame
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.
| Field Summary |
| Fields inherited from class com.jme.app.AbstractGame |
ALWAYS_SHOW_PROPS_DIALOG, display, finished, FIRSTRUN_OR_NOCONFIGFILE_SHOW_PROPS_DIALOG, NEVER_SHOW_PROPS_DIALOG, properties |
| Constructor Summary | |
FixedFramerateGame()
|
|
| Method Summary | |
protected abstract void |
cleanup()
cleanup cleans up any created objects before exiting the
application. |
float |
getFramesPerSecond()
Gets the current frame rate. |
protected abstract void |
initGame()
initGame creates and initializes all game data required
for startup. |
protected abstract void |
initSystem()
initSystem creates all the necessary system components
for the client application. |
protected void |
quit()
Quits the program abruptly using System.exit. |
protected abstract void |
reinit()
reinit rebuilds the subsystems. |
protected abstract void |
render(float interpolation)
render displays the game information to the OpenGL context. |
void |
setFrameRate(int fps)
Set preferred frame rate. |
void |
start()
Render and update logic at a specified fixed rate. |
protected abstract void |
update(float interpolation)
update updates the game state. |
| Methods inherited from class com.jme.app.AbstractGame |
assertDisplayCreated, finish, getAttributes, getVersion, setDialogBehaviour, setDialogBehaviour, setDialogBehaviour |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FixedFramerateGame()
| Method Detail |
public void setFrameRate(int fps)
start() -ed.
fps - the desired frame rate in frames per secondpublic float getFramesPerSecond()
public final void start()
start in class AbstractGameprotected void quit()
System.exit.
quit in class AbstractGameAbstractGame.quit()protected abstract void update(float interpolation)
AbstractGameupdate updates the game state. Physics, AI, networking, score
checking and like should be completed in this method. How often and when
this method is called depends on the main loop implementation.
update in class AbstractGameinterpolation - unused in this implementationAbstractGame.update(float interpolation)protected abstract void render(float interpolation)
AbstractGamerender displays the game information to the OpenGL context.
Nothing altering the game state should be run during a render. How often
and when this method is called depends on the main loop implementation.
render in class AbstractGameinterpolation - unused in this implementationAbstractGame.render(float interpolation)protected abstract void initSystem()
AbstractGameinitSystem creates all the necessary system components
for the client application. It is is called once after start
is called. The display must be initialized within this method.
initSystem in class AbstractGameAbstractGame.initSystem()protected abstract void initGame()
AbstractGameinitGame creates and initializes all game data required
for startup. It is suggested that caching of frequently used resources
is done within this method. It is called once after initSystem
has completed.
initGame in class AbstractGameAbstractGame.initGame()protected abstract void reinit()
AbstractGamereinit rebuilds the subsystems. It may be called at any time
by the client application.
reinit in class AbstractGameAbstractGame.reinit()protected abstract void cleanup()
AbstractGamecleanup cleans up any created objects before exiting the
application. It is called once after finish is called.
cleanup in class AbstractGameAbstractGame.cleanup()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||