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


C++ CCPointArray类代码示例

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


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

示例1: getUnitTime

cocos2d::FiniteTimeAction* cce::CCEChannel::getSplineActions(){
	int frameCount = this->keyframes.size();
	if(frameCount==0){
		return NULL;
	}
	CCPointArray * array = CCPointArray::create(frameCount); 
	int startIndex,endIndex;
	ActionMoveFrame *lastFrame;
	for (int i = 0; i < frameCount; i++) {
		ActionMoveFrame *frame = (ActionMoveFrame *)this->keyframes.at(i);
		array->addControlPoint(frame->getPosition());
		if(i==0){
			startIndex = frame->getFrameIndex();
		}
		if(i==(frameCount-1)){
			endIndex=frame->getFrameIndex();
			lastFrame=frame;
		}
	}
	 

	float duration = (endIndex-startIndex) * getUnitTime();
	cocos2d::FiniteTimeAction *action=NULL;
	if(type=="SplineTo"){
		action= CCCardinalSplineTo::create(duration, array,0);
	}else if(type=="SplineBy"){
		action=CCCardinalSplineBy::create(duration, array,0);
	}
	if(startIndex>0){
		action = CCSequence::create(CCDelayTime::create(startIndex*getUnitTime()),action,nullptr);
	}
	return lastFrame->getEasingAction(action);
}
开发者ID:Ratel13,项目名称:cocoseditor,代码行数:33,代码来源:CCEChannel.cpp

示例2: PushFlyingBubbles

void MainScene::PushFlyingBubbles(const MatchesList_t& bubbles)
{
	size_t size = bubbles.size();
	for (size_t i = 0; i < size; ++i)
	{
		CCPointArray *array = CCPointArray::create(20);

		int x = m_BubbleViewDisplacement.x + bubbles[i].y * (BubbleElement::GetBubbleSize() + m_SpaceBetweenBubbles);
		int y = VisibleRect::top().y - m_BubbleViewDisplacement.y - BubbleElement::GetBubbleSize() - bubbles[i].x * (BubbleElement::GetBubbleSize() + m_SpaceBetweenBubbles);

		array->addControlPoint(ccp(x, y));
		array->addControlPoint(ccp(x + 30, y + 30));
		array->addControlPoint(ccp(x + 60, y + 50));
		array->addControlPoint(ccp(x + 80, y + 70));
		array->addControlPoint(ccp(750, 400));

		CCCardinalSplineTo *action = CCCardinalSplineTo::create(1.5, array, 0);
		CCFiniteTimeAction* actionMoveDone = CCCallFuncN::create( this, callfuncN_selector(MainScene::RemoveFlyingBubbles));
		CCFiniteTimeAction *seq = CCSequence::create(action, actionMoveDone, NULL);

		BubbleElement* bubble = new BubbleElement(static_cast<BubbleElement*>(m_BubblesView[bubbles[i].y][bubbles[i].x])->GetType());
	
		bubble->setPosition(CCPointMake(x, y));
		bubble->runAction(seq);
		addChild(bubble);
	}
}
开发者ID:LoveMengSi,项目名称:HungryChameleon-Andriod,代码行数:27,代码来源:MainScene.cpp

示例3: CCLOG

void PlayLayer::playBeanAnimation(CCSprite* sprite,int row,int column,bool left)
{
	CCLOG("error row = %d column = %d",row,column);
	ccBezierConfig bezier;
	int startX = sprite->getPosition().x;
	int startY = sprite->getPosition().y;
	int endX =0;
	int endY = -1*GAME_BLOCK_HEIGHT;
	if(left)
	{
		endX = -1 * rand()%120 - 50 + startX;
	}
	else
	{
		endX = rand()%120 + 50 + startX;
	}

	CCPointArray * array = CCPointArray::create(20);
	array->addControlPoint(ccp(startX,startY));
	array->addControlPoint(ccp((endX - startX)/2 + startX,startY + rand()%20 + 10));
	array->addControlPoint(ccp(endX,endY));
	float time = 1.5*row/GAME_BLOCK_ROW_NUMBER;
	if(time >= 1)
	{
		time = 1;
	}
	if(time < 0.5)
	{
		time = 0.5;
	}
	CCActionInterval  * CardinalSplineTo=CCCardinalSplineTo::create(time, array, 0);
	CCActionInterval *sequence = CCSequence::create(CardinalSplineTo,CCCallFuncND::create(this,callfuncND_selector(PlayLayer::spriteCallBack),(void*)sprite),NULL);
	sprite->runAction(sequence);
}
开发者ID:dingjundingjun,项目名称:ClickBeans,代码行数:34,代码来源:PlayLayer.cpp

示例4: sprintf

ToyBrick* DancingBoneLayer::CreateArm()
{
	//image && texture
	char path[255];
	sprintf(path, "Images/DancingBone/arm.png");

	CCImage *img = new CCImage();
	img->autorelease();
	if (!img->initWithImageFile(path, CCImage::kFmtPng))
	{
		return NULL;
	}

	CCTexture2D *texture = new CCTexture2D();
	texture->autorelease();
	if (!texture->initWithImage(img))
	{
		return NULL;
	}

	//
	ToyBrick *brick = ToyBrick::create();
	CCSize size = texture->getContentSize();
	brick->Init(texture, CCRectMake(0, 0, size.width, size.height));

	//vector (24, 102)
	CCPointArray *vector = CCPointArray::create(4);
	vector->addControlPoint(ccp(-12, -50));
	vector->addControlPoint(ccp(12, -50));
	vector->addControlPoint(ccp(12, 50));
	vector->addControlPoint(ccp(-12, 50));
	brick->SetAsPolygon(vector);

	return brick;
}
开发者ID:Whislly,项目名称:DreamBookToolbox,代码行数:35,代码来源:DancingBoneLayer.cpp

示例5: effectIncreaseHP

void HPDPS::effectIncreaseHP()
{
    float f = 300;
    float x = 350;
    float y = 300;
    
    static int t = 0;
    t++;
    if(t <= 5)
    {
        CCSprite *increase = CCSprite::create("heart.png");
        increase->setPosition(ccp(x - f/2, y+f*2/3+9));
        Attacker::sharedAttacker()->addChild(increase);
        increase->setColor(ccc3(255, 0, 0));
        increase->setTag(t);
        
        CCPointArray *array = CCPointArray::create(20);
        array->addControlPoint(ccp(x-f/2, y +f*2/3+9));
        array->addControlPoint(ccp(x - f*7/6-6, y + f/3+6));
        array->addControlPoint(ccp(x - f*3/2-9, y-f/3));
        array->addControlPoint(ccp(x - f*7/6-6, y - f-6));
        array->addControlPoint(ccp(x-f/2, y-f*4/3-9));
        array->addControlPoint(ccp(x + f/6+6, y - f-6));
        array->addControlPoint(ccp(x + f/2+9, y-f/3));
        array->addControlPoint(ccp(x + f/6+6, y + f/3+6));
        array->addControlPoint(ccp(x-f/2, y + f*2/3+9));
        
        CCCardinalSplineTo *spline = CCCardinalSplineTo::create(1.5, array, 0);
        increase->runAction(spline);
        
        switch (t) {
            case 1:
                scheduleOnce(schedule_selector(HPDPS::remove1), 1.5f);
                break;
            case 2:
                scheduleOnce(schedule_selector(HPDPS::remove2), 1.5f);
                break;
            case 3:
                scheduleOnce(schedule_selector(HPDPS::remove3), 1.5f);
                break;
            case 4:
                scheduleOnce(schedule_selector(HPDPS::remove4), 1.5f);
                break;
            case 5:
                scheduleOnce(schedule_selector(HPDPS::remove5), 1.5f);
                break;
                
            default:
                break;
        }
        
        if(t == 5)
        {
            t = 0;
            unschedule(schedule_selector(HPDPS::effectIncreaseHP));
        }
    }
}
开发者ID:DustinJia,项目名称:Alliance-Warfare,代码行数:58,代码来源:HPDPS.cpp

示例6: copyWithZone

CCObject* CCPointArray::copyWithZone(cocos2d::CCZone *zone)
{
    CCArray *newArray = (CCArray*)m_pControlPoints->copy();
    CCPointArray *points = CCPointArray::create(10);
    points->retain();
    points->setControlPoints(newArray);
    newArray->release();
    
    return points;
}
开发者ID:jennydvr,项目名称:Neuralmon,代码行数:10,代码来源:CCActionCatmullRom.cpp

示例7: CCArray

CCPointArray* CCPointArray::reverse()
{
    CCArray *newArray = new CCArray(m_pControlPoints->count());
    for (int i = m_pControlPoints->count()-1; i >= 0; --i)
    {
        newArray->addObject(m_pControlPoints->objectAtIndex(i));
    }
    CCPointArray *config = CCPointArray::create(0);
    config->setControlPoints(newArray);
    
    newArray->release();
    
    return config;
}
开发者ID:jennydvr,项目名称:Neuralmon,代码行数:14,代码来源:CCActionCatmullRom.cpp

示例8: randStarPoint

CCPointArray* IOSStoreLayer::randStarPoint(int iCount)
{
	CCPointArray* pointRet = CCPointArray::create(iCount);

	pointRet->addControlPoint(ccp(60, 210));
	pointRet->addControlPoint(ccp(80, 330));
	pointRet->addControlPoint(ccp(115, 450));
	pointRet->addControlPoint(ccp(270, 570));
	pointRet->addControlPoint(ccp(230, 100));
	pointRet->addControlPoint(ccp(425, 550));
	pointRet->addControlPoint(ccp(550, 410));
	pointRet->addControlPoint(ccp(540, 180));

	return pointRet;
}
开发者ID:SongCF,项目名称:game-LostStar,代码行数:15,代码来源:IOSStoreLayer.cpp

示例9: CCPoint

CCPointArray* CCPointArray::reverse()
{
    vector<CCPoint*> *newArray = new vector<CCPoint*>();
    vector<CCPoint*>::reverse_iterator iter;
    CCPoint *point = NULL;
    for (iter = m_pPoints->rbegin(); iter != m_pPoints->rend(); ++iter)
    {
        point = *iter;
        newArray->push_back(new CCPoint(point->x, point->y));
    }
    CCPointArray *config = CCPointArray::create(0);
    config->setPoints(newArray);

    return config;
}
开发者ID:1900,项目名称:quick-cocos2d-x,代码行数:15,代码来源:CCPointArray.cpp

示例10: setControlPoints

void CCCatmullRomSprite::setControlPoints(CCPointArray& pa) {
    m_controlPoints.clear();
    const vector<CCPoint*>* plist = pa.getControlPoints();
    for(vector<CCPoint*>::const_iterator iter = plist->begin(); iter != plist->end(); iter++) {
        m_controlPoints.addPoint((*iter)->x, (*iter)->y);
    }
    m_dirty = true;
}
开发者ID:Cocos2d-x-vn,项目名称:cocos2dx-better,代码行数:8,代码来源:CCCatmullRomSprite.cpp

示例11: CCPointArray

CCPointArray* CCPointArray::create(unsigned int capacity)
{
    CCPointArray* ret = new CCPointArray();
    if (ret)
    {
        if (ret->initWithCapacity(capacity))
        {
            ret->autorelease();
        }
        else 
        {
            delete ret;
            ret = NULL;
        }
    }

    return ret;
}
开发者ID:IppClub,项目名称:Dorothy,代码行数:18,代码来源:CCActionCatmullRom.cpp

示例12: CCPointArray

CCPointArray* CCPointArray::create(unsigned int capacity)
{
    CCPointArray* ret = new CCPointArray();
    if (ret)
    {
        if (ret->initWithCapacity(capacity))
        {
            CC_SAFE_AUTORELEASE(ret);
        }
        else 
        {
            delete ret;
            ret = NULL;
        }
    }

    return ret;
}
开发者ID:boruis,项目名称:cocos2dx-classical,代码行数:18,代码来源:CCActionCatmullRom.cpp

示例13: sprintf

ToyBrick* ToyLayer::CreateBrick_Rectangle()
{
		int num = CommonHelper::GetRandomNum(1, 20);

		//image && texture
		char path[255];
		sprintf(path, "Images/ToyBrick/Rectangle/%d.png", num);

		CCImage *img = new CCImage();
		img->autorelease();
		if (!img->initWithImageFile(path, cocos2d::CCImage::kFmtPng))
		{
				return NULL;
		}

		CCTexture2D *texture = new CCTexture2D();
		texture->autorelease();
		if (!texture->initWithImage(img))
		{
				return NULL;
		}


		//
		ToyBrick *brick = ToyBrick::create();
		CCSize size = texture->getContentSize();
		brick->Init(texture, CCRectMake(0, 0, size.width, size.height));
		
		//vector
		CCPointArray *vector = CCPointArray::create(4);
		vector->addControlPoint(ccp(-52, -52));
		vector->addControlPoint(ccp(52, -52));
		vector->addControlPoint(ccp(52, 52));
		vector->addControlPoint(ccp(-52, 52));
		brick->SetAsPolygon(vector);

		return brick;
}
开发者ID:Whislly,项目名称:DreamBookToolbox,代码行数:38,代码来源:ToyLayer.cpp

示例14: setPosType

void CEnemySprite::setPosType(int posType)
{
    CCSize screen = CCDirector::sharedDirector()->getWinSize();
    CCSize enemySize = m_pSprite->getContentSize();
    
    CCPointArray* startPosArray = CCPointArray::create(EnemyStartTypeMax);
    startPosArray->addControlPoint(ccp(0, 0));//EnemyStartTypeNone
    startPosArray->addControlPoint(ccp(screen.width / 2, screen.height + enemySize.height / 2));//1 EnemyStartTypeTop
    startPosArray->addControlPoint(ccp(screen.width / 3, screen.height + enemySize.height / 2));//2 EnemyStartTypeTopLeft
    startPosArray->addControlPoint(ccp(screen.width * 2 / 3, screen.height + enemySize.height / 2));//3 EnemyStartTypeTopRight
    startPosArray->addControlPoint(ccp(-enemySize.width / 2, screen.height * 2 / 3));//4 EnemyStartTypeLeft
    startPosArray->addControlPoint(ccp(screen.width + enemySize.width / 2, screen.height * 2 / 3));//5 EnemyStartTypeRight
    startPosArray->addControlPoint(ccp(-enemySize.width / 2, screen.height / 3));//6 EnemyStartTypeLeft2
    startPosArray->addControlPoint(ccp(screen.width + enemySize.width / 2, screen.height / 3));//7 EnemyStartTypeRight2
    
    m_pos = startPosArray->getControlPointAtIndex(posType);
    
    CCLog("CEnemySprite::setPosType posType: %d, pos: %0.2f, %0.2f", posType, m_pos.x, m_pos.y);
    m_pSprite->setPosition(m_pos);
}
开发者ID:quanguogedi,项目名称:Plane,代码行数:20,代码来源:EnemySprite.cpp

示例15: CCPointArray

NS_CC_BEGIN

/*
 *  Implementation of CCPointArray
 */

CCPointArray* CCPointArray::create(unsigned int capacity)
{
    CCPointArray* ret = new CCPointArray();
    if (ret)
    {
        if (ret->initWithCapacity(capacity))
        {
            ret->autorelease();
        }
        else
        {
            delete ret;
            ret = NULL;
        }
    }

    return ret;
}
开发者ID:1900,项目名称:quick-cocos2d-x,代码行数:24,代码来源:CCPointArray.cpp


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