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


C++ CCRepeatForever::copy方法代码示例

本文整理汇总了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();
}
开发者ID:amatuer,项目名称:cocos2d-game,代码行数:44,代码来源:Texture2dTest.cpp

示例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);
    }
}
开发者ID:issamux,项目名称:WebGame,代码行数:43,代码来源:CocosNodeTest.cpp


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