Package com.badlogic.gdx.scenes.scene2d

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


      else
        debugRenderer = new ImmediateModeRenderer10(64);
    }

    Table table = getTable();
    Actor parent = table.parent;
    float x = table.x, y = 0;
    while (parent != null) {
      if (parent instanceof Group) {
        x += parent.x;
        y += parent.y;
View Full Code Here


    /**
     * @see Visualisation#updateActor(java.lang.String, float, float, float)
     */
    @Override
    public void updateActor(String name, float posX, float posY, float rotation) {
        Actor actor = m_actors.get(name);
        actor.x = posX;
        actor.y = posY;
        actor.rotation = rotation;
    }
View Full Code Here

    /**
     * @see Visualisation#deleteActor(java.lang.String)
     */
    @Override
    public void deleteActor(String name, boolean menu) {
        Actor a = m_actors.get(name);
        m_gameGDX.removeActor(a, menu);
        m_actors.remove(name);
    }
View Full Code Here

        m_actors.remove(name);
    }

    @Override
    public void deleteTextActor(String name, boolean menu) {
        Actor a = m_textActors.get(name);
        m_gameGDX.removeActor(a, menu);
        m_textActors.remove(name);
    }
View Full Code Here

        m_textActors.remove(name);
    }

    @Override
    public void deleteLineActor(String name, boolean menu) {
        Actor a = m_lineActors.get(name);
        m_gameGDX.removeActor(a, menu);
        m_lineActors.remove(name);
    }
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

      debugRenderer.end();
    }

    static void draw (Array<Actor> actors) {
      for (int i = 0, n = actors.size; i < n; i++) {
        Actor actor = actors.get(i);
        if (!actor.isVisible()) continue;
        if (actor instanceof Table) draw((Table)actor);
        if (actor instanceof Group) draw(((Group)actor).getChildren());
      }
    }
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.