com.jme.app
Class SimpleGame

java.lang.Object
  extended bycom.jme.app.AbstractGame
      extended bycom.jme.app.BaseGame
          extended bycom.jme.app.SimpleGame
Direct Known Subclasses:
HelloAnimation, HelloIntersection, HelloKeyframes, HelloKeyInput, HelloLOD, HelloModelLoading, HelloMousePick, HelloNode, HelloStates, HelloTerrain, HelloTriMesh, HelloWorld, PongRevisited, TestAbsoluteMouse, TestAnisotropic, TestASEJmeWrite, TestAutoClodMesh, TestBezierCurve, TestBezierMesh, TestBillboardNode, TestBinaryXML, TestBoxColor, TestCameraMan, TestClodMesh, TestClones, TestCloth, TestCollision, TestCompositeSphere, TestCylinder, TestDiscreteLOD, TestDisk, TestDome, TestDynamicSmoker, TestEnvMap, TestFireMilk, TestFontPanel, TestFragmentProgramState, TestGLSLShaderObjectsState, TestImposterNode, TestKeyframeController, TestLensFlare, TestLightState, TestLightStateController, TestMaxJmeWrite, TestMd2JmeWrite, TestMd3JmeWrite, TestMilkJmeWrite, TestModelClones, TestMultitexture, TestOBBPick, TestOBBTree, TestObjJmeWrite, TestOctahedron, TestOrientedBox, TestParticleSystem, TestPick, TestPQTorus, TestRecreateWindow, TestRenderQueue, TestRenderToTexture, TestRigidSmoker, TestScenegraph, TestSerial, TestSimpleGame, TestSkybox, TestSoundGraph, TestSoundGraph, TestSpatialTransform, TestSpatialTransformer, TestSphere, TestTerrain, TestTerrainLighting, TestTerrainPage, TestTerrainTrees, TestTorusCylinder, TestVertexProgramState

public abstract class SimpleGame
extends BaseGame

SimpleGame provides the simplest possible implementation of a main game loop. Interpolation is used between frames for varying framerates.

Version:
$Id: SimpleGame.java,v 1.35 2005/02/10 21:48:24 renanse Exp $
Author:
Joshua Slack, (javadoc by cep21)

Field Summary
protected  Camera cam
          The camera that we see through.
static java.lang.String fontLocation
          Location of the font for jME's text at the bottom
protected  Text fps
          Displays all the lovely information at the bottom.
protected  Node fpsNode
          The root node of our text.
protected  InputHandler input
          Handles our mouse/keyboard input.
protected  LightState lightState
          A lightstate to turn on and off for the rootNode
protected  boolean pause
           
protected  Node rootNode
          The root of our normal scene graph.
protected  boolean showBounds
          True if the renderer should display bounds.
protected  java.lang.StringBuffer tempBuffer
          This is used to recieve getStatistics calls.
protected  Timer timer
          High resolution timer for jME.
protected  float tpf
          Simply an easy way to get at timer.getTimePerFrame().
protected  java.lang.StringBuffer updateBuffer
          This is used to display print text.
protected  WireframeState wireState
          A wirestate to turn on and off for the rootNode
 
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
SimpleGame()
           
 
Method Summary
protected  void cleanup()
          Cleans up the keyboard.
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 reinit()
          unused
protected  void render(float interpolation)
          This is called every frame in BaseGame.start(), after update()
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)
          This is called every frame in BaseGame.start()
 
Methods inherited from class com.jme.app.BaseGame
quit, start
 
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
 

Field Detail

cam

protected Camera cam
The camera that we see through.


rootNode

protected Node rootNode
The root of our normal scene graph.


input

protected InputHandler input
Handles our mouse/keyboard input.


timer

protected Timer timer
High resolution timer for jME.


fpsNode

protected Node fpsNode
The root node of our text.


fps

protected Text fps
Displays all the lovely information at the bottom.


tpf

protected float tpf
Simply an easy way to get at timer.getTimePerFrame(). Also saves time so you don't call it more than once per frame.


showBounds

protected boolean showBounds
True if the renderer should display bounds.


wireState

protected WireframeState wireState
A wirestate to turn on and off for the rootNode


lightState

protected LightState lightState
A lightstate to turn on and off for the rootNode


fontLocation

public static java.lang.String fontLocation
Location of the font for jME's text at the bottom


updateBuffer

protected java.lang.StringBuffer updateBuffer
This is used to display print text.


tempBuffer

protected java.lang.StringBuffer tempBuffer
This is used to recieve getStatistics calls.


pause

protected boolean pause
Constructor Detail

SimpleGame

public SimpleGame()
Method Detail

update

protected final void update(float interpolation)
This is called every frame in BaseGame.start()

Specified by:
update in class BaseGame
Parameters:
interpolation - unused in this implementation
See Also:
AbstractGame.update(float interpolation)

render

protected final void render(float interpolation)
This is called every frame in BaseGame.start(), after update()

Specified by:
render in class BaseGame
Parameters:
interpolation - unused in this implementation
See Also:
AbstractGame.render(float interpolation)

initSystem

protected final void initSystem()
Creates display, sets up camera, and binds keys. Called in BaseGame.start() directly after the dialog box.

Specified by:
initSystem in class BaseGame
See Also:
AbstractGame.initSystem()

initGame

protected final void initGame()
Creates rootNode, lighting, statistic text, and other basic render states. Called in BaseGame.start() after initSystem().

Specified by:
initGame in class BaseGame
See Also:
AbstractGame.initGame()

simpleInitGame

protected abstract void simpleInitGame()
Called near end of initGame(). Must be defined by derived classes.


simpleUpdate

protected void simpleUpdate()
Can be defined in derived classes for custom updating. Called every frame in update.


simpleRender

protected void simpleRender()
Can be defined in derived classes for custom rendering. Called every frame in render.


reinit

protected void reinit()
unused

Specified by:
reinit in class BaseGame
See Also:
AbstractGame.reinit()

cleanup

protected void cleanup()
Cleans up the keyboard.

Specified by:
cleanup in class BaseGame
See Also:
AbstractGame.cleanup()