Example usage for com.badlogic.gdx.utils Pool freeAll

List of usage examples for com.badlogic.gdx.utils Pool freeAll

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils Pool freeAll.

Prototype

public void freeAll(Array<T> objects) 

Source Link

Document

Puts the specified objects in the pool.

Usage

From source file:com.badlydrawngames.general.Pools.java

License:Apache License

/** Frees the items in an array to a pool.
 * @param <T> the type of item allocated in the array.
 * @param array the array of items to free.
 * @param pool the pool that the items are to be released to. */
public static <T> void freeArrayToPool(Array<T> array, Pool<T> pool) {
    pool.freeAll(array);
    array.clear();//from   ww  w  .j a  va2 s .c  o m
}

From source file:io.piotrjastrzebski.sfg.utils.PoolUtils.java

License:Open Source License

/**
 * free and clear all objects// w ww  . j  a v a  2s  . co  m
 */
public static <T extends Pool.Poolable> void dispose(Class<T> classToDispose, Array<T> toDispose) {
    Pool<T> pool = Pools.get(classToDispose);
    if (toDispose != null)
        pool.freeAll(toDispose);
    pool.clear();
}