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


C++ CCProgressTimer::setAnchorPoint方法代码示例

本文整理汇总了C++中CCProgressTimer::setAnchorPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ CCProgressTimer::setAnchorPoint方法的具体用法?C++ CCProgressTimer::setAnchorPoint怎么用?C++ CCProgressTimer::setAnchorPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCProgressTimer的用法示例。


在下文中一共展示了CCProgressTimer::setAnchorPoint方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onEnter

//------------------------------------------------------------------
//
// SpriteProgressToRadialMidpointChanged
//
//------------------------------------------------------------------
void SpriteProgressToRadialMidpointChanged::onEnter()
{
    SpriteDemo::onEnter();

    CCSize s = CCDirector::sharedDirector()->getWinSize();

    CCProgressTo *action = CCProgressTo::create(2, 100);

    /**
   *  Our image on the left should be a radial progress indicator, clockwise
   */

    CCProgressTimer *left = CCProgressTimer::progressWithFile(s_pPathBlock);
    left->setType(kCCProgressTimerTypeRadialCW);
    addChild(left);
    left->setAnchorPoint(ccp(0.25f, 0.75f));
    left->setPosition(ccp(100, s.height/2));
    left->runAction(CCRepeatForever::create((CCActionInterval *)action->copy()->autorelease()));

    /**
   *  Our image on the left should be a radial progress indicator, counter clockwise
   */
    CCProgressTimer *right = CCProgressTimer::progressWithFile(s_pPathBlock);
    right->setType(kCCProgressTimerTypeRadialCW);
    right->setAnchorPoint(ccp(0.75f, 0.25f));

    /**
   *  Note the reverse property (default=NO) is only added to the right image. That's how
   *  we get a counter clockwise progress.
   */
    addChild(right);
    right->setPosition(ccp(s.width-100, s.height/2));
    right->runAction(CCRepeatForever::create((CCActionInterval *)action->copy()->autorelease()));
}
开发者ID:qiuxu,项目名称:Cocos2dWindows,代码行数:39,代码来源:ActionsProgressTest.cpp

示例2: onEnter

void CCTransitionRadialCCW::onEnter()
{
	CCTransitionScene::onEnter();
	// create a transparent color layer
	// in which we are going to add our rendertextures
	CCSize size = CCDirector::sharedDirector()->getWinSize();

	// create the second render texture for outScene
	m_OutRT = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);

	if (NULL == m_OutRT)
		return;
	
	m_OutRT->retain();

	m_OutRT->getSprite()->setAnchorPoint(ccp(0.5f,0.5f));
	m_OutRT->setPosition(ccp(size.width/2, size.height/2));
	m_OutRT->setAnchorPoint(ccp(0.5f,0.5f));

	//	We need the texture in RenderTexture.
	CCProgressTimer *outNode = CCProgressTimer::progressWithTexture(m_OutRT->getSprite()->getTexture());
	// but it's flipped upside down so we flip the sprite
	outNode->getSprite()->setFlipY(true);

	// fix content scale factor for radial texture
	CCRect rect = CCRectZero;
	rect.size = m_OutRT->getSprite()->getTexture()->getContentSize();
	outNode->getSprite()->setTextureRect(rect, false);
	float scale = 1.0f / CC_CONTENT_SCALE_FACTOR();
	rect.size.width *= scale;
	rect.size.height *= scale;
	outNode->setContentSize(rect.size);

	//	Return the radial type that we want to use
	outNode->setType(radialType());
	outNode->setPercentage(100.f);
	outNode->setPosition(ccp(size.width/2, size.height/2));
	outNode->setAnchorPoint(ccp(0.5f,0.5f));

	// create the blend action
	CCAction * layerAction = CCSequence::actions
	(
		CCProgressFromTo::actionWithDuration(m_fDuration, 100.0f, 0.0f),
		CCEventCall::actionWithTarget(NULL, createEventHandler(this, &CCTransitionScene::_finish)),
		NULL
	);
	// run the blend action
	outNode->runAction(layerAction);

	// add the layer (which contains our two rendertextures) to the scene
	this->addChild(outNode, 2, kSceneRadial);
}
开发者ID:noriter,项目名称:nit,代码行数:52,代码来源:CCTransitionRadial.cpp

示例3: onEnter

void CCTransitionRadialCCW::onEnter()
{
	CCTransitionScene::onEnter();
	// create a transparent color layer
	// in which we are going to add our rendertextures
	CCSize size = CCDirector::sharedDirector()->getWinSize();

	// create the second render texture for outScene
	CCRenderTexture *outTexture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);

	if (NULL == outTexture)
	{
		return;
	}
	
	outTexture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f));
	outTexture->setPosition(ccp(size.width/2, size.height/2));
	outTexture->setAnchorPoint(ccp(0.5f,0.5f));

	// render outScene to its texturebuffer
	outTexture->clear(0,0,0,1);
	outTexture->begin();
	m_pOutScene->visit();
	outTexture->end();

	//	Since we've passed the outScene to the texture we don't need it.
	this->hideOutShowIn();

	//	We need the texture in RenderTexture.
	CCProgressTimer *outNode = CCProgressTimer::progressWithTexture(outTexture->getSprite()->getTexture());
	// but it's flipped upside down so we flip the sprite
	outNode->getSprite()->setFlipY(true);
	//	Return the radial type that we want to use
	outNode->setType(radialType());
	outNode->setPercentage(100.f);
	outNode->setPosition(ccp(size.width/2, size.height/2));
	outNode->setAnchorPoint(ccp(0.5f,0.5f));

	// create the blend action
	CCAction * layerAction = CCSequence::actions
	(
		CCProgressFromTo::actionWithDuration(m_fDuration, 100.0f, 0.0f),
		CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
		NULL
	);
	// run the blend action
	outNode->runAction(layerAction);

	// add the layer (which contains our two rendertextures) to the scene
	this->addChild(outNode, 2, kSceneRadial);
}
开发者ID:006,项目名称:ios_lab,代码行数:51,代码来源:CCTransitionRadial.cpp

示例4: addChild

void
MCSkillBarItem::intoColdTime()
{
    CCSprite *coldSprite = CCSprite::create(kMCColdTimeSkillIconFilepath);
    CCProgressTimer *progressTimer = CCProgressTimer::create(coldSprite);
    
    progressTimer->setReverseProgress(true);
    progressTimer->setAnchorPoint(CCPointZero);
    addChild(progressTimer);
    
    setOpacity(kMCSkillBarItemColdTimeOpacity);
    progressTimer->runAction(CCSequence::createWithTwoActions(CCProgressFromTo::create(skill_->coldTime, 100.f, 0.0f),
                                                              CCCallFuncO::create(this,
                                                                                  callfuncO_selector(MCSkillBarItem::coldTimeDidFinish),
                                                                                  progressTimer)));
}
开发者ID:edison9888,项目名称:__graduation_project,代码行数:16,代码来源:MCSkillBar.cpp

示例5: initProgressIndicator

bool ControlEngine::initProgressIndicator( int tag, cocos2d::CCPoint point, cocos2d::CCPoint anchor )
{
    CCSprite* progressIndicatorSprite = CCSprite::create( this->getProgressIndicatorName().getCString() );
    if( progressIndicatorSprite )
    {
        CCProgressTimer* progressIndicator = CCProgressTimer::create( progressIndicatorSprite );
        if( progressIndicator )
        {
            progressIndicator->ignoreAnchorPointForPosition( false );
            progressIndicator->setAnchorPoint( anchor );
            progressIndicator->setPosition( point );
            this->addChild( progressIndicator, Child::Z::progressIndicator, tag );
            return true;
        }
    }
    return false;
}
开发者ID:georgemguy,项目名称:Cocos2d-x_Photon_MultiPlatform_Test,代码行数:17,代码来源:ControlEngine.cpp

示例6: progressTimerNodeWithRenderTexture

CCProgressTimer* CCTransitionProgressRadialCW::progressTimerNodeWithRenderTexture(CCRenderTexture* texture)
{
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    
    CCProgressTimer* pNode = CCProgressTimer::create(texture->getSprite());
    
    // but it is flipped upside down so we flip the sprite
    pNode->getSprite()->setFlipY(true);
    pNode->setType( kCCProgressTimerTypeRadial );
    
    //    Return the radial type that we want to use
    pNode->setReverseDirection(true);
    pNode->setPercentage(100);
    pNode->setPosition(ccp(size.width/2, size.height/2));
    pNode->setAnchorPoint(ccp(0.5f,0.5f));
    
    return pNode;
}
开发者ID:GhostSoar,项目名称:Cocos2dWindows,代码行数:18,代码来源:CCTransitionProgress.cpp

示例7: setAttribute

void CCProgressTimerCreator::setAttribute(CCNode* pNode, const char* strName, const char* strValue, bool bCache)
{
    if(bCache)
        mAttrMap[strName] = strValue;

    else
    {
        CCProgressTimer* pProgressTimer = (CCProgressTimer*)pNode;
        if(strcmp(strName, "file") == 0 || strcmp(strName, "plist") == 0 )
            return;

        if(strcmp(strName, "type") == 0)
            pProgressTimer->setType((CCProgressTimerType)ccXmlAttrParse::toInt(strValue));

        if(strcmp(strName, "percent") == 0)
            pProgressTimer->setPercentage(ccXmlAttrParse::toFloat(strValue));

        if(strcmp(strName, "midpos") == 0)
            pProgressTimer->setMidpoint(ccXmlAttrParse::toPoint(strValue));

        if(strcmp(strName, "rate") == 0)
            pProgressTimer->setBarChangeRate(ccXmlAttrParse::toPoint(strValue));

        if(strcmp(strName, "reverse") == 0)
            pProgressTimer->setReverseProgress(ccXmlAttrParse::toBool(strValue));

        if(strcmp(strName, "anchor") == 0)
            pProgressTimer->setAnchorPoint(ccXmlAttrParse::toPoint(strValue));

        if(strcmp(strName, "color") == 0)
            pProgressTimer->setColor(ccXmlAttrParse::toColor3B(strValue));

        else
            CCNodeRGBACreator::setAttribute(pNode, strName, strValue, bCache);
    }
}
开发者ID:zhaxun,项目名称:cocos2d,代码行数:36,代码来源:ccMiscNodeCreator.cpp

示例8: init

bool FrontCoverLayer::init()
{	
	bool bRet = false;
	do {

		CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
		CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();

		CCSprite* pSprite = CCSprite::create("frontCover.png");
		// position the sprite on the center of the screen
		float scaleX = visibleSize.width/pSprite->getTexture()->getPixelsWide();
		float scaleY = visibleSize.height/pSprite->getTexture()->getPixelsHigh();
		float scale = (scaleX > scaleY) ? scaleX : scaleY;
		pSprite->setScaleX(scale);
		pSprite->setScaleY(scale);
		pSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
		this->addChild(pSprite, 0);

		//SkeletonAnimRcsManager::getInstance()->LoadOneRoleRcsOnly(201);
		SkeletonAnimRcsManager::getInstance()->LoadOneRoleRcsOnly(202);
		SkeletonAnimRcsManager::getInstance()->LoadOneRoleRcsOnly(203);

		EffectSprite* effect1 = ParticleManager::Get()->createEffectSprite(202,"");
		if(effect1)
		{
			effect1->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
			effect1->getRoot()->setScale(scale);
			this->addChild(effect1, 1);
			effect1->SetAnim(kType_Play,1,true);
		}
		
		//effect1 = ParticleManager::Get()->createEffectSprite(201,"");
		//if(effect1)
		//{
		//	effect1->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
		//	effect1->getRoot()->setScale(scale);
		//	this->addChild(effect1, 1);
		//	effect1->SetAnim(kType_Play,1,true);
		//}

		effect1 = ParticleManager::Get()->createEffectSprite(203,"");
		if(effect1)
		{
			effect1->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
			effect1->getRoot()->setScale(scale);
			this->addChild(effect1, 1);
			effect1->SetAnim(kType_Play,1,true);
		}

		CCSprite* spriteFrame = CCSprite::create("frontCoverFrame.png");	
		spriteFrame->setScaleX(scale);
		spriteFrame->setScaleY(scale);
		spriteFrame->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
		this->addChild(spriteFrame, 2);

		schedule(schedule_selector(FrontCoverLayer::update), 1);
        //ASprite *as = AspriteManager::getInstance()->getAsprite(KUI_BIN);
        //CCPoint pt;
        //CCSprite* bar = as->getSpriteFromFrame_Middle(map_ui_FRAME_EQUIPMENT_BAR_EXP, 0, pt);
        //CCSprite* barFrame = as->getSpriteFromFrame_Middle(map_ui_FRAME_EQUIPMENT_FRAME_EXP, 0, pt);
        
        CCSprite* barFrame = CCSprite::create("load0001.png");
        barFrame->setPosition(ccp(visibleSize.width/2, visibleSize.height/6));
        addChild(barFrame);
        
        CCSprite* sp = CCSprite::create("load0002.png");
        CCProgressTimer *progressBar = CCProgressTimer::create(sp);
        barFrame->addChild(progressBar,-1);
        progressBar->setPosition(ccp(6, barFrame->getContentSize().height/2-4));
        
        progressBar->setType(kCCProgressTimerTypeBar);
        progressBar->setAnchorPoint(ccp(0,0));
        progressBar->setMidpoint(ccp(0,0));
        progressBar->setBarChangeRate(ccp(1,0));
        progressBar->setPercentage(0.0f);

        _downloadTTF = CCLabelTTF::create("0%", KJLinXin, 15);
        _downloadTTF->setColor(ccORANGE);
        barFrame->addChild(_downloadTTF);
        _downloadTTF->setPosition(ccp(barFrame->getContentSize().width/2,barFrame->getContentSize().height/2));

        _downloadBar = progressBar;
        //_downloadBar->retain();
        
        _barFrame = barFrame;
        _barFrame->retain();
        
        
        GameResourceManager::sharedManager()->updateResource();
        
		GameAudioManager::sharedManager()->playLoadingBGM();
        
		const char* vision = LuaTinkerManager::Get()->callLuaFunc<char *>("Script/main.lua", "getVisionNum");
		m_visionLabel = CCLabelTTF::create(vision,KJLinXin,20);
		if(m_visionLabel)
		{
			float scale = UIManager::sharedManager()->getScaleFactor();
			m_visionLabel->setColor(ccWHITE);
			m_visionLabel->setScale(scale);
			addChild(m_visionLabel);
//.........这里部分代码省略.........
开发者ID:niuzb,项目名称:hellopetclient,代码行数:101,代码来源:FrontCoverLayer.cpp


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