cage.graphics
Class Scene

java.lang.Object
  extended by cage.graphics.Scene

public class Scene
extends java.lang.Object

A Scene is a collection of sprites and possibly an overlay which creates a scene in overall production.

Author:
Seth Marinello

Constructor Summary
Scene(java.lang.String name)
          Creates a Scene with the specified name.
 
Method Summary
 void addBinding(java.lang.Integer keyConst, Binding bind)
          Adds a binding to the bindings used for this scene.
 void addRoutine(java.lang.String name)
          Adds an action to be called each engine clock tick for this scene.
 void addSprite(Sprite s)
          Add the specified Sprite to the scene.
 java.util.Map<java.lang.Integer,Binding> getBindings()
          Returns the map of all bindings on the Scene.
 java.util.LinkedList<Sprite> getGraphics()
          Returns all of the sprites used in this scene
 java.lang.String getName()
          Gets the name of the Scene
 Overlay getOverlay()
          Searches the ResourceEngine for the overlay with this Scenes stored overlay name and returns it.
 java.lang.String getOverlayName()
          Gets the overlay name for the Scene.
 java.util.Collection<cage.carl.Closure> getRoutines()
          Returns a collection of all Closures to be called each engine tick when this scene is the current scene.
 Sprite getSprite(java.lang.String name)
          Looks for a sprite with the given name in the scene and returns it if found.
 java.lang.String getStartActionName()
          The name of the action to call when this scene is made the currentScene
 void removeBinding(java.lang.Integer keyConst)
          Remove a binding from the bindings used for this scene.
 void removeRoutine(java.lang.String name)
          Remove the specifed routine from this scene
 void setOverlayName(java.lang.String overlayName)
          Sets the name of the Overlay resource to be loaded when this scene is displayed.
 void setStartActionName(java.lang.String startActionName)
          Sets the action name to call when this scene is made current.
 java.lang.String toString()
           
 java.lang.String toXML()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Scene

public Scene(java.lang.String name)
Creates a Scene with the specified name.

Parameters:
name - The name of the scene.
Method Detail

setOverlayName

public void setOverlayName(java.lang.String overlayName)
Sets the name of the Overlay resource to be loaded when this scene is displayed.

Parameters:
overlayName - The name of the Overlay resource.

getOverlayName

public java.lang.String getOverlayName()
Gets the overlay name for the Scene.

Returns:
the overlay resource name.

getOverlay

public Overlay getOverlay()
Searches the ResourceEngine for the overlay with this Scenes stored overlay name and returns it.

Returns:
the result of getOverlay in ResourceEngine.

getName

public java.lang.String getName()
Gets the name of the Scene

Returns:
the name of the Scene

getStartActionName

public java.lang.String getStartActionName()
The name of the action to call when this scene is made the currentScene

Returns:
the name of the action to call

setStartActionName

public void setStartActionName(java.lang.String startActionName)
Sets the action name to call when this scene is made current.

Parameters:
startActionName - the name of the action to call.

getGraphics

public java.util.LinkedList<Sprite> getGraphics()
Returns all of the sprites used in this scene

Returns:
LinkedList of all sprites in the scene.

addSprite

public void addSprite(Sprite s)
Add the specified Sprite to the scene.

Parameters:
s - the Sprite to add.

getSprite

public Sprite getSprite(java.lang.String name)
Looks for a sprite with the given name in the scene and returns it if found.

Parameters:
name - The name of the Sprite to search for.
Returns:
the Sprite if found.

addBinding

public void addBinding(java.lang.Integer keyConst,
                       Binding bind)
Adds a binding to the bindings used for this scene.

Parameters:
keyConst - the value of the key the bind is for
bind - the Binding for the key value.

removeBinding

public void removeBinding(java.lang.Integer keyConst)
Remove a binding from the bindings used for this scene.

Parameters:
keyConst - the value of the key the bind is for

getBindings

public java.util.Map<java.lang.Integer,Binding> getBindings()
Returns the map of all bindings on the Scene. Scene bindings have priority over global bindings.

Returns:
map of all bindings

addRoutine

public void addRoutine(java.lang.String name)
Adds an action to be called each engine clock tick for this scene.

Parameters:
name - the name of the action to add

removeRoutine

public void removeRoutine(java.lang.String name)
Remove the specifed routine from this scene

Parameters:
name - the name of the routine to remove

getRoutines

public java.util.Collection<cage.carl.Closure> getRoutines()
Returns a collection of all Closures to be called each engine tick when this scene is the current scene.

Returns:
collection of all Closures

toXML

public java.lang.String toXML()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object