当前位置: 首页>>代码示例>>C++>>正文


C++ CCAction::retain方法代码示例

本文整理汇总了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;
}
开发者ID:SongCF,项目名称:game-LostStar,代码行数:13,代码来源:SectionGuide.cpp

示例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;
}
开发者ID:jinjianxin,项目名称:cocos2d-x,代码行数:41,代码来源:IntroLayer3.cpp

示例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))));
}
开发者ID:jojizaidi,项目名称:Gnome,代码行数:24,代码来源:Obstacle.cpp


注:本文中的CCAction::retain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。