|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pulpcore.sprite.Sprite pulpcore.sprite.Group
public class Group
A container of Sprites.
Field Summary |
---|
Fields inherited from class pulpcore.sprite.Sprite |
---|
alpha, anchorX, anchorY, angle, CENTER, DEFAULT, EAST, enabled, height, NORTH, NORTH_EAST, NORTH_WEST, pixelSnapping, SOUTH, SOUTH_EAST, SOUTH_WEST, visible, WEST, width, x, y |
Constructor Summary | |
---|---|
Group()
|
|
Group(double x,
double y)
|
|
Group(double x,
double y,
double width,
double height)
|
|
Group(int x,
int y)
|
|
Group(int x,
int y,
int width,
int height)
|
Method Summary | |
---|---|
void |
add(int index,
Sprite sprite)
Inserts a Sprite to this Group at the specified position. |
void |
add(Sprite sprite)
Adds a Sprite to this Group. |
boolean |
contains(Sprite sprite)
Returns true if this Group contains the specified Sprite. |
void |
createBackBuffer()
Creates a back buffer for this Group. |
void |
createBackBuffer(BlendMode blendMode)
Creates a back buffer for this Group, and sets the blend mode for rendering onto the back buffer. |
protected void |
drawSprite(CoreGraphics g)
Draws the sprite. |
Sprite |
findWithTag(Object tag)
Finds the Sprite whose tag is equal to the specified tag (using tag.equals(sprite.getTag()) . |
Sprite |
get(int index)
Returns the sprite at the specified position in this group. |
CoreImage |
getBackBuffer()
|
BlendMode |
getBackBufferBlendMode()
Gets this Group's blend mode for rendering onto its back buffer. |
protected int |
getNaturalHeight()
Gets the fixed-point value of the Sprite's natural height. |
protected int |
getNaturalWidth()
Gets the fixed-point value of the Sprite's natural width. |
int |
getNumSprites()
Returns the number of sprites in this group and all child groups (not counting child Groups themselves). |
int |
getNumVisibleSprites()
Returns the number of visible sprites in this group and all child groups (not counting child Groups themselves). |
ArrayList |
getRemovedSprites()
Gets a list of all of the Sprites in this Group that were removed since the last call to this method. |
boolean |
hasBackBuffer()
Checks if this Group has a back buffer. |
boolean |
isAncestorOf(Sprite sprite)
Returns true if this Group is an ancestor of the specified Sprite. |
boolean |
isOverflowClipped()
Returns true if sprites inside this Group are not visible outside the
natural bounds of this Group. |
Iterator |
iterator()
Returns an Iterator of the Sprites in this Group (in proper sequence). |
void |
moveDown(Sprite sprite)
Moves the specified Sprite down in z-order, swapping places with the first Sprite that appears below it. |
void |
moveToBottom(Sprite sprite)
Moves the specified Sprite to the bottom of the z-order, so that all the other Sprites currently in this Group appear above it. |
void |
moveToTop(Sprite sprite)
Moves the specified Sprite to the top of the z-order, so that all the other Sprites currently in this Group appear underneath it. |
void |
moveUp(Sprite sprite)
Moves the specified Sprite up in z-order, swapping places with the first Sprite that appears above it. |
void |
pack()
Packs this group so that its bounds (x, y, width, and height) match the area covered by its children. |
Sprite |
pick(int viewX,
int viewY)
Finds the top-most sprite at the specified location, or null if none is found. |
Sprite |
pickEnabledAndVisible(int viewX,
int viewY)
Finds the top-most sprite that is enabled and visible at the specified location, or null if none is found. |
void |
propertyChange(Property p)
On a property change this Sprite is marked as dirty. |
void |
remove(Sprite sprite)
Removes a Sprite from this Group. |
void |
removeAll()
Removes all Sprites from this Group. |
void |
removeBackBuffer()
Removes this Group's back buffer. |
void |
setBackBufferBlendMode(BlendMode backBufferBlendMode)
Sets this Group's blend mode for rendering onto its back buffer. |
int |
size()
Returns the number of sprites in this group. |
void |
update(int elapsedTime)
Updates all of this Sprite's properties. |
Methods inherited from class pulpcore.sprite.Sprite |
---|
bindLocationTo, bindSizeTo, clearCursor, clearDirtyRect, contains, draw, getBlendMode, getCursor, getDirtyRect, getFilter, getLocalX, getLocalY, getParent, getPixelLevelChecks, getRoot, getScene2D, getTag, getViewX, getViewX, getViewY, getViewY, intersects, isDirty, isEnabled, isEnabledAndVisible, isMouseDoubleClicked, isMouseDown, isMouseHover, isMouseOver, isMousePressed, isMouseReleased, isMouseTripleClicked, isMouseWheelRotated, isOpaque, isPick, isPickEnabledAndVisible, isTransparent, move, move, move, move, move, move, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, removeFromParent, scale, scale, scale, scale, scale, scale, scaleTo, scaleTo, scaleTo, scaleTo, scaleTo, scaleTo, setAnchor, setAnchor, setBlendMode, setCursor, setDirty, setFilter, setLocation, setLocation, setSize, setSize, setTag, translate, translate, updateDirtyRect |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Group()
public Group(int x, int y)
public Group(int x, int y, int width, int height)
public Group(double x, double y)
public Group(double x, double y, double width, double height)
Method Detail |
---|
public boolean isOverflowClipped()
true
if sprites inside this Group are not visible outside the
natural bounds of this Group.
The default implementation returns true
if the Group has a back buffer.
getNaturalWidth()
,
getNaturalHeight()
public Iterator iterator()
remove
method.
public int size()
public Sprite get(int index)
null
if
the index is out of range (index < 0 || index >= size()
).
public boolean contains(Sprite sprite)
true
if this Group contains the specified Sprite.
public boolean isAncestorOf(Sprite sprite)
true
if this Group is an ancestor of the specified Sprite.
public Sprite findWithTag(Object tag)
tag.equals(sprite.getTag())
. Returns null if the specified tag is null, or
if no Sprite with the specified tag is found.
public Sprite pick(int viewX, int viewY)
viewX
- x-coordinate in view space.viewY
- y-coordinate in view space.
public Sprite pickEnabledAndVisible(int viewX, int viewY)
This Group or it's ancestors (if any) are not checked if they are enabled or visible.
This method is useful for finding a sprite to use to set the cursor or take mouse input from.
viewX
- x-coordinate in view spaceviewY
- y-coordinate in view space
public int getNumSprites()
public int getNumVisibleSprites()
public void add(Sprite sprite)
public void add(int index, Sprite sprite)
If the index is less than zero, the sprite is inserted at position zero (the bottom in the
z-order).
If the index is greater than or equal to size()
, the sprite is inserted at
position size()
(the top in the z-order).
public void remove(Sprite sprite)
public void removeAll()
public void moveToTop(Sprite sprite)
public void moveToBottom(Sprite sprite)
public void moveUp(Sprite sprite)
public void moveDown(Sprite sprite)
public ArrayList getRemovedSprites()
This method is used by Scene2D to implement dirty rectangles.
public void pack()
public void createBackBuffer()
If this Group was created with a dimension (constructors Group(int,int,int,int)
or Group(double,double,double,double)
or has a dimension after calling
pack()
, then the back buffer has the same dimensions of this Group. Otherwise,
the back buffer has the same dimensions of the Stage.
public void createBackBuffer(BlendMode blendMode)
If this Group was created with a dimension (constructors Group(int,int,int,int)
or Group(double,double,double,double)
or has a dimension after calling
pack()
, then the back buffer has the same dimensions of this Group. Otherwise,
the back buffer has the same dimensions of the Stage.
public boolean hasBackBuffer()
public CoreImage getBackBuffer()
public void removeBackBuffer()
public void setBackBufferBlendMode(BlendMode backBufferBlendMode)
backBufferBlendMode
- the blend mode.public BlendMode getBackBufferBlendMode()
protected int getNaturalWidth()
Sprite
ImageSprite
, the natural width is the
width of the image.
getNaturalWidth
in class Sprite
protected int getNaturalHeight()
Sprite
ImageSprite
, the natural height is the
height of the image.
getNaturalHeight
in class Sprite
public void propertyChange(Property p)
Sprite
propertyChange
in interface PropertyListener
propertyChange
in class Sprite
p
- the property whose value has changed.public void update(int elapsedTime)
Sprite
update
in class Sprite
protected final void drawSprite(CoreGraphics g)
Sprite
This method may be called multiple times for each dirty rectangle. The clip of the graphics context will be set to the current dirty rectangle.
When the contents of this sprite change (in another words, the graphic output of this method
will be different from the last time it is called), subclasses should call
setDirty(true)
.
Implementors should not save a reference to the graphics context as it can change between calls to this method.
drawSprite
in class Sprite
|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |