Package com.badlogic.gdx.scenes.scene2d

Examples of com.badlogic.gdx.scenes.scene2d.Actor


    if (children.isEmpty()) {
      add(new Label(text, style));
      return;
    }
    for (int i = 0; i < children.size(); i++) {
      Actor child = children.get(i);
      if (child instanceof Label) {
        ((Label)child).setText(text);
        return;
      }
    }
View Full Code Here


    throw new GdxRuntimeException("No child label was found.");
  }

  public String getText () {
    for (int i = 0; i < children.size(); i++) {
      Actor child = children.get(i);
      if (child instanceof Label) return ((Label)child).getText();
    }
    throw new GdxRuntimeException("No child label was found.");
  }
View Full Code Here

        setBackground(isChecked ? style.checked : style.up);
      offsetX = style.unpressedOffsetX;
      offsetY = style.unpressedOffsetY;
    }
    for (int i = 0; i < children.size(); i++) {
      Actor child = children.get(i);
      child.x += offsetX;
      child.y += offsetY;
    }
    super.draw(batch, parentAlpha);
    for (int i = 0; i < children.size(); i++) {
      Actor child = children.get(i);
      child.x -= offsetX;
      child.y -= offsetY;
    }
  }
View Full Code Here

  public void layout () {
    if (!needsLayout) return;
    needsLayout = false;
    for (int i = 0, n = children.size(); i < n; i++) {
      Actor actor = children.get(i);
      actor.x = 0;
      actor.y = 0;
      actor.width = width;
      actor.height = height;
      if (actor instanceof Layout) {
View Full Code Here

  public void click () {
    if (listener != null) listener.click(this);
  }

  public Actor hit (float x, float y) {
    Actor child = super.hit(x, y);
    if (child != null) return child;
    return x > 0 && x < width && y > 0 && y < height ? this : null;
  }
View Full Code Here

    drawDebug(stage.getActors(), stage.getSpriteBatch());
  }

  static private void drawDebug (List<Actor> actors, SpriteBatch batch) {
    for (int i = 0, n = actors.size(); i < n; i++) {
      Actor actor = actors.get(i);
      if (actor instanceof Table) ((Table)actor).layout.drawDebug(batch);
      if (actor instanceof Group) drawDebug(((Group)actor).getActors(), batch);
    }
  }
View Full Code Here

  }

  boolean tap (int x, int y) {
    focus(null, 0);
    if (!super.touchDown(x, y, 0)) return false;
    Actor actor = focusedActor[0];
    toLocalCoordinates(actor, point);
    actor.touchUp(point.x, point.y, 0);
    return true;
  }
View Full Code Here

  public Actor registerImage (String name) {
    return register(new Image(name, atlas.findRegion(name)));
  }

  public Actor getWidget (String name) {
    Actor actor = super.getWidget(name);
    if (actor == null) actor = getTable().findActor(name);
    return actor;
  }
View Full Code Here

    List<Cell> cells = getCells();
    for (int i = 0, n = cells.size(); i < n; i++) {
      Cell c = cells.get(i);
      if (c.getIgnore()) continue;
      Actor actor = (Actor)c.getWidget();
      actor.x = c.getWidgetX();
      int widgetHeight = c.getWidgetHeight();
      actor.y = table.height - c.getWidgetY() - widgetHeight;
      actor.width = c.getWidgetWidth();
      actor.height = widgetHeight;
View Full Code Here

  }

  /** Invalides the layout of this widget and every parent widget to the root of the hierarchy. */
  public void invalidateHierarchy () {
    invalidate();
    Actor parent = getTable().parent;
    while (parent != null) {
      if (parent instanceof Layout) ((Layout)parent).invalidate();
      parent = parent.parent;
    }
  }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.scenes.scene2d.Actor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.