Package com.badlogic.gdx.scenes.scene2d

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


      if (table.debug == Debug.none) return;
      Array<DebugRect> debugRects = table.debugRects;
      if (debugRects == null) return;

      float x = 0, y = 0;
      Actor parent = table;
      while (parent != null) {
        if (parent instanceof Group) {
          x += parent.getX();
          y += parent.getY();
        }
        parent = parent.getParent();
      }

      for (int i = 0, n = debugRects.size; i < n; i++) {
        DebugRect rect = debugRects.get(i);
        float x1 = x + rect.x;
View Full Code Here


    selected = null;
    scroll.list.setTouchable(Touchable.disabled);
    Stage stage = scroll.getStage();
    if (stage != null) {
      if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null;
      Actor actor = stage.getScrollFocus();
      if (actor == null || actor.isDescendantOf(scroll)) stage.setScrollFocus(previousScrollFocus);
    }
    scroll.addAction(sequence(fadeOut(0.15f, Interpolation.fade), removeActor()));
  }
View Full Code Here

      clearActions();
      getColor().a = 0;
      addAction(fadeIn(0.3f, Interpolation.fade));

      previousScrollFocus = null;
      Actor actor = stage.getScrollFocus();
      if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor;

      stage.setScrollFocus(this);
    }
View Full Code Here

      stage.setScrollFocus(this);
    }

    @Override
    public Actor hit (float x, float y, boolean touchable) {
      Actor actor = super.hit(x, y, touchable);
      return actor != null ? actor : this;
    }
View Full Code Here

  /** Removes all actors and cells from the table. */
  public void clearChildren () {
    Array<Cell> cells = this.cells;
    for (int i = cells.size - 1; i >= 0; i--) {
      Cell cell = cells.get(i);
      Actor actor = cell.actor;
      if (actor != null) actor.remove();
    }
    cellPool.freeAll(cells);
    cells.clear();
    rows = 0;
    columns = 0;
View Full Code Here

        float actorWidth = Math.round(c.actorWidth);
        float actorHeight = Math.round(c.actorHeight);
        float actorX = Math.round(c.actorX);
        float actorY = height - Math.round(c.actorY) - actorHeight;
        c.setActorBounds(actorX, actorY, actorWidth, actorHeight);
        Actor actor = c.actor;
        if (actor != null) actor.setBounds(actorX, actorY, actorWidth, actorHeight);
      }
    } else {
      for (int i = 0, n = cells.size; i < n; i++) {
        Cell c = cells.get(i);
        float actorHeight = c.actorHeight;
        float actorY = height - c.actorY - actorHeight;
        c.setActorY(actorY);
        Actor actor = c.actor;
        if (actor != null) actor.setBounds(c.actorX, actorY, c.actorWidth, actorHeight);
      }
    }
    // Validate children separately from sizing actors to ensure actors without a cell are validated.
    Array<Actor> children = getChildren();
    for (int i = 0, n = children.size; i < n; i++) {
      Actor child = children.get(i);
      if (child instanceof Layout) ((Layout)child).validate();
    }
  }
View Full Code Here

    float spaceRightLast = 0;
    for (int i = 0; i < cellCount; i++) {
      Cell c = cells.get(i);
      int column = c.column, row = c.row, colspan = c.colspan;
      Actor a = c.actor;

      // Collect columns/rows that expand.
      if (c.expandY != 0 && expandHeight[row] == 0) expandHeight[row] = c.expandY;
      if (colspan == 1 && c.expandX != 0 && expandWidth[column] == 0) expandWidth[column] = c.expandX;

      // Compute combined padding/spacing for cells.
      // Spacing between actors isn't additive, the larger is used. Also, no spacing around edges.
      c.computedPadLeft = c.padLeft.get(a) + (column == 0 ? 0 : Math.max(0, c.spaceLeft.get(a) - spaceRightLast));
      c.computedPadTop = c.padTop.get(a);
      if (c.cellAboveIndex != -1) {
        Cell above = cells.get(c.cellAboveIndex);
        c.computedPadTop += Math.max(0, c.spaceTop.get(a) - above.spaceBottom.get(a));
      }
      float spaceRight = c.spaceRight.get(a);
      c.computedPadRight = c.padRight.get(a) + ((column + colspan) == columns ? 0 : spaceRight);
      c.computedPadBottom = c.padBottom.get(a) + (row == rows - 1 ? 0 : c.spaceBottom.get(a));
      spaceRightLast = spaceRight;

      // Determine minimum and preferred cell sizes.
      float prefWidth = c.prefWidth.get(a);
      float prefHeight = c.prefHeight.get(a);
      float minWidth = c.minWidth.get(a);
      float minHeight = c.minHeight.get(a);
      float maxWidth = c.maxWidth.get(a);
      float maxHeight = c.maxHeight.get(a);
      if (prefWidth < minWidth) prefWidth = minWidth;
      if (prefHeight < minHeight) prefHeight = minHeight;
      if (maxWidth > 0 && prefWidth > maxWidth) prefWidth = maxWidth;
      if (maxHeight > 0 && prefHeight > maxHeight) prefHeight = maxHeight;

      if (colspan == 1) { // Spanned column min and pref width is added later.
        float hpadding = c.computedPadLeft + c.computedPadRight;
        columnPrefWidth[column] = Math.max(columnPrefWidth[column], prefWidth + hpadding);
        columnMinWidth[column] = Math.max(columnMinWidth[column], minWidth + hpadding);
      }
      float vpadding = c.computedPadTop + c.computedPadBottom;
      rowPrefHeight[row] = Math.max(rowPrefHeight[row], prefHeight + vpadding);
      rowMinHeight[row] = Math.max(rowMinHeight[row], minHeight + vpadding);
    }

    // Colspan with expand will expand all spanned columns if none of the spanned columns have expand.
    outer:
    for (int i = 0; i < cellCount; i++) {
      Cell c = cells.get(i);
      if (c.expandX == 0) continue;
      int column = c.column;
      int nn = column + c.colspan;
      for (int ii = column; ii < nn; ii++)
        if (expandWidth[ii] != 0) continue outer;
      int expandX = c.expandX;
      for (int ii = column; ii < nn; ii++)
        expandWidth[ii] = expandX;
    }

    // Distribute any additional min and pref width added by colspanned cells to the columns spanned.
    for (int i = 0; i < cellCount; i++) {
      Cell c = cells.get(i);
      int colspan = c.colspan;
      if (colspan == 1) continue;
      int column = c.column;

      Actor a = c.actor;
      float minWidth = c.minWidth.get(a);
      float prefWidth = c.prefWidth.get(a);
      float maxWidth = c.maxWidth.get(a);
      if (prefWidth < minWidth) prefWidth = minWidth;
      if (maxWidth > 0 && prefWidth > maxWidth) prefWidth = maxWidth;
View Full Code Here

    // Determine actor and cell sizes (before expand or fill).
    for (int i = 0; i < cellCount; i++) {
      Cell c = cells.get(i);
      int column = c.column, row = c.row;
      Actor a = c.actor;

      float spannedWeightedWidth = 0;
      for (int ii = column, nn = ii + c.colspan; ii < nn; ii++)
        spannedWeightedWidth += columnWeightedWidth[ii];
      float weightedHeight = rowWeightedHeight[row];
View Full Code Here

    SnapshotArray<Actor> list = getChildren();
   
    int size = list.size;
    for (int i = 0; i < size; i++)
    {
      Actor actor = list.get(i);
     
      if (actor instanceof Layer)
      {
        Layer layer = (Layer) actor;
       
View Full Code Here

    SnapshotArray<Actor> list = getChildren();
   
    int size = list.size;
    for (int i = 0; i < size; i++)
    {
      Actor actor = list.get(i);
     
      if (actor instanceof Layer)
      {
        Layer layer = (Layer) actor;
       
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.