vooga.gameEngine.item
Class StaticItem

java.lang.Object
  extended by vooga.gameEngine.game.GameRelatedObject
      extended by vooga.gameEngine.item.GameItem
          extended by vooga.gameEngine.item.StaticItem
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Renderable>, java.util.EventListener, Renderable, Tangible, PositionChangeListener, RotationChangeListener, SizeChangeListener, TangibleListener
Direct Known Subclasses:
InfoBar, MenuScreen, PlacedText

public class StaticItem
extends GameItem
implements TangibleListener

Class StaticItem represents a GameItem that is static in terms of size, position, and rotation relative to some other item. This object is capable of listening to the Tangible item and changes size, position, and rotation accordingly. If the passed Tangible object is a GameRelatedObject then this object will automatically be added as a listener to the Tangible item.

Author:
Justin C. Klaassen
See Also:
Serialized Form

Constructor Summary
StaticItem(Texture t, int index, Tangible b)
          Creates a new StaticItem from a given Texture with a specified index (lower indexes are rendered first).
 
Method Summary
 void positionChanged(PositionChangedEvent e)
          This is called whenever a Tangible object updates its position.
 void rotationChanged(RotationChangedEvent e)
          This is called whenever a Tangible object changes its rotation.
 void sizeChanged(SizeChangedEvent e)
          This is called whenever a Tangible object updates its position.
 
Methods inherited from class vooga.gameEngine.item.GameItem
compareTo, getPosition, getRotation, getShape, getSize, getTexture, isVisible, move, resize, rotate, setPosition, setRotation, setSize, setVisibility
 
Methods inherited from class vooga.gameEngine.game.GameRelatedObject
addEventListener, clearListeners, equals, fire, fire, fire, getEventListeners, getID, getListenerCount, removeEventListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticItem

public StaticItem(Texture t,
                  int index,
                  Tangible b)
Creates a new StaticItem from a given Texture with a specified index (lower indexes are rendered first). The initial size, position, and rotation of the texture relative to the Tangible item will determine how the object is represented relative to that item no matter how that item is changed.

Parameters:
t - is the Texture to be used
index - represents what layer to draw the item on
b - is the Tangible this item should listen to (automatically added if it is a GameRelatedObject).
Method Detail

positionChanged

public void positionChanged(PositionChangedEvent e)
Description copied from interface: PositionChangeListener
This is called whenever a Tangible object updates its position.

Specified by:
positionChanged in interface PositionChangeListener
Parameters:
e - the PositionChangedEvent

rotationChanged

public void rotationChanged(RotationChangedEvent e)
Description copied from interface: RotationChangeListener
This is called whenever a Tangible object changes its rotation.

Specified by:
rotationChanged in interface RotationChangeListener
Parameters:
e - the RotationChangedEvent

sizeChanged

public void sizeChanged(SizeChangedEvent e)
Description copied from interface: SizeChangeListener
This is called whenever a Tangible object updates its position.

Specified by:
sizeChanged in interface SizeChangeListener
Parameters:
e - the PositionChangedEvent