|
||||||||||
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.BaseGame
com.jme.app.BaseSimpleGame
public abstract class BaseSimpleGame
A game implementation that handles numerous common tasks.
This class implements all of the abstract methods and provides some default input handlers and code to report on memory usage and to display simple performance metrics on the screen.
All that is required to use this class is to build your scene graph (in
simpleInitGame()
) and add it to the rootNode
.
A light state is provided with a single point light, (you can easily add
more by accessing the lightState
field) and there is an FPS and
statistics display. The depth buffer compare function is automatically set
to CF_LEQUAL
. Wireframe mode and the lights may be toggled via T
and L respectively.
Note that this class does not automatically render the
root node, you need to do this yourself by overriding simpleRender()
.
If you need to update your game state then a corresponding
simpleUpdate()
hook is also provided.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.jme.app.BaseGame |
---|
BaseGame.BaseGameSettings |
Nested classes/interfaces inherited from class com.jme.app.AbstractGame |
---|
AbstractGame.ConfigShowMode |
Field Summary | |
---|---|
protected int |
alphaBits
Alpha bits to use for the renderer. |
protected Camera |
cam
The camera that we see through. |
protected int |
depthBits
Depth bits to use for the renderer. |
protected Node |
graphNode
The root node for our stats graphs. |
protected InputHandler |
input
Handles our mouse/keyboard input. |
protected LightState |
lightState
A lightstate to turn on and off for the rootNode |
protected boolean |
pause
boolean for toggling the simpleUpdate and geometric update parts of the game loop on and off. |
protected Node |
rootNode
The root of our normal scene graph. |
protected int |
samples
Number of samples to use for the multisample buffer. |
protected boolean |
showBounds
True if the renderer should display bounds. |
protected boolean |
showDepth
True if the renderer should display the depth buffer. |
protected boolean |
showGraphs
True if the we should show the stats graphs. |
protected boolean |
showNormals
True if the renderer should display normals. |
protected Node |
statNode
The root node for our stats and text. |
protected int |
stencilBits
Stencil bits to use for the renderer. |
protected Timer |
timer
High resolution timer for jME. |
protected float |
tpf
Simply an easy way to get at timer.getTimePerFrame(). |
protected WireframeState |
wireState
A wirestate to turn on and off for the rootNode |
Fields inherited from class com.jme.app.BaseGame |
---|
throwableHandler |
Fields inherited from class com.jme.app.AbstractGame |
---|
display, finished, settings |
Constructor Summary | |
---|---|
BaseSimpleGame()
|
Method Summary | |
---|---|
protected void |
cameraParallel()
|
protected void |
cameraPerspective()
|
protected void |
cleanup()
Cleans up the keyboard. |
protected void |
doDebug(Renderer r)
|
protected void |
initGame()
Creates rootNode, lighting, statistic text, and other basic render states. |
protected void |
initSystem()
Creates display, sets up camera, and binds keys. |
protected void |
quit()
Calls the quit of BaseGame to clean up the display and then closes the JVM. |
protected void |
reinit()
unused |
protected void |
render(float interpolation)
Clears stats, the buffers and renders bounds and normals if on. |
protected void |
setupStatGraphs()
Set up the graphers we will use and the quads we'll show the stats on. |
protected void |
setupStats()
Set up which stats to graph |
protected abstract void |
simpleInitGame()
Called near end of initGame(). |
protected void |
simpleRender()
Can be defined in derived classes for custom rendering. |
protected void |
simpleUpdate()
Can be defined in derived classes for custom updating. |
protected void |
update(float interpolation)
Updates the timer, sets tpf, updates the input and updates the fps string. |
protected void |
updateInput()
Check for key/mouse updates. |
Methods inherited from class com.jme.app.BaseGame |
---|
getNewSettings, getThrowableHandler, setThrowableHandler, start |
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 |
Field Detail |
---|
protected Camera cam
protected Node rootNode
protected InputHandler input
protected Timer timer
protected Node statNode
protected Node graphNode
protected int alphaBits
protected int depthBits
protected int stencilBits
protected int samples
protected float tpf
protected boolean showDepth
protected boolean showBounds
protected boolean showNormals
protected boolean showGraphs
protected WireframeState wireState
protected LightState lightState
protected boolean pause
Constructor Detail |
---|
public BaseSimpleGame()
Method Detail |
---|
protected void update(float interpolation)
update
in class BaseGame
interpolation
- unused in this implementationAbstractGame.update(float interpolation)
protected void updateInput()
protected void render(float interpolation)
render
in class BaseGame
interpolation
- unused in this implementationAbstractGame.render(float interpolation)
protected void doDebug(Renderer r)
protected void initSystem() throws JmeException
initSystem
in class BaseGame
JmeException
AbstractGame.initSystem()
protected void cameraPerspective()
protected void cameraParallel()
protected void initGame()
initGame
in class BaseGame
AbstractGame.initGame()
protected abstract void simpleInitGame()
protected void simpleUpdate()
protected void simpleRender()
protected void reinit()
reinit
in class BaseGame
AbstractGame.reinit()
protected void cleanup()
cleanup
in class BaseGame
AbstractGame.cleanup()
protected void quit()
quit
in class BaseGame
AbstractGame.quit()
protected void setupStats()
protected void setupStatGraphs()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |