com.badlogic.gdx.utils.Pool.freeAll()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中com.badlogic.gdx.utils.Pool.freeAll()方法的一些代码示例,展示了Pool.freeAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Pool.freeAll()方法的具体详情如下:
包路径:com.badlogic.gdx.utils.Pool
类名称:Pool
方法名:freeAll

Pool.freeAll介绍

[英]Puts the specified objects in the pool. Null objects within the array are silently ignored.

The pool does not check if an object is already freed, so the same object must not be freed multiple times.
[中]将指定的对象放入池中。数组中的空对象将被静默忽略。
池不会检查对象是否已被释放,因此不能多次释放同一对象。

代码示例

代码示例来源:origin: libgdx/libgdx

/** Frees all obtained instances. */
public void flush () {
  super.freeAll(obtained);
  obtained.clear();
}

代码示例来源:origin: libgdx/libgdx

private void clearDebugRects () {
  if (debugRects == null) return;
  DebugRect.pool.freeAll(debugRects);
  debugRects.clear();
}

代码示例来源:origin: libgdx/libgdx

/** Frees all obtained instances. */
public void flush () {
  super.freeAll(obtained);
  obtained.clear();
}

代码示例来源:origin: libgdx/libgdx

public void flush () {
    super.freeAll(obtained);
    obtained.clear();
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
  public void freeAll (Array<T> objects) {
    obtained.removeAll(objects, true);
    super.freeAll(objects);
  }
}

代码示例来源:origin: libgdx/libgdx

private void clearDebugRects () {
  if (debugRects == null) return;
  DebugRect.pool.freeAll(debugRects);
  debugRects.clear();
}

代码示例来源:origin: libgdx/libgdx

public void flush () {
    super.freeAll(obtained);
    obtained.clear();
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
  public void freeAll (Array<T> objects) {
    obtained.removeAll(objects, true);
    super.freeAll(objects);
  }
}

代码示例来源:origin: libgdx/libgdx

/** Remove all decals from batch */
protected void clear () {
  groupList.clear();
  groupPool.freeAll(usedGroups);
  usedGroups.clear();
}

代码示例来源:origin: libgdx/libgdx

/** Returns a list of {@link GridPoint2} instances along the given line, at integer coordinates.
 * @param startX the start x coordinate of the line
 * @param startY the start y coordinate of the line
 * @param endX the end x coordinate of the line
 * @param endY the end y coordinate of the line
 * @return the list of points on the line at integer coordinates */
public Array<GridPoint2> line (int startX, int startY, int endX, int endY) {
  pool.freeAll(points);
  points.clear();
  return line(startX, startY, endX, endY, pool, points);
}

代码示例来源:origin: libgdx/libgdx

/** Returns a list of {@link GridPoint2} instances along the given line, at integer coordinates.
 * @param startX the start x coordinate of the line
 * @param startY the start y coordinate of the line
 * @param endX the end x coordinate of the line
 * @param endY the end y coordinate of the line
 * @return the list of points on the line at integer coordinates */
public Array<GridPoint2> line (int startX, int startY, int endX, int endY) {
  pool.freeAll(points);
  points.clear();
  return line(startX, startY, endX, endY, pool, points);
}

代码示例来源:origin: libgdx/libgdx

/** Remove all decals from batch */
protected void clear () {
  groupList.clear();
  groupPool.freeAll(usedGroups);
  usedGroups.clear();
}

代码示例来源:origin: libgdx/libgdx

public void reset () {
  Pools.get(GlyphRun.class).freeAll(runs);
  runs.clear();
  width = 0;
  height = 0;
}

代码示例来源:origin: libgdx/libgdx

public void reset () {
  Pools.get(GlyphRun.class).freeAll(runs);
  runs.clear();
  width = 0;
  height = 0;
}

代码示例来源:origin: libgdx/libgdx

public static btCollisionShape obtainStaticNodeShape (final Node node, final boolean applyTransform) {
  getShapeParts(node, applyTransform, shapePartArray, 0, shapePartPool);
  btCollisionShape result = obtainStaticShape(shapePartArray);
  shapePartPool.freeAll(shapePartArray);
  shapePartArray.clear();
  return result;
}

代码示例来源:origin: libgdx/libgdx

public static btCollisionShape obtainStaticNodeShape (final Node node, final boolean applyTransform) {
  getShapeParts(node, applyTransform, shapePartArray, 0, shapePartPool);
  btCollisionShape result = obtainStaticShape(shapePartArray);
  shapePartPool.freeAll(shapePartArray);
  shapePartArray.clear();
  return result;
}

代码示例来源:origin: libgdx/libgdx

/** Obtain a {@link btCollisionShape} based on the specified nodes, which can be used for a static body but not for a dynamic
 * body. Depending on the specified nodes the result will be either a {@link btBvhTriangleMeshShape} or a
 * {@link btCompoundShape} of multiple btBvhTriangleMeshShape's. Where possible, the same btBvhTriangleMeshShape will be reused
 * if multiple nodes use the same (mesh) part. The node transformation (translation and rotation) will be included, but scaling
 * will be ignored.
 * @param nodes The nodes for which to obtain a node, typically this would be: `model.nodes`.
 * @return The obtained shape, if you're using reference counting then you can release the shape when no longer needed. */
public static btCollisionShape obtainStaticNodeShape (final Array<Node> nodes) {
  getShapeParts(nodes, shapePartArray, 0, shapePartPool);
  btCollisionShape result = obtainStaticShape(shapePartArray);
  shapePartPool.freeAll(shapePartArray);
  shapePartArray.clear();
  return result;
}

代码示例来源:origin: libgdx/libgdx

/** Obtain a {@link btCollisionShape} based on the specified nodes, which can be used for a static body but not for a dynamic
 * body. Depending on the specified nodes the result will be either a {@link btBvhTriangleMeshShape} or a
 * {@link btCompoundShape} of multiple btBvhTriangleMeshShape's. Where possible, the same btBvhTriangleMeshShape will be reused
 * if multiple nodes use the same (mesh) part. The node transformation (translation and rotation) will be included, but scaling
 * will be ignored.
 * @param nodes The nodes for which to obtain a node, typically this would be: `model.nodes`.
 * @return The obtained shape, if you're using reference counting then you can release the shape when no longer needed. */
public static btCollisionShape obtainStaticNodeShape (final Array<Node> nodes) {
  getShapeParts(nodes, shapePartArray, 0, shapePartPool);
  btCollisionShape result = obtainStaticShape(shapePartArray);
  shapePartPool.freeAll(shapePartArray);
  shapePartArray.clear();
  return result;
}

代码示例来源:origin: libgdx/libgdx

/** 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;
  if (rowDefaults != null) cellPool.free(rowDefaults);
  rowDefaults = null;
  implicitEndRow = false;
  super.clearChildren();
}

代码示例来源:origin: libgdx/libgdx

private void getTiles (int startX, int startY, int endX, int endY, Array<Rectangle> tiles) {
  TiledMapTileLayer layer = (TiledMapTileLayer)map.getLayers().get("walls");
  rectPool.freeAll(tiles);
  tiles.clear();
  for (int y = startY; y <= endY; y++) {
    for (int x = startX; x <= endX; x++) {
      Cell cell = layer.getCell(x, y);
      if (cell != null) {
        Rectangle rect = rectPool.obtain();
        rect.set(x, y, 1, 1);
        tiles.add(rect);
      }
    }
  }
}

相关文章