de.rico.adventure.main
Class Adventure

java.lang.Object
  extended by de.rico.engine.game.AbstractBaseGame
      extended by de.rico.adventure.main.Adventure
All Implemented Interfaces:
GameIface, java.util.EventListener, javax.media.opengl.GLEventListener

public class Adventure
extends AbstractBaseGame

This class is the main class for an adventure game, that is built with the framework. It implements the singleton pattern.

Author:
Frank Bruns

Method Summary
 void abortCloseUpMode()
          Call this method to abort the close up mode, if it should be aborted without the need of the player to abort it manually.
 void draw(javax.media.opengl.GL gl)
          This method is used to draw the scene and its content.
 Chapter getActiveChapter()
          Returns the currently active chapter of the game.
static Adventure getInstance()
          Returns the singleton instance of the game.
 ShadowType getShadowType()
          Returns the current shadow type used in the game.
 void initResources(javax.media.opengl.GLDrawable gld, javax.media.opengl.GL gl, int width, int height)
          This method is used to initialize all the objects and resources that are neccessary at startup of the game.
static void main(java.lang.String[] args)
          The main method of the adventure game.
 void setActiveChapter(java.lang.String path)
          Sets the active chapter of the game.
 void setBackupCamPersp(int perspId)
          Method to backup the current camera perspective id, if the game wants to change to CLOSE_UP mode.
 void setHotSpotThatTriggeredCloseUpMode(AbstractInteractiveHotspot hs)
          Method that specifies the hotspot that was used to set the camera to CLOSE_UP mode.
 void setLoadingInfoText(java.lang.String text)
          Sets the text that gets displayed as the loading info.
 void setShadowType(ShadowType type)
          Sets the shadow type to use in the game.
 void showLoadingInfo(java.lang.String backgroundImage)
          This method can be used to display information on screen, while the render thread actually is busy with some work.
 void update(long elapsedTime)
          This method is used to update the scene and its content.
 
Methods inherited from class de.rico.engine.game.AbstractBaseGame
display, displayChanged, enableBackFaceCulling, getMainFrame, getOGLCanvas, init, initCamera, isSetDisplayFPS, resetElapsedTime, reshape, setDisplayFPS, setDisplayMode, start, stop
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Adventure getInstance()
Returns the singleton instance of the game.

Returns:
the game's singlton instance

setLoadingInfoText

public void setLoadingInfoText(java.lang.String text)
Sets the text that gets displayed as the loading info.

Parameters:
text - loading info text

setBackupCamPersp

public void setBackupCamPersp(int perspId)
Method to backup the current camera perspective id, if the game wants to change to CLOSE_UP mode.

Parameters:
perspId - id of the camera perspective to backup

setHotSpotThatTriggeredCloseUpMode

public void setHotSpotThatTriggeredCloseUpMode(AbstractInteractiveHotspot hs)
Method that specifies the hotspot that was used to set the camera to CLOSE_UP mode. It needs to be temporarily deactived to avoid side effects while in CLOSE_UP mode. That is done in the SetToCloseUp() game action.

Parameters:
hs - interactive hotspot that triggered the CLOSE_UP mode

abortCloseUpMode

public void abortCloseUpMode()
Call this method to abort the close up mode, if it should be aborted without the need of the player to abort it manually.


getShadowType

public ShadowType getShadowType()
Returns the current shadow type used in the game.

Returns:
currrent shadow type

setShadowType

public void setShadowType(ShadowType type)
Sets the shadow type to use in the game.

Parameters:
type - value from the ShadowType enumeration

showLoadingInfo

public void showLoadingInfo(java.lang.String backgroundImage)
This method can be used to display information on screen, while the render thread actually is busy with some work. This method draws things with AWT's Graphics2D object and is independent from the OpenGL render thread.

Parameters:
backgroundImage - path to image file that ought to be displayed during the loading process

initResources

public void initResources(javax.media.opengl.GLDrawable gld,
                          javax.media.opengl.GL gl,
                          int width,
                          int height)
Description copied from interface: GameIface
This method is used to initialize all the objects and resources that are neccessary at startup of the game. In your abstract game class you have to make this method abstract and call it in the init() method.

Specified by:
initResources in interface GameIface
Specified by:
initResources in class AbstractBaseGame
Parameters:
gld - GLDrawable object
gl - GL object
width - window width (important viewport initialisation)
height - window height (important viewport initialisation)

update

public void update(long elapsedTime)
Description copied from interface: GameIface
This method is used to update the scene and its content. In your abstract game class you have to make this method abstract and call it within JOGL's display() method. It significant to call this method before the draw() method that is specified in this interface, too to assure correct behaviour of the Monitor and Mirror classes.

Specified by:
update in interface GameIface
Specified by:
update in class AbstractBaseGame
Parameters:
elapsedTime - time between two frames

draw

public void draw(javax.media.opengl.GL gl)
Description copied from interface: GameIface
This method is used to draw the scene and its content. In your abstract game class you will have to make this method abstract and call it in the display() method (after the update() method).

Specified by:
draw in interface GameIface
Specified by:
draw in class AbstractBaseGame

setActiveChapter

public void setActiveChapter(java.lang.String path)
Sets the active chapter of the game. It gets loaded from from the specified file path.

Parameters:
path - path to the chapter file (.chp) to load the chapter from

getActiveChapter

public Chapter getActiveChapter()
Returns the currently active chapter of the game.

Returns:
active chapter of the game

main

public static void main(java.lang.String[] args)
The main method of the adventure game.

Parameters:
args - argument string --> args[0] must be the path to the xml file that specifies the games start chapter.