tipgame.sprite
Class StringSprite

java.lang.Object
  extended by tipgame.Sprite
      extended by tipgame.sprite.StringSprite

public class StringSprite
extends Sprite

a simple text sprite

Author:
Jam Jenkins

Field Summary
(package private)  double baseRotation
          the original rotation of the text.
(package private)  boolean keepAspect
          true indicates the text should retain its original width and height, false means the text should be expanded to fit a square
 
Fields inherited from class tipgame.Sprite
color, tracker
 
Constructor Summary
StringSprite(java.lang.String text)
          makes a Sprite containing a String resized to fit within a square
StringSprite(java.lang.String text, boolean aspect)
          makes a Sprite containing a String
StringSprite(java.lang.String text, boolean aspect, double baseRotate)
          makes a Sprite containing a String
 
Method Summary
 double getRotation()
          gets the rotation of this sprite.
 void setHeight(double height)
          makes the size of this sprite such that the height of the text is a given number of pixels
 void setText(java.lang.String text)
          sets the text of the Sprite
 void setText(java.lang.String text, boolean aspect)
          sets the text of the Sprite
 void setWidth(double width)
          makes the size of this sprite such that the width of the text is a given number of pixels
 
Methods inherited from class tipgame.Sprite
flipAlongHorizontalAxis, flipAlongVerticalAxis, getBounds2D, getColor, getLocation, getNormalVector, getScale, getShape, getTracker, getUseBoundingBox, intersects, isDestroyed, isEnabled, isVisible, kill, normalize, paint, paintInternal, rotate, scale, setColor, setEnabled, setLocation, setLocation, setRotation, setScale, setShape, setTracker, setUseBoundingBox, setVisible, translate, update, updateInternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keepAspect

boolean keepAspect
true indicates the text should retain its original width and height, false means the text should be expanded to fit a square


baseRotation

double baseRotation
the original rotation of the text.

Constructor Detail

StringSprite

public StringSprite(java.lang.String text)
makes a Sprite containing a String resized to fit within a square

Parameters:
text - the String for the Sprite to contain

StringSprite

public StringSprite(java.lang.String text,
                    boolean aspect)
makes a Sprite containing a String

Parameters:
text - the String for the Sprite to contain
aspect - true indicates original width and height should be retained, false indicates the text should be resized to fit within a square

StringSprite

public StringSprite(java.lang.String text,
                    boolean aspect,
                    double baseRotate)
makes a Sprite containing a String

Parameters:
text - the String for the Sprite to contain
aspect - true indicates original width and height should be retained, false indicates the text should be resized to fit within a square
baseRotate - the original orientation
Method Detail

setHeight

public void setHeight(double height)
makes the size of this sprite such that the height of the text is a given number of pixels

Parameters:
height - the pixels high of the original text

setWidth

public void setWidth(double width)
makes the size of this sprite such that the width of the text is a given number of pixels

Parameters:
width - the pixels wide of the original text

setText

public void setText(java.lang.String text,
                    boolean aspect)
sets the text of the Sprite

Parameters:
text - the String for the Sprite to contain
aspect - true indicates original width and height should be retained, false indicates the text should be resized to fit within a square

setText

public void setText(java.lang.String text)
sets the text of the Sprite

Parameters:
text - the String for the Sprite to contain

getRotation

public double getRotation()
gets the rotation of this sprite. The rotation returned is minus the original base rotation

Overrides:
getRotation in class Sprite
Returns:
the positive rotation in radians less than 2*PI and zero or more
See Also:
Sprite.getRotation()