|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.Group
public class Group
2D scene graph node that may contain other actors.
Actors have a z-order equal to the order they were inserted into the group. Actors inserted later will be drawn on top of actors added earlier. Touch events that hit more than one actor are distributed to topmost actors first.
Constructor Summary | |
---|---|
Group()
|
Method Summary | |
---|---|
void |
act(float delta)
Updates the actor based on time. |
void |
addActor(Actor actor)
Adds an actor as a child of this group. |
void |
addActorAfter(Actor actorAfter,
Actor actor)
Adds an actor as a child of this group, immediately after another child actor. |
void |
addActorAt(int index,
Actor actor)
Adds an actor as a child of this group, at a specific index. |
void |
addActorBefore(Actor actorBefore,
Actor actor)
Adds an actor as a child of this group, immediately before another child actor. |
void |
clear()
Removes all children, actions, and listeners from this group. |
void |
clearChildren()
Removes all actors from this group. |
void |
draw(Batch batch,
float parentAlpha)
Draws the group and its children. |
Actor |
findActor(String name)
Returns the first actor found with the specified name. |
SnapshotArray<Actor> |
getChildren()
Returns an ordered list of child actors in this group. |
boolean |
hasChildren()
|
Actor |
hit(float x,
float y,
boolean touchable)
Returns the deepest actor that contains the specified point and is touchable and
visible , or null if no actor was hit. |
boolean |
isTransform()
|
Vector2 |
localToDescendantCoordinates(Actor descendant,
Vector2 localCoords)
Converts coordinates for this group to those of a descendant actor. |
void |
print()
Prints the actor hierarchy recursively for debugging purposes. |
boolean |
removeActor(Actor actor)
Removes an actor from this group. |
void |
setCullingArea(Rectangle cullingArea)
Children completely outside of this rectangle will not be drawn. |
void |
setTransform(boolean transform)
When true (the default), the Batch is transformed so children are drawn in their parent's coordinate system. |
boolean |
swapActor(Actor first,
Actor second)
Swaps two actors. |
boolean |
swapActor(int first,
int second)
Swaps two actors by index. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Group()
Method Detail |
---|
public void act(float delta)
Actor
Stage.act(float)
.
The default implementation calls Action.act(float)
on each action and removes actions that are complete.
act
in class Actor
delta
- Time in seconds since the last frame.public void draw(Batch batch, float parentAlpha)
applyTransform(Batch, Matrix4)
if needed, then
drawChildren(Batch, float)
, then resetTransform(Batch)
if needed.
draw
in class Actor
parentAlpha
- Should be multiplied with the actor's alpha, allowing a parent's alpha to affect all children.public void setCullingArea(Rectangle cullingArea)
setCullingArea
in interface Cullable
cullingArea
- The culling area in the child actor's coordinates.public Actor hit(float x, float y, boolean touchable)
Actor
touchable
and
visible
, or null if no actor was hit. The point is specified in the actor's local coordinate system (0,0
is the bottom left of the actor and width,height is the upper right).
This method is used to delegate touchDown, mouse, and enter/exit events. If this method returns null, those events will not occur on this Actor.
The default implementation returns this actor if the point is within this actor's bounds.
hit
in class Actor
touchable
- If true, the hit detection will respect the touchability
.Touchable
public void addActor(Actor actor)
Actor.remove()
public void addActorAt(int index, Actor actor)
index
- May be greater than the number of children.public void addActorBefore(Actor actorBefore, Actor actor)
public void addActorAfter(Actor actorAfter, Actor actor)
public boolean removeActor(Actor actor)
cleared
so the actions will be returned to their
pool
, if any. This is not done automatically.
public void clearChildren()
public void clear()
clear
in class Actor
public Actor findActor(String name)
public boolean swapActor(int first, int second)
public boolean swapActor(Actor first, Actor second)
public SnapshotArray<Actor> getChildren()
public boolean hasChildren()
public void setTransform(boolean transform)
Batch.flush()
must be done before and after the transform. If the actors in a group are
not rotated or scaled, then the transform for the group can be set to false. In this case, each child's position will be
offset by the group's position for drawing, causing the children to appear in the correct location even though the Batch has
not been transformed.
public boolean isTransform()
public Vector2 localToDescendantCoordinates(Actor descendant, Vector2 localCoords)
IllegalArgumentException
- if the specified actor is not a descendant of this group.public void print()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |