示例#1
0
文件: Group.java 项目: btdiehr/libgdx
 /**
  * Swaps two actors. Returns false if the swap did not occur because the actors are not children
  * of this group.
  */
 public boolean swapActor(Actor first, Actor second) {
   int firstIndex = children.indexOf(first, true);
   int secondIndex = children.indexOf(second, true);
   if (firstIndex == -1 || secondIndex == -1) return false;
   children.swap(firstIndex, secondIndex);
   return true;
 }
示例#2
0
文件: Group.java 项目: btdiehr/libgdx
 /**
  * Adds an actor as a child of this group, immediately before another child actor. The actor is
  * first removed from its parent group, if any.
  */
 public void addActorBefore(Actor actorBefore, Actor actor) {
   actor.remove();
   int index = children.indexOf(actorBefore, true);
   children.insert(index, actor);
   actor.setParent(this);
   actor.setStage(getStage());
   childrenChanged();
 }
示例#3
0
文件: Group.java 项目: btdiehr/libgdx
 /**
  * Adds an actor as a child of this group, immediately after another child actor. The actor is
  * first removed from its parent group, if any.
  */
 public void addActorAfter(Actor actorAfter, Actor actor) {
   actor.remove();
   int index = children.indexOf(actorAfter, true);
   if (index == children.size) children.add(actor);
   else children.insert(index + 1, actor);
   actor.setParent(this);
   actor.setStage(getStage());
   childrenChanged();
 }