|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectfang.Sprite
fang.CompositeSpriteOld
public class CompositeSpriteOld
This class extend the base Sprite class in order to allow multiple colors and shapes in a single sprite. Note: this is a new class which has not been fully tested. Testing is currently underway. Please email any bug reports to bugs@fangengine.org.
| Field Summary |
|---|
| Fields inherited from class fang.Sprite |
|---|
color, config, DEBUG_BOUNDING_BOX, DEBUG_INTERSECTS, debugBoundingBoxColor, image, optimizeForBitmap, shape, tracker, transform |
| Constructor Summary | |
|---|---|
CompositeSpriteOld()
|
|
| Method Summary | |
|---|---|
void |
addShape(Shape shape,
Color color)
adds the shape with a given color to this MultiShapeSprite. |
void |
addShape(Shape shape,
Color color,
boolean allowRescale)
adds the shape with a given color to this MultiShapeSprite. |
void |
addSprite(Sprite sprite)
|
void |
addSprite(Sprite sprite,
String name)
|
Color |
getColor(Shape shape)
gets the color assigned to this shape. |
Color |
getColor(String name)
gets the color assigned to the shape with this name. |
String[] |
getNamesOfIntersecting(Sprite sprite)
gets the names of the intersecting shapes |
Shape |
getShape()
gets the shape of this sprite in its current orientation, position and size |
Shape |
getShape(String name)
gets the particular shape in the same location, orientation, and scale in which it was originally added |
Shape[] |
getShapesIntersecting(Sprite sprite)
gets all of the shapes intersecting with another sprite. |
boolean |
hasShape(Shape shape)
|
boolean |
hasShape(String name)
|
boolean |
intersects(Sprite sprite)
determines if this sprite intersects with the other sprite |
boolean |
intersects(Sprite sprite,
Shape shape)
determines if a particular shape intersects with another sprite |
boolean |
intersects(Sprite sprite,
String name)
determines if a particular shape intersects with another sprite |
boolean |
isVisible(Shape shape)
determines if the shape is being displayed |
boolean |
isVisible(String name)
determines if the named shape is being displayed |
void |
moveToBottom(Shape shape)
moves the indicated shape to the bottom of the stack of shapes |
void |
moveToBottom(String name)
moves the indicated shape to the bottom of the stack of shapes |
void |
moveToTop(Shape shape)
moves the indicated shape to the top of the stack of shapes |
void |
moveToTop(String name)
moves the indicated shape to the top of the stack of shapes |
void |
paint(Graphics2D brush)
draws all of the visible shapes in their given colors |
void |
removeShape(Shape shape)
removes the shape from the MultiShapeSprite, possibly rescaling in order for the sprite to maintain a consistent appearance. |
void |
removeShape(Shape shape,
boolean allowRescale)
removes the shape from the MultiShapeSprite, possibly rescaling in order for the sprite to maintain a consistent appearance. |
void |
removeShape(String name)
removes the shape from the MultiShapeSprite, possibly rescaling in order for the sprite to maintain a consistent appearance. |
void |
removeShape(String name,
boolean allowRescale)
removes the shape from the MultiShapeSprite, possibly rescaling in order for the sprite to maintain a consistent appearance. |
void |
setColor(Shape shape,
Color color)
sets the color of a shape |
void |
setColor(String name,
Color color)
sets the color of a shape given its name |
void |
setShapeName(String name,
Shape shape)
gives a shape a name. |
void |
setVisible(Shape shape,
boolean vis)
sets the shape's visibility |
void |
setVisible(String name,
boolean vis)
sets the named shape's visibility |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CompositeSpriteOld()
| Method Detail |
|---|
public boolean intersects(Sprite sprite)
intersects in class Spritesprite - the other sprite
public Shape[] getShapesIntersecting(Sprite sprite)
sprite - the sprite which may or may not
be intersecting
public String[] getNamesOfIntersecting(Sprite sprite)
sprite - the other sprite to check for
intersection with
public boolean intersects(Sprite sprite,
String name)
sprite - the other spritename - the name of the shape to check
public boolean intersects(Sprite sprite,
Shape shape)
sprite - the other spriteshape - the shape to check
public void setShapeName(String name,
Shape shape)
name - the identifier for the shapeshape - the shape to identifypublic Shape getShape(String name)
name - the identifier for the shape to retrieve
public Shape getShape()
getShape in class Spritepublic Color getColor(Shape shape)
shape - the shape to check
public Color getColor(String name)
name - the name of the shape to check
public void setColor(String name,
Color color)
name - the name of the shapecolor - the color for the shape
public void setColor(Shape shape,
Color color)
shape - the shape to colorcolor - the color for the shape
public void addShape(Shape shape,
Color color,
boolean allowRescale)
shape - the shape to addcolor - the color of the shapeallowRescale - true allows the scale to
change in order to maintain a consistent
appearance, false indicates to maintain a
consistent scale and possible shrink the
appearancepublic void addSprite(Sprite sprite)
public void addSprite(Sprite sprite,
String name)
public void addShape(Shape shape,
Color color)
shape - the shape to addcolor - the color of the shapepublic void removeShape(String name)
name - the name of the shape to removepublic void removeShape(Shape shape)
shape - the shape to remove
public void removeShape(String name,
boolean allowRescale)
name - the name of the shape to removeallowRescale - true indicates that the
sprite may be resized in order to provide for
a consistent appearance, false indicates the
scale should remain consistent and the appearance
of the remaining shapes may appear larger or
smaller.public boolean isVisible(String name)
name - the name of the shape to check
public boolean isVisible(Shape shape)
shape - the shape to check
public void setVisible(String name,
boolean vis)
name - the name of the shape to altervis - true indicates the shape should
be drawn, false for invisibility
public void setVisible(Shape shape,
boolean vis)
shape - the shape to altervis - true indicates the shape should
be drawn, false for invisibility
public void removeShape(Shape shape,
boolean allowRescale)
shape - the the shape to removeallowRescale - true indicates that the
sprite may be resized in order to provide for
a consistent appearance, false indicates the
scale should remain consistent and the appearance
of the remaining shapes may appear larger or
smaller.public void paint(Graphics2D brush)
paint in class Spritebrush - the graphics used to draw withpublic boolean hasShape(String name)
public boolean hasShape(Shape shape)
public void moveToBottom(String name)
name - the name of the shape to movepublic void moveToBottom(Shape shape)
shape - the shape to movepublic void moveToTop(String name)
name - the name of the shape to movepublic void moveToTop(Shape shape)
shape - the shape to move
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||