本文整理汇总了C++中CCProgressTimer::addChild方法的典型用法代码示例。如果您正苦于以下问题:C++ CCProgressTimer::addChild方法的具体用法?C++ CCProgressTimer::addChild怎么用?C++ CCProgressTimer::addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCProgressTimer
的用法示例。
在下文中一共展示了CCProgressTimer::addChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onEnter
//------------------------------------------------------------------
//
// SpriteProgressBarTintAndFade
//
//------------------------------------------------------------------
void SpriteProgressBarTintAndFade::onEnter()
{
SpriteDemo::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCProgressTo *to = CCProgressTo::create(6, 100);
CCAction *tint = CCSequence::create(CCTintTo::create(1, 255, 0, 0),
CCTintTo::create(1, 0, 255, 0),
CCTintTo::create(1, 0, 0, 255),
NULL);
CCAction *fade = CCSequence::create(CCFadeTo::create(1.0f, 0),
CCFadeTo::create(1.0f, 255),
NULL);
CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathSister1));
left->setType(kCCProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
left->setMidpoint(ccp(0.5f, 0.5f));
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
left->setBarChangeRate(ccp(1, 0));
addChild(left);
left->setPosition(ccp(100, s.height/2));
left->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
left->runAction(CCRepeatForever::create((CCActionInterval *)tint->copy()->autorelease()));
left->addChild(CCLabelTTF::create("Tint", "Marker Felt", 20.0f));
CCProgressTimer *middle = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
middle->setType(kCCProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
middle->setMidpoint(ccp(0.5f, 0.5f));
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
middle->setBarChangeRate(ccp(1, 1));
addChild(middle);
middle->setPosition(ccp(s.width/2, s.height/2));
middle->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
middle->runAction(CCRepeatForever::create((CCActionInterval *)fade->copy()->autorelease()));
middle->addChild(CCLabelTTF::create("Fade", "Marker Felt", 20.0f));
CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
right->setType(kCCProgressTimerTypeBar);
// Setup for a bar starting from the bottom since the midpoint is 0 for the y
right->setMidpoint(ccp(0.5f, 0.5f));
// Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
right->setBarChangeRate(ccp(0, 1));
addChild(right);
right->setPosition(ccp(s.width-100, s.height/2));
right->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
right->runAction(CCRepeatForever::create((CCActionInterval *)tint->copy()->autorelease()));
right->runAction(CCRepeatForever::create((CCActionInterval *)fade->copy()->autorelease()));
right->addChild(CCLabelTTF::create("Tint and Fade", "Marker Felt", 20.0f));
}