vooga.gameEngine.item
Class PlacedText

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

public class PlacedText
extends StaticItem

Class PlacedText represents text that is displayed statically on screen. The text can be changed with the #setText(String, boolean) method which will maintain the same appearance as the original text.

Author:
Justin C. Klaassen
See Also:
Serialized Form

Field Summary
static int CENTER
          For center justified text.
static int LEFT
          For left justified text.
static int RIGHT
          For right justified text.
 
Constructor Summary
PlacedText(TextTexture t, int index, Tangible b, int alignment)
           Creates a new PlacedText object from a TextTexture.
 
Method Summary
 java.lang.String getText()
          Method for getting the current text displayed by this object.
 void setText(java.lang.String text)
          Sets the text to a new message while maintaining the same look and feel of the previously displayed text.
 
Methods inherited from class vooga.gameEngine.item.StaticItem
positionChanged, rotationChanged, sizeChanged
 
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
 

Field Detail

LEFT

public static final int LEFT
For left justified text.

See Also:
Constant Field Values

CENTER

public static final int CENTER
For center justified text.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
For right justified text.

See Also:
Constant Field Values
Constructor Detail

PlacedText

public PlacedText(TextTexture t,
                  int index,
                  Tangible b,
                  int alignment)

Creates a new PlacedText object from a TextTexture. This object will listen and respond to the camera in order to maintain its size and position on the screen.

A negative alignment will cause the object to be left aligned, 0 will cause the object to be center aligned, and a positive number will cause the object to be right aligned.

Parameters:
t - is the TextTexture used to represent this object
index - represents the layer on which this will be displayed
b - is the Tangible item bounding this one
alignment - represents whether the text is left, center, or right justified.
Method Detail

setText

public void setText(java.lang.String text)
Sets the text to a new message while maintaining the same look and feel of the previously displayed text.

Parameters:
text -

getText

public java.lang.String getText()
Method for getting the current text displayed by this object.

Returns:
the String represented by the rendering of this object