コード例 #1
0
ファイル: Group.java プロジェクト: btdiehr/libgdx
 /**
  * Adds an actor as a child of this group, at a specific index. The actor is first removed from
  * its parent group, if any.
  */
 public void addActorAt(int index, Actor actor) {
   actor.remove();
   children.insert(index, actor);
   actor.setParent(this);
   actor.setStage(getStage());
   childrenChanged();
 }
コード例 #2
0
ファイル: Group.java プロジェクト: btdiehr/libgdx
 /**
  * Adds an actor as a child of this group. The actor is first removed from its parent group, if
  * any.
  */
 public void addActor(Actor actor) {
   actor.remove();
   children.add(actor);
   actor.setParent(this);
   actor.setStage(getStage());
   childrenChanged();
 }
コード例 #3
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();
 }
コード例 #4
0
ファイル: Group.java プロジェクト: btdiehr/libgdx
 /**
  * Removes an actor from this group. If the actor will not be used again and has actions, they
  * should be {@link Actor#clearActions() cleared} so the actions will be returned to their {@link
  * Action#setPool(com.badlogic.gdx.utils.Pool) pool}, if any. This is not done automatically.
  */
 public boolean removeActor(Actor actor) {
   if (!children.removeValue(actor, true)) return false;
   Stage stage = getStage();
   if (stage != null) stage.unfocus(actor);
   actor.setParent(null);
   actor.setStage(null);
   childrenChanged();
   return true;
 }
コード例 #5
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();
 }
コード例 #6
0
ファイル: Group.java プロジェクト: btdiehr/libgdx
 /** Removes all actors from this group. */
 public void clear() {
   Array<Actor> children = this.children;
   for (int i = 0, n = children.size; i < n; i++) {
     Actor child = children.get(i);
     child.setStage(null);
     child.setParent(null);
   }
   children.clear();
   childrenChanged();
 }
コード例 #7
0
ファイル: Group.java プロジェクト: btdiehr/libgdx
 protected void setStage(Stage stage) {
   super.setStage(stage);
   Array<Actor> children = this.children;
   for (int i = 0, n = children.size; i < n; i++) children.get(i).setStage(stage);
 }