本文整理汇总了C++中CCRepeatForever::copy方法的典型用法代码示例。如果您正苦于以下问题:C++ CCRepeatForever::copy方法的具体用法?C++ CCRepeatForever::copy怎么用?C++ CCRepeatForever::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCRepeatForever
的用法示例。
在下文中一共展示了CCRepeatForever::copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onEnter
//------------------------------------------------------------------
//
// TextureAlias
//
//------------------------------------------------------------------
void TextureAlias::onEnter()
{
TextureDemo::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
//
// Sprite 1: GL_LINEAR
//
// Default filter is GL_LINEAR
CCSprite *sprite = CCSprite::spriteWithFile("Images/grossinis_sister1.png");
sprite->setPosition(ccp( s.width/3.0f, s.height/2.0f));
addChild(sprite);
// this is the default filterting
sprite->getTexture()->setAntiAliasTexParameters();
//
// Sprite 1: GL_NEAREST
//
CCSprite *sprite2 = CCSprite::spriteWithFile("Images/grossinis_sister2.png");
sprite2->setPosition(ccp( 2*s.width/3.0f, s.height/2.0f));
addChild(sprite2);
// Use Nearest in this one
sprite2->getTexture()->setAliasTexParameters();
// scale them to show
CCScaleBy* sc = CCScaleBy::actionWithDuration(3, 8.0f);
CCScaleBy* sc_back = (CCScaleBy*) (sc->reverse());
CCRepeatForever* scaleforever = CCRepeatForever::actionWithAction((CCActionInterval*) (CCSequence::actions(sc, sc_back, NULL)));
CCRepeatForever* scaleToo = (CCRepeatForever*) (scaleforever->copy());
scaleToo->autorelease();
sprite2->runAction(scaleforever);
sprite->runAction(scaleToo);
CCTextureCache::sharedTextureCache()->dumpCachedTextureInfo();
}
示例2: setIsTouchEnabled
//------------------------------------------------------------------
//
// ConvertToNode
//
//------------------------------------------------------------------
ConvertToNode::ConvertToNode()
{
setIsTouchEnabled(true);
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCRotateBy* rotate = CCRotateBy::actionWithDuration(10, 360);
CCRepeatForever* action = CCRepeatForever::actionWithAction(rotate);
for(int i = 0; i < 3; i++)
{
CCSprite *sprite = CCSprite::spriteWithFile("Images/grossini.png");
sprite->setPosition(ccp( s.width/4*(i+1), s.height/2));
CCSprite *point = CCSprite::spriteWithFile("Images/r1.png");
point->setScale(0.25f);
point->setPosition(sprite->getPosition());
addChild(point, 10, 100 + i);
switch(i)
{
case 0:
sprite->setAnchorPoint(CCPointZero);
break;
case 1:
sprite->setAnchorPoint(ccp(0.5f, 0.5f));
break;
case 2:
sprite->setAnchorPoint(ccp(1,1));
break;
}
point->setPosition(sprite->getPosition());
CCRepeatForever* copy = (CCRepeatForever*) action->copy();
copy->autorelease();
sprite->runAction(copy);
addChild(sprite, i);
}
}