本文整理汇总了C++中CCAction::retain方法的典型用法代码示例。如果您正苦于以下问题:C++ CCAction::retain方法的具体用法?C++ CCAction::retain怎么用?C++ CCAction::retain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCAction
的用法示例。
在下文中一共展示了CCAction::retain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createClickAct_retain
CCAction* SectionGuide::createClickAct_retain()
{
string frames[] = {
ResManager::getManager()->getSharedFilePath("finger.png"),
ResManager::getManager()->getSharedFilePath("finger-Press.png"),
ResManager::getManager()->getSharedFilePath("finger.png"),
ResManager::getManager()->getSharedFilePath("finger-Press.png"),
ResManager::getManager()->getSharedFilePath("finger.png")
};
CCAction* act = (CCFiniteTimeAction*)SpriteHelper::createAction(frames, 5, 0.5f,false);
act->retain();
return act;
}
示例2:
bool IntroLayer3::init()
{
if(!CCLayer::init())
return false;
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Menus/Intro/Intro.plist");
//CCSpriteFrame *firstFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bgIntro31.png");
CCSprite *firstFrame = CCSprite::create("Menus/Intro/bgIntro31.png");
this->addChild(firstFrame);
CCSize size = CCDirector::sharedDirector()->getWinSize();
firstFrame->setPosition(ccp(size.width/2,size.height/2));
CCArray *frameArray = CCArray::create();
frameArray->retain();
for(int i =1;i<4;i++)
{
CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
CCString::createWithFormat("bgIntro3%d.png",i)->getCString()
);
frameArray->addObject(frame);
}
CCAnimation *animation = CCAnimation::createWithSpriteFrames(frameArray,1.0f);
CCAnimate *animate = CCAnimate::create(animation);
CCAction *loopAction = CCSequence::create(animate,CCCallFunc::create(this,callfunc_selector(IntroLayer3::startGame)),NULL);
loopAction->retain();
firstFrame->runAction(loopAction);
//firstFrame->runAction()
return true;
}
示例3: SpawnCrow
void Obstacle::SpawnCrow(int xOffset)
{
CCArray *allFrames = new CCArray();
for (int i = 0 ; i <= 14 ; i++)
{
char fn[64];
sprintf(fn, "Fly00%d.png" , i );
allFrames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(fn));
}
CCAnimation *crowAnim = CCAnimation::createWithSpriteFrames(allFrames, 0.04f * 1);
CCAction *crowAction = CCRepeatForever::create(CCAnimate::create(crowAnim));
crowAction->retain();
obstacleSprite = CCSprite::createWithSpriteFrameName("Fly000.png");
obstacleSprite->setPosition(ccp(winSize.width + xOffset * SPAWN_OFFSET , winSize.height - obstacleSprite->getContentSize().height));
this->addChild(obstacleSprite);
obstacleSprite->runAction(crowAction);
moveOnce = true;
// obstacleSprite->runAction(CCSequence::createWithTwoActions(CCMoveTo::create(1,
// ccp( winSize.width - obstacleSprite->getContentSize().width , obstacleSprite->getPosition().y)),
// CCCallFunc::create(this, callfunc_selector(Obstacle::MoveCrow))));
}