|
libgdx API | |||||||||
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
A group is an Actor that contains other Actors (also other Groups which are Actors).
Field Summary | |
---|---|
protected Matrix4 |
batchTransform
|
protected java.util.List<Actor> |
children
|
protected Rectangle |
cullingArea
|
static boolean |
debug
|
static Texture |
debugTexture
|
protected java.util.List<Group> |
groups
|
protected java.util.List<Actor> |
immutableChildren
|
protected java.util.List<Group> |
immutableGroups
|
Actor |
lastTouchedChild
|
protected Matrix3 |
localTransform
|
protected ObjectMap<java.lang.String,Actor> |
namesToActors
|
protected Matrix4 |
oldBatchTransform
|
protected Vector2 |
point
|
boolean |
transform
|
protected Matrix3 |
worldTransform
|
Fields inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
---|
actions, color, height, name, originX, originY, parent, rotation, scaleX, scaleY, stage, touchable, visible, width, x, y |
Constructor Summary | |
---|---|
Group()
|
|
Group(java.lang.String name)
Creates a new Group with the given name. |
Method Summary | |
---|---|
void |
act(float delta)
|
void |
addActor(Actor actor)
Adds an Actor to this Group. |
void |
addActorAfter(Actor actorAfter,
Actor actor)
Adds an Actor after the given Actor. |
void |
addActorAt(int index,
Actor actor)
Adds an Actor at the given index in the group. |
void |
addActorBefore(Actor actorBefore,
Actor actor)
Adds an Actor before the given Actor. |
protected void |
applyTransform(SpriteBatch batch)
|
protected void |
childrenChanged()
Called when actors are added to or removed from the group. |
void |
clear()
Clears this Group, removing all contained Actor s. |
static void |
disableDebugging()
|
void |
draw(SpriteBatch batch,
float parentAlpha)
Draws the Actor. |
protected void |
drawChild(Actor child,
SpriteBatch batch,
float parentAlpha)
|
protected void |
drawChildren(SpriteBatch batch,
float parentAlpha)
|
static void |
enableDebugging(java.lang.String debugTextureFile)
|
Actor |
findActor(java.lang.String name)
Finds the Actor with the given name in this Group and its children. |
java.util.List<Actor> |
getActors()
|
java.util.List<Group> |
getGroups()
|
Actor |
hit(float x,
float y)
|
boolean |
isDescendant(Actor actor)
|
void |
removeActor(Actor actor)
Removes an Actor from this Group. |
void |
removeActorRecursive(Actor actor)
Removes an Actor from this Group recursively by checking if the Actor is in this group or one of its child-groups. |
protected void |
resetTransform(SpriteBatch batch)
|
void |
setCullingArea(Rectangle cullingArea)
|
void |
sortChildren(java.util.Comparator<Actor> comparator)
Sorts the children via the given Comparator . |
boolean |
swapActor(Actor first,
Actor second)
Swap two actors' sort order by reference. |
boolean |
swapActor(int first,
int second)
Swap two actors' sort order by index. |
static void |
toChildCoordinates(Actor child,
float x,
float y,
Vector2 out)
Transforms the coordinates given in the child's parent coordinate system to the child Actor 's coordinate system. |
void |
toLocalCoordinates(Actor descendant,
Vector2 point)
Converts coordinates for this group to those of a descendant actor. |
boolean |
touchDown(float x,
float y,
int pointer)
|
boolean |
touchMoved(float x,
float y)
|
protected Matrix4 |
updateTransform()
|
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
---|
action, clearActions, getStage, isMarkedToRemove, keyDown, keyTyped, keyUp, markToRemove, remove, scrolled, toLocalCoordinates, toString, touchDragged, touchUp |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static Texture debugTexture
public static boolean debug
protected final java.util.List<Actor> children
protected final java.util.List<Actor> immutableChildren
protected final java.util.List<Group> groups
protected final java.util.List<Group> immutableGroups
protected final ObjectMap<java.lang.String,Actor> namesToActors
protected final Matrix3 localTransform
protected final Matrix3 worldTransform
protected final Matrix4 batchTransform
protected final Matrix4 oldBatchTransform
public boolean transform
public Actor lastTouchedChild
protected Rectangle cullingArea
protected final Vector2 point
Constructor Detail |
---|
public Group()
public Group(java.lang.String name)
name
- the name of the groupMethod Detail |
---|
public void act(float delta)
act
in class Actor
public void draw(SpriteBatch batch, float parentAlpha)
Actor
FadeIn
and
other Actions to have an effect even if they are only set on the parent of the Actor.
draw
in class Actor
batch
- the spritebatch to render withparentAlpha
- the parent's alpha value.protected void drawChildren(SpriteBatch batch, float parentAlpha)
protected void drawChild(Actor child, SpriteBatch batch, float parentAlpha)
protected void applyTransform(SpriteBatch batch)
protected Matrix4 updateTransform()
protected void resetTransform(SpriteBatch batch)
public void setCullingArea(Rectangle cullingArea)
setCullingArea
in interface Cullable
cullingArea
- The culling area in the child actor's coordinates.public boolean touchDown(float x, float y, int pointer)
touchDown
in class Actor
public boolean touchMoved(float x, float y)
touchMoved
in class Actor
public Actor hit(float x, float y)
hit
in class Actor
protected void childrenChanged()
public void addActor(Actor actor)
Actor
to this Group. The order Actors are added is reversed for hit testing.
actor
- the Actorpublic void addActorAt(int index, Actor actor)
Actor
at the given index in the group. The first Actor added will be at index 0 and so on. Throws an
IndexOutOfBoundsException in case the index is invalid.
index
- the index to add the actor at.public void addActorBefore(Actor actorBefore, Actor actor)
Actor
before the given Actor.
actorBefore
- the Actor to add the other actor in front ofactor
- the Actor to addpublic void addActorAfter(Actor actorAfter, Actor actor)
Actor
after the given Actor.
actorAfter
- the Actor to add the other Actor behindactor
- the Actor to addpublic void removeActor(Actor actor)
Actor
from this Group.
actor
- public void removeActorRecursive(Actor actor)
Actor
from this Group recursively by checking if the Actor is in this group or one of its child-groups.
actor
- the Actorpublic Actor findActor(java.lang.String name)
Actor
with the given name in this Group and its children.
name
- the name of the Actor
public boolean swapActor(int first, int second)
first
- first Actor indexsecond
- second Actor index
public boolean swapActor(Actor first, Actor second)
first
- first Actorsecond
- second Actor
public java.util.List<Actor> getActors()
Actor
s as an ordered list.public java.util.List<Group> getGroups()
Group
s as an unordered list.public void clear()
Actor
s.
public void sortChildren(java.util.Comparator<Actor> comparator)
Comparator
.
comparator
- the comparator.public void toLocalCoordinates(Actor descendant, Vector2 point)
java.lang.IllegalArgumentException
- if the specified actor is not a descendant of this group.public boolean isDescendant(Actor actor)
public static void toChildCoordinates(Actor child, float x, float y, Vector2 out)
Actor
's coordinate system.
child
- the child Actorx
- the x-coordinate in the Group's coordinate systemy
- the y-coordinate in the Group's coordinate systemout
- the output Vector2
public static void enableDebugging(java.lang.String debugTextureFile)
public static void disableDebugging()
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |