bool BugParticleBufOverflowLayer::init() { if (BugsTestBaseLayer::init()) { CCSize size = CCDirector::sharedDirector()->getWinSize(); CCParticleFlower *first = new CCParticleFlower(); first->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_stars1) ); first->initWithTotalParticles(5); first->autorelease(); first->setPosition(ccp(size.width/4, size.height/4)); addChild(first); CCParticleFlower *second = new CCParticleFlower(); second->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_stars2) ); second->initWithTotalParticles(99); second->autorelease(); second->setPosition(ccp(size.width*3/4, size.height*3/4)); addChild(second); return true; } return false; }
CCParticleFlower* CCParticleFlower::createWithTotalParticles(unsigned int numberOfParticles) { CCParticleFlower* pRet = new CCParticleFlower(); if (pRet && pRet->initWithTotalParticles(numberOfParticles)) { pRet->autorelease(); } else { CC_SAFE_DELETE(pRet); } return pRet; }
CCParticleFlower* CCParticleFlower::create() { CCParticleFlower* pRet = new CCParticleFlower(); if (pRet && pRet->init()) { pRet->autorelease(); } else { CC_SAFE_DELETE(pRet); } return pRet; }