|
||||||||||
| 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.VariableTimestepGame
public abstract class VariableTimestepGame
A game that tracks time between frames.
This is identical to BaseGame except that it also maintains a timer
which is used to pass frame timing information to the render and update
methods. This is useful if a game needs to execute a different amount of
logic based upon the elapsed time.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.jme.app.AbstractGame |
|---|
AbstractGame.ConfigShowMode |
| Field Summary |
|---|
| Fields inherited from class com.jme.app.AbstractGame |
|---|
display, finished, settings |
| Constructor Summary | |
|---|---|
VariableTimestepGame()
|
|
| Method Summary | |
|---|---|
protected abstract void |
cleanup()
Called once the game loop has finished. |
float |
getFramesPerSecond()
getFramesPerSecond gets the current frame rate. |
protected GameSettings |
getNewSettings()
Subclasses must implement getNewSettings to instantiate and populate a GameSettings object. |
protected abstract void |
initGame()
Create and initialise all game data. |
protected abstract void |
initSystem()
Initialise the display system. |
protected void |
quit()
Quits the program abruptly using System.exit. |
protected abstract void |
reinit()
Rebuild the system. |
protected abstract void |
render(float interpolation)
Display the updated game information. |
void |
start()
Renders and updates logic as fast as possible, but keeps track of time elapsed between frames. |
protected abstract void |
update(float deltaTime)
Update the game state. |
| Methods inherited from class com.jme.app.AbstractGame |
|---|
assertDisplayCreated, finish, getAttributes, getVersion, setConfigShowMode, setConfigShowMode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public VariableTimestepGame()
| Method Detail |
|---|
public float getFramesPerSecond()
getFramesPerSecond gets the current frame rate.
public final void start()
start in class AbstractGameprotected void quit()
System.exit.
quit in class AbstractGameAbstractGame.quit()protected abstract void update(float deltaTime)
AbstractGameAny user input checks, changes to game physics, AI, networking, score table updates, and so on, should happen in this method. The rate at which this method is called will depend on the specific game implementation in use.
Note that this method should not update the screen.
update in class AbstractGamedeltaTime - the time elapsed since the last frame, in secondsAbstractGame.update(float interpolation)protected abstract void render(float interpolation)
AbstractGameThis method normally involves clearing the display and rendering the scene graph, although subclasses are free to do any screen related work here. The rate at which this method is called will depend on the specific game implementation in use.
Note that this method is run on the OpenGL thread, it should not alter the game state in any way.
render in class AbstractGameinterpolation - unused in this implementationAbstractGame.render(float interpolation)protected abstract void initSystem()
AbstractGame
This includes not just the DisplaySystem but also any other
input and display related elements such as windows, cameras, and the
input system.
Note that the display must be initialised in this method.
initSystem in class AbstractGameAbstractGame.initSystem()protected abstract void initGame()
AbstractGameWhat happens here is purely application dependent; it is where, for example, the initial scene graph and the starting environment could be loaded. It is suggested that any frequently used resources are loaded and cached in this method.
This method is called once after AbstractGame.initSystem() has completed.
initGame in class AbstractGameAbstractGame.initGame()protected abstract void reinit()
AbstractGameThis method is called when the system requires rebuilding, for example is the screen resolution is altered. This method may be called at any time by client code.
reinit in class AbstractGameAbstractGame.reinit()protected abstract void cleanup()
AbstractGame
Subclasses should use this method to release any resources, for example
data that was loaded in the initXXX() methods.
cleanup in class AbstractGameAbstractGame.cleanup()protected GameSettings getNewSettings()
AbstractGame
getNewSettings in class AbstractGameAbstractGame.getNewSettings()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||