List of usage examples for com.badlogic.gdx.scenes.scene2d Actor hasParent
public boolean hasParent()
From source file:com.blastedstudios.gdxworld.util.ui.Scene2DUtils.java
License:Apache License
/** @return the highest parent in the hierarchy tree of the given actor */ public static Group lastParent(Actor actor) { if (!actor.hasParent()) return null; Group parent = actor.getParent(); while (parent.hasParent()) parent = parent.getParent();/* w w w . j a v a2 s .c o m*/ assert !parent.hasParent(); return parent; }
From source file:com.blastedstudios.gdxworld.util.ui.Scene2DUtils.java
License:Apache License
/** @param actor the actor which position in stage coordinates to return * @return the position of the given actor in the stage coordinate system */ public static Vector2 positionInStageCoordinates(Actor actor) { if (actor.hasParent()) actor.localToStageCoordinates(tmp.set(0, 0)); else//from ww w. j a v a2s . co m tmp.set(actor.getX(), actor.getY()); return tmp; }