com.jme.app
Class AbstractGame

java.lang.Object
  extended by com.jme.app.AbstractGame
Direct Known Subclasses:
BaseGame, BaseHeadlessApp, FixedFramerateGame, FixedLogicrateGame, StandardGame, VariableTimestepGame

public abstract class AbstractGame
extends Object

AbstractGame defines a common method for implementing game functionality. Client applications should not subclass AbstractGame directly.

Version:
$Revision$
Author:
Eric Woroshow

Nested Class Summary
static class AbstractGame.ConfigShowMode
           
 
Method Summary
 void finish()
          finish breaks out of the main game loop.
 String getVersion()
          getVersion returns the version of the API.
 void setConfigShowMode(AbstractGame.ConfigShowMode mode)
          setConfigShowMode defines if and when the display properties dialog should be shown.
 void setConfigShowMode(AbstractGame.ConfigShowMode mode, URL imageOverride)
          setConfigShowMode defines if and when the display properties dialog should be shown as well as its accompanying image.
abstract  void start()
          start begins the game.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getVersion

public String getVersion()
getVersion returns the version of the API.

Returns:
the version of the API.

setConfigShowMode

public void setConfigShowMode(AbstractGame.ConfigShowMode mode)
setConfigShowMode defines if and when the display properties dialog should be shown. Setting the behaviour after start has been called has no effect.

Parameters:
mode - properties dialog behaviour
See Also:
#@setConfigShowMode(ConfigShowMode, URL)

setConfigShowMode

public void setConfigShowMode(AbstractGame.ConfigShowMode mode,
                              URL imageOverride)
setConfigShowMode defines if and when the display properties dialog should be shown as well as its accompanying image. Setting the behaviour after start has been called has no effect.

Parameters:
mode - properties dialog behaviour. ALWAYS_SHOW_PROPS, NEVER_SHOW_PROPS and FIRSTRUN_OR_NOCONFIGFILE are the valid choices.
imageOverride - URL specifying the filename of an image to be displayed with the PropertiesDialog. Passing null will result in no image being used. You would normally use .getResource...() to get (and verify) the URL. For hacking or prototype, you can get image from filesystem like new URL("file:" + filepath").

start

public abstract void start()
start begins the game. The game is initialized by calling first initSystem then initGame. Assuming no errors were encountered during initialization, the main game loop is entered. How the loop operates is implementation-dependent. After the game loop is broken out of via a call to finish, cleanup is called. Subclasses should declare this method final.


finish

public void finish()
finish breaks out of the main game loop. It is preferable to call finish instead of quit.