pool Class

Module: cc

deprecated: !#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

Index

Methods

Details

Methods

putInPool

Put the obj in pool.

meta description
Defined in extensions/ccpool/CCPool.js:61
Parameters
  • obj Object The need put in pool object.
Examples
---------------------------------
var sp = new _ccsg.Sprite("a.png");
this.addChild(sp);
cc.pool.putInPool(sp);
cc.pool.getFromPool(_ccsg.Sprite, "a.png");
hasObject

Check if this kind of obj has already in pool.

meta description
Returns Boolean
Defined in extensions/ccpool/CCPool.js:81
Parameters
  • objClass Object The check object class.
removeObject

Remove the obj if you want to delete it.

meta description
Defined in extensions/ccpool/CCPool.js:97
getFromPool

Get the obj from pool.

meta description
Returns Any
Defined in extensions/ccpool/CCPool.js:116
drainAllPools

Remove all objs in pool and reset the pool.

meta description
Defined in extensions/ccpool/CCPool.js:138

o used to initialize the object

_get

Get an object from pool, if no available object in the pool, null will be returned.

meta description
Returns Object | Null
Defined in cocos2d/core/platform/js.js:907
put

Put an object into the pool.

meta description
Defined in cocos2d/core/platform/js.js:925
resize

Resize the pool.

meta description
Defined in cocos2d/core/platform/js.js:941

results matching ""

    No results matching ""