Cocos Creator API

1.3.0

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

pool

: cc

: !#en Please use cc.NodePool instead !#zh 请使用 cc.NodePool 代替

Attention: In creator, it's strongly not recommended to use cc.pool to manager cc.Node. We provided cc.NodePool instead.

cc.pool is a singleton object serves as an object cache pool.
It can helps you to improve your game performance for objects which need frequent release and recreate operations

putInPool
(
  • obj
)

Put the obj in pool.

obj Object

The need put in pool object.

:

---------------------------------
var sp = new _ccsg.Sprite("a.png");
this.addChild(sp);
cc.pool.putInPool(sp);
cc.pool.getFromPool(_ccsg.Sprite, "a.png");

hasObject
(
  • objClass
)
Boolean

Check if this kind of obj has already in pool.

objClass Object

The check object class.

:

: Boolean

If this kind of obj is already in pool return true,else return false.

removeObject ( )

Remove the obj if you want to delete it.

getFromPool ( ) Any

Get the obj from pool.

:

: Any

Call the reuse function an return the obj.

drainAllPools ( )

Remove all objs in pool and reset the pool.

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index