Can anybody provide a simple c++ pool of sprites?

This is how i create object

ThunderObject* thunder = new ThunderObject();

and this is how i destroy it

either 
CC_SAFE_DELETE(thunder);
or just
delete thunder;

I’ve also noticed that if i just declare it like this, project wont compile

static cocos2d::allocator::AllocatorStrategyPool<ThunderObject> _allocator;
CC_USE_ALLOCATOR_POOL(ThunderObject, _allocator);

I have to call constructor to compile it properly

allocator::AllocatorStrategyPool<ThunderObject> ThunderObject::_allocator("ThunderObjectAllocator", 40);
1 Like