com.jme.app
Class BaseGame

java.lang.Object
  extended bycom.jme.app.AbstractGame
      extended bycom.jme.app.BaseGame
Direct Known Subclasses:
HelloSimpleGame, SimpleGame, TestAlphaState, TestBackwardAction, TestCameraNode, TestDitherState, TestExitAction, TestFirstPersonController, TestFogState, TestForwardAction, TestGameStateSystem, TestKeyActions, TestKeyBinding, TestKeyInput, TestLookDownAction, TestLookUpAction, TestLWJGLDisplaySystem, TestLWJGLRendererLine, TestLWJGLRendererPoint, TestLWJGLRendererTriMesh, TestMilestone1, TestMilestone2, TestMilestone3, TestMouseLook, TestNodeController, TestRelativeMouse, TestRenderStateList, TestRotateLeftAction, TestRotateRightAction, TestStrafeLeftAction, TestStrafeRightAction, TestText, TestTextureState, TestTimer, TestTorus, TestUI, TestWidgetAnimatedImage, TestWidgetApp1, TestWidgetApp2, TestWidgetAppTemplate, TestWidgetButtonLightSwitch, TestWidgetImage, TestWidgetSlider, TestWidgetViewportApp, TestWireframeState

public abstract class BaseGame
extends AbstractGame

BaseGame provides the simplest possible implementation of a main game loop. Both logic and graphics are updated as quickly as possible, with no interpolation to account for shifting frame rates. It is suggested that a more complex variant of AbstractGame be used in almost all cases.

Version:
$Id: BaseGame.java,v 1.5 2004/11/09 03:11:22 renanse Exp $
Author:
Mark Powell, Eric Woroshow

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
BaseGame()
           
 
Method Summary
protected abstract  void cleanup()
          cleanup cleans up any created objects before exiting the application.
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 start()
          The simplest main game loop possible: render and update as fast as possible.
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

BaseGame

public BaseGame()
Method Detail

start

public final void start()
The simplest main game loop possible: render and update as fast as possible.

Specified by:
start in class AbstractGame

quit

protected void quit()
Quits the program abruptly using System.exit.

Specified by:
quit in class AbstractGame
See Also:
AbstractGame.quit()

update

protected abstract void update(float interpolation)
Description copied from class: AbstractGame
update 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.

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

render

protected abstract void render(float interpolation)
Description copied from class: AbstractGame
render 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.

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

initSystem

protected abstract void initSystem()
Description copied from class: AbstractGame
initSystem 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.

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

initGame

protected abstract void initGame()
Description copied from class: AbstractGame
initGame 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.

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

reinit

protected abstract void reinit()
Description copied from class: AbstractGame
reinit rebuilds the subsystems. It may be called at any time by the client application.

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

cleanup

protected abstract void cleanup()
Description copied from class: AbstractGame
cleanup cleans up any created objects before exiting the application. It is called once after finish is called.

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