Example #1
0
  private void drawRecursive(Actor actor) {
    if (!invisibleActors && !actor.isVisible()) return;

    if (allActors) actor.debug();

    if (actor.getDebug()) {
      actor.getDebugRects(debugRects);
      for (DebugRect debugRect : debugRects) drawRect(actor, debugRect);
      debugRects.clear();
      debugRectPool.freeAll(usedRects);
      usedRects.clear();
    }

    boolean draw = true;
    Rectangle scissorBounds = null;
    if (actor instanceof Group) scissorBounds = ((Group) actor).getScissorBounds();
    if (scissorBounds != null) {
      shapes.flush();
      draw = ScissorStack.pushScissors(scissorBounds);
    }
    if (draw) {
      // Children are still rendered, even if the group has no debugging enabled.
      if (actor instanceof Group) {
        Group group = (Group) actor;
        for (Actor child : group.getChildren()) drawRecursive(child);
      }

      if (scissorBounds != null) {
        shapes.flush();
        ScissorStack.popScissors();
      }
    }
  }