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


C++ ccc4f函数代码示例

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


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

示例1: CCParticleSnow

CCParticleSystem* AchievementNotification::createPar(CCPoint pos,const char* file,float width,float height)
{
	CCParticleSystem *m_emitter = new CCParticleSnow();
	m_emitter->initWithTotalParticles(100);
	addChild(m_emitter, 10);

	m_emitter->setPosition(pos);
	m_emitter->setPosVar(ccp(width,height));
	m_emitter->setLife(1.0f);
	m_emitter->setLifeVar(0.5f);
	m_emitter->setAutoRemoveOnFinish(true);
	m_emitter->setDuration(1.0f);
	m_emitter->setGravity(CCPointMake(0,-10));
	m_emitter->setSpeed(130);
	m_emitter->setSpeedVar(30);
	m_emitter->setStartColor(ccc4f(0.5f,0.5f,0.5f,1.0f));
	m_emitter->setStartColorVar(ccc4f(0.5f,0.5f,0.5f,0.1f));
	m_emitter->setEndColor(ccc4f(0.1f,0.1f,0.1f,0.2f));
	m_emitter->setEndColorVar(ccc4f(0.1f,0.1f,0.1f,0.2f));
	m_emitter->setEndSpinVar(360);
	m_emitter->setEmissionRate(m_emitter->getTotalParticles()/m_emitter->getLife());
	m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(file) );
	m_emitter->setBlendAdditive(true);

	return m_emitter;

}
开发者ID:SongCF,项目名称:game-LostStar,代码行数:27,代码来源:AchievementNotification.cpp

示例2: QuestionContainerSprite

bool Bug458Layer::init()
{
    if(BugsTestBaseLayer::init())
    {
		// ask director the the window size
        CCSize size = CCDirector::sharedDirector()->getWinSize();

        QuestionContainerSprite* question = new QuestionContainerSprite();
        QuestionContainerSprite* question2 = new QuestionContainerSprite();
        question->init();
        question2->init();

//		[question setContentSize:CGSizeMake(50,50)];
//		[question2 setContentSize:CGSizeMake(50,50)];
		
        CCMenuItemSprite* sprite = CCMenuItemSprite::itemFromNormalSprite(question2, question, this, menu_selector(Bug458Layer::selectAnswer));
        CCLayerColor* layer = CCLayerColor::layerWithColorWidthHeight(ccc4f(0,0,255,255), 100, 100);
		question->release();
		question2->release();

        CCLayerColor* layer2 = CCLayerColor::layerWithColorWidthHeight(ccc4f(255,0,0,255), 100, 100);
        CCMenuItemSprite* sprite2 = CCMenuItemSprite::itemFromNormalSprite(layer, layer2, this, menu_selector(Bug458Layer::selectAnswer));        
        CCMenu* menu = CCMenu::menuWithItems(sprite, sprite2, NULL);
        menu->alignItemsVerticallyWithPadding(100);
        menu->setPosition(ccp(size.width / 2, size.height / 2));

		// add the label as a child to this Layer
		addChild(menu);

        return true;
	}
	return false;
}
开发者ID:ccjimmy,项目名称:TweeJump4wp8,代码行数:33,代码来源:Bug-458.cpp

示例3: ccc4f

void GameEntityView::doLifedrain( ICastEntity* to )
{
	CCParticleFire* life = CCParticleFire::createWithTotalParticles(25);
	CCPoint point =  m_healthBar->boundingBox().origin;

	life->setStartColor( ccc4f(0,1.0f,0,1.0f) );
	life->setEndColor( ccc4f(0,1.0f,0,1.0f) );
	life->setPosition(ccp(0,0));

	//TODO: use physics interface to get position of 'to' entity and direct stream

	life->setGravity( CCPointMake( -30, 0 ) );
	life->setStartSize(25);
	life->setPosVar( CCPointMake( 10,10 ));

	m_healthBar->addChild(life);

	CCSequence* seq = CCSequence::create(
				CCDelayTime::create(0.5f),
				CCCallFunc::create(life, callfunc_selector(CCParticleFire::stopSystem)),
				CCDelayTime::create(2.5f),
				CCRemoveSelf::create(true),
				NULL
			);

	life->runAction(seq);
}
开发者ID:keless,项目名称:CastEngine,代码行数:27,代码来源:GameEntityView.cpp

示例4: ccg

//------------------------------------------------------------------
//
// Effect5
//
//------------------------------------------------------------------
void Issue631::onEnter()
{
	EffectAdvanceTextLayer::onEnter();
		
	CCActionInterval* effect = (CCActionInterval*)(CCSequence::actions( CCDelayTime::actionWithDuration(2.0f), CCShaky3D::actionWithRange(16, false, ccg(5, 5), 5.0f), NULL));

	// cleanup
	CCNode* bg = getChildByTag(kTagBackground);
	removeChild(bg, true);

	// background
	CCLayerColor* layer = CCLayerColor::layerWithColor( ccc4f(255,0,0,255) );
	addChild(layer, -10);
	CCSprite* sprite = CCSprite::spriteWithFile("Images/grossini.png");
	sprite->setPosition( ccp(50,80) );
	layer->addChild(sprite, 10);
	
	// foreground
	CCLayerColor* layer2 = CCLayerColor::layerWithColor(ccc4f( 0, 255,0,255 ) );
	CCSprite* fog = CCSprite::spriteWithFile("Images/Fog.png");

    ccBlendFunc bf = {CC_SRC_ALPHA, CC_ONE_MINUS_SRC_ALPHA};
	fog->setBlendFunc(bf);
	layer2->addChild(fog, 1);
	addChild(layer2, 1);
	
	layer2->runAction( CCRepeatForever::actionWithAction(effect) );
}
开发者ID:ccjimmy,项目名称:TweeJump4wp8,代码行数:33,代码来源:EffectsAdvancedTest.cpp

示例5: switch

//-------------------------------------------------------------------------
void FKCW_RenderEx_EraserSprite::setDrawWidth(float var)
{
	this->m_fDrawWidth = var;

	switch (m_uiDrawType)
	{
	case 0:	//< 正方形模式
		{
			m_pEraser->drawDot(CCPointZero, m_fDrawWidth, ccc4f(0,0,0,0));
		}
		break;
	case 1:
		{
			// 绘制圆形区域
			float fRadius		= m_fDrawWidth;					// 圆的半径
			const int nCount	= 100;							// 用正100边型来模拟园
			const float coef	= 2.0f * (float)M_PI/nCount;	// 计算每两个相邻顶点与中心的夹角
			static CCPoint circle[nCount];						// 顶点数组
			for(unsigned int i = 0;i <nCount; i++) {
				float rads = i*coef;							// 弧度
				circle[i].x = fRadius * cosf(rads);				// 对应顶点的x
				circle[i].y = fRadius * sinf(rads);				// 对应顶点的y
			}
			m_pEraser->drawPolygon(circle, nCount, ccc4f(0, 0, 0, 0), 0, ccc4f(0, 0, 0, 0));//绘制这个多边形!
		}
		break;
	case 2:
		{
			/// 需要自定义擦除图片
		}
		break;
	default:
		break;
	}
}
开发者ID:duzhi5368,项目名称:FKCocos2dxWrapper_2.x,代码行数:36,代码来源:FKCW_RenderEx_EraserSprite.cpp

示例6: ccp

//--------------------------------------------------------
void CRenderTextureLayer::AddTopLight( CCPoint* vertices, ccColor4F* colors )
{
	int nVertices = 0;
	float borderHeight = RENDER_TEX_HEIGHT / 16;
	float borderAlpha = 0.7f;
	nVertices = 0;

	vertices[nVertices] = ccp(0, 0);
	colors[nVertices++] = ccc4f(1, 1, 1, borderAlpha);

	vertices[nVertices] = ccp(RENDER_TEX_WIDTH, 0);
	colors[nVertices++] = ccc4f(1, 1, 1, borderAlpha);

	vertices[nVertices] = ccp(0, borderHeight);
	colors[nVertices++] = ccc4f(0, 0, 0, 0);

	vertices[nVertices] = ccp(RENDER_TEX_WIDTH, borderHeight);
	colors[nVertices++] = ccc4f(0, 0, 0, 0);

	glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);
	glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_FLOAT, GL_TRUE, 0, colors);
	glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)nVertices);

	FKLog("开启顶部光照显示");
}
开发者ID:Pancho2wang,项目名称:cocos2dx_shader_demo,代码行数:27,代码来源:RenderTexture.cpp

示例7: glLineWidth

bool CardBase::ccTouchBegan(CCTouch* touch, CCEvent* event)
{
	glLineWidth(16);
	ccDrawColor4B(255,0,0,255);
	CCPoint vertices[] = { ccp(0, 0), ccp(50, 50), ccp(100, 50), ccp(100, 100) };
	ccDrawPoly(vertices, 4, true);

	//glLineWidth(16);
	//ccDrawColor4B(0, 255, 0, 255);
	//ccDrawCircle( VisibleRect::center(), 100, 0, 10, false);
	CCSize s = this->backGround->getContentSize();

	CCDrawNode *draw = CCDrawNode::create();
	addChild(draw, 10);

	// Draw polygons
	CCPoint points[] = { CCPoint(s.height/4,0), CCPoint(s.width,s.height/5), CCPoint(s.width/3*2,s.height) };
	draw->drawPolygon(points, sizeof(points)/sizeof(points[0]), ccc4f(1,0,0,0.5), 0, ccc4f(0,0,0,0));

	// Draw segment
	//draw->drawSegment(ccp(20,s.height), ccp(20,s.height/2), 10, ccc4f(0, 1, 0, 0.5));

	//draw->drawSegment(ccp(10,s.height/2), ccp(s.width/2, s.height/2), 40, ccc4f(1, 0, 1, 0.5));

//	this->addChild(shadow);
//	addChild(shadow);

	CCLog("ccTouchBegan");
	return true;
}
开发者ID:Michael-Z,项目名称:Flappy,代码行数:30,代码来源:CardBase.cpp

示例8: ccc4f

//------------------------------------------------------------------
//
// LayerTest2
//
//------------------------------------------------------------------
void LayerTest2::onEnter()
{
	LayerTest::onEnter();

	CCSize s = CCDirector::sharedDirector()->getWinSize();
	CCLayerColor* layer1 = CCLayerColor::layerWithColorWidthHeight( ccc4f(255, 255, 0, 80), 100, 300);
	layer1->setPosition(CCPointMake(s.width/3, s.height/2));
	layer1->setIsRelativeAnchorPoint(true);
	addChild(layer1, 1);
	
	CCLayerColor* layer2 = CCLayerColor::layerWithColorWidthHeight( ccc4f(0, 0, 255, 255), 100, 300);
	layer2->setPosition(CCPointMake((s.width/3)*2, s.height/2));
	layer2->setIsRelativeAnchorPoint(true);
	addChild(layer2, 1);
	
	CCActionInterval* actionTint = CCTintBy::actionWithDuration(2, -255, -127, 0);
	CCActionInterval* actionTintBack = actionTint->reverse();
	CCActionInterval* seq1 = (CCActionInterval*)CCSequence::actions( actionTint, actionTintBack, NULL);
	layer1->runAction(seq1);

	CCActionInterval* actionFade = CCFadeOut::actionWithDuration(2.0f);
	CCActionInterval* actionFadeBack = actionFade->reverse();
	CCActionInterval* seq2 = (CCActionInterval*)CCSequence::actions(actionFade, actionFadeBack, NULL);		
	layer2->runAction(seq2);
}
开发者ID:9re,项目名称:cocos2d-x,代码行数:30,代码来源:LayerTest.cpp

示例9: ColorForBody

NS_CC_EXT_BEGIN

/*
 IMPORTANT - READ ME!
 
 This file sets pokes around in the private API a lot to provide efficient
 debug rendering given nothing more than reference to a Chipmunk space.
 It is not recommended to write rendering code like this in your own games
 as the private API may change with little or no warning.
 */
// 此文件采用了很多私有的API,用于调试中渲染物理空间。 不推荐这么做,私有api最不愿改动
static ccColor4F ColorForBody(cpBody *body)
{
	if (cpBodyIsRogue(body) || cpBodyIsSleeping(body))
    {
		return ccc4f(0.5f, 0.5f, 0.5f ,0.5f);
	}
    else if (body->CP_PRIVATE(node).idleTime > body->CP_PRIVATE(space)->sleepTimeThreshold)
    {
		return ccc4f(0.33f, 0.33f, 0.33f, 0.5f);
	}
    else
    {
		return ccc4f(1.0f, 0.0f, 0.0f, 0.5f);
	}
}
开发者ID:LaughingYan,项目名称:cocos2d-x,代码行数:26,代码来源:CCPhysicsDebugNode.cpp

示例10: CCPointMake

void GameEntityView::doHeal()
{
	CCParticleFire* heal = CCParticleFire::createWithTotalParticles(25);
	CCPoint point = CCPointMake(  m_healthBar->getContentSize().width/2, 0 );

	heal->setStartColor( ccc4f(1,1,1,1.0f) );
	heal->setEndColor( ccc4f(1,1,1,1.0f) );

	heal->setSpeed(10);
	heal->setStartSize(15);
	CCPoint posVar = heal->getPosVar();
	posVar.y /= 2;
	heal->setPosVar( posVar );

	heal->setPosition( point );
	m_healthBar->addChild(heal);

	CCSequence* seq = CCSequence::create(
					CCDelayTime::create(0.5f),
					CCCallFunc::create(heal, callfunc_selector(CCParticleFire::stopSystem)),
					CCDelayTime::create(1.5f),
					CCRemoveSelf::create(true),
					NULL
				);

	heal->runAction(seq);
}
开发者ID:keless,项目名称:CastEngine,代码行数:27,代码来源:GameEntityView.cpp

示例11: drawTBars

void drawTBars(Track *track,CCPoint * timelineTrackRatio,CCSize * timeLineSize,float * addtionalDistance)
{
	float porcentMaxSize=0.2f;
	float maxSize=track->_entBar[0]->getWidth()*porcentMaxSize;
	float sizeReductor=0.0f;
	float barsWidth=track->_entBar[0]->getWidth()*timelineTrackRatio->x;
	//if(barsWidth>=maxSize)
		//sizeReductor=track->_entBar[0]->getWidth()- track->_entBar[0]->getWidth()*porcentMaxSize;
		sizeReductor=track->_entBar[0]->getWidth()*porcentMaxSize;
	ccColor4F color;
	
	float trackHeight=track->getHeight();
	float newX,newY;
	for (int i=0;i<track->_entBar.size();i++)
	{
		if(track->_entBar[i]->getClassName()=="Bar")
			color=ccc4f(0.0f,1.0f,0.0f,0.80f);
		else if(track->_entBar[i]->getClassName()=="StartBar" || track->_entBar[i]->getClassName()=="EndBar")
			color=ccc4f(1.0f,1.0f,0.0f,0.80f);
		else
			color=ccc4f(0,0.392f,1.0f,0.80f);
		newX=(track->_entBar[i]->getPositionX()+*addtionalDistance)*timelineTrackRatio->x ;
		newY=track->_entBar[i]->getHeight()*timelineTrackRatio->y;
		/*ccDrawSolidRect(ccp(newX + sizeReductor/2,newY + trackHeight),ccp(newX + barsWidth -sizeReductor/2,trackHeight),color);*/
		ccDrawSolidRect(ccp(newX + barsWidth/2 -sizeReductor/2,newY + trackHeight),ccp(newX  + barsWidth/2 + sizeReductor/2,trackHeight),color);
	}
}
开发者ID:rapito,项目名称:CrossPath,代码行数:27,代码来源:Timeline.cpp

示例12: CCParticleFire

//爆炸后的粒子效果
CCParticleSystem* Bomb::createParticle()
{
	ResManager* manager = ResManager::getManager();
	CCParticleSystem* m_emitter = new CCParticleFire();
	m_emitter->initWithTotalParticles(50);
	m_emitter->setBlendAdditive(false);

	m_emitter->setAutoRemoveOnFinish(true);
	m_emitter->setDuration(0.5f);
	m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(manager->getSharedFilePath(g_gameinPath+"fire.png").c_str()));
	m_emitter->setPosVar(ccp(60,60));
	m_emitter->setStartColor(ccc4f(0.8f,0.8f,0.8f,0.1f));
	m_emitter->setEndColor(ccc4f(0.1f,0.1f,0.1f,0.06f));
	m_emitter->setEndColorVar(ccc4f(0.0f,0.0f,0.0f,0.0f));

	m_emitter->setLife(0.8f);
	m_emitter->setLifeVar(0.3f);
	m_emitter->setSpeed(30.0f);
	m_emitter->setSpeedVar(20.0f);

	m_emitter->setScale(getScale());

	m_emitter->autorelease();

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

示例13: removeAllChildrenWithCleanup

void ArtGameSquare::drawSquare(int col, int row, std::string artFile, Size size, Point scale, int artCols, int artRows)
{
	_artRows = artRows;
	_neighbors[ArtBoxSide::TOP] = false;
	_neighbors[ArtBoxSide::BOTTOM] = false;
	_neighbors[ArtBoxSide::LEFT] = false;
	_neighbors[ArtBoxSide::RIGHT] = false;

	removeAllChildrenWithCleanup(true);

	_originalCol = col;
	_originalRow = row;
	_pieceSize = size;
	_color = Color(rand() % (int)Color::COUNT);
	_scale = scale;

	float innerWidth = _pieceSize.width * 0.4f;
	float innerHeight = _pieceSize.height * 0.4f;

	_image = CCSprite::create(artFile, CCRectMake(col * _pieceSize.width / _scale.x, (_artRows - (row + 1)) * _pieceSize.height / _scale.y, _pieceSize.width / _scale.x, _pieceSize.height / _scale.y));
	_image->setScale(scale.x, scale.y);

	_arrow = CCSprite::create("hintLeft.png");
	float arrowHeight = 24 * G_assetScale;
	_arrow->setScale(arrowHeight / _arrow->getContentSize().height);
	_arrow->setVisible(false);

	Point blPoint = Point(-_pieceSize.width * 0.5f, -_pieceSize.height * 0.5f);
	Point brPoint = Point(_pieceSize.width * 0.5f, -_pieceSize.height * 0.5f);
	Point tlPoint = Point(-_pieceSize.width * 0.5f, _pieceSize.height * 0.5f);
	Point trPoint = Point(_pieceSize.width * 0.5f, _pieceSize.height * 0.5f);

	//draw the 4 border lines
	_sides[ArtBoxSide::TOP] = DrawNode::create();
	_sides[ArtBoxSide::TOP]->drawSegment(tlPoint, trPoint, 1, Color4F::BLACK);
	_sides[ArtBoxSide::BOTTOM] = DrawNode::create();
	_sides[ArtBoxSide::BOTTOM]->drawSegment(blPoint, brPoint, 1, Color4F::BLACK);
	_sides[ArtBoxSide::LEFT] = DrawNode::create();
	_sides[ArtBoxSide::LEFT]->drawSegment(tlPoint, blPoint, 1, Color4F::BLACK);
	_sides[ArtBoxSide::RIGHT] = DrawNode::create();
	_sides[ArtBoxSide::RIGHT]->drawSegment(trPoint, brPoint, 1, Color4F::BLACK);

	_cover = DrawNode::create();
	//draw the outer box
	Point points[] = { blPoint, tlPoint, trPoint, brPoint };
	_cover->drawPolygon(points, 4, ccc4f(0.96f, 0.96f, 0.96f, 0.8f), 0, ccc4f(0.86f, 0.86f, 0.86f, 0.8f));
	//draw the inner box
	Point innerPoints[] = { Point(-innerWidth * 0.5f, -innerHeight * 0.5f), Point(innerWidth * 0.5f, -innerHeight * 0.5f), Point(innerWidth * 0.5f, innerHeight * 0.5f), Point(-innerWidth * 0.5f, innerHeight * 0.5f) };
	_cover->drawPolygon(innerPoints, 4, colorToCCColor(_color), 0, ccc4f(0.86f, 0.86f, 0.86f, 0.9f));

	addChild(_image);
	addChild(_arrow);
	addChild(_sides[ArtBoxSide::LEFT]);
	addChild(_sides[ArtBoxSide::RIGHT]);
	addChild(_sides[ArtBoxSide::TOP]);
	addChild(_sides[ArtBoxSide::BOTTOM]);
	addChild(_cover);
}
开发者ID:amadt,项目名称:counterfeit_m3,代码行数:58,代码来源:ArtGameSquare.cpp

示例14: ccc4f

void HelloWorld::ccTouchMoved (CCTouch *pTouch, CCEvent *pEvent)
{
    line.hexagones.erase (line.hexagones.begin() + 1, line.hexagones.end());
    Hexagon h = field.CCP2Hex (this->convertTouchToNodeSpace (pTouch));
    h.Integerlize();
    line.MakeLine (line.hexagones[0], h, ccc4f (1, 0.5, 0.5, 1));
    intersection.hexagones.clear();
    intersection.MakeSolidHex (3, h, ccc4f (1, 1, 1, 1));
}
开发者ID:EchO-KID,项目名称:CBS,代码行数:9,代码来源:HelloWorldScene.cpp

示例15: Point

void ArtGameSquare::cover()
{
	int borderWidth = 6;
	float bW = (_pieceSize.width - borderWidth) * 0.5f;
	float bH = (_pieceSize.height - borderWidth) * 0.5f;

	_cover = DrawNode::create();
	Point points[] = { Point(-bW, -bH), Point(bW, -bH), Point(bW, bH), Point(-bW, bH) };
	_cover->drawPolygon(points, 4, ccc4f(0.96f, 0.96f, 0.96f, 0.0f), borderWidth, ccc4f(0.86f, 0.86f, 0.86f, 0.7f));
	addChild(_cover);
	_cover->setPosition(_image->getPosition());
}
开发者ID:amadt,项目名称:counterfeit_m3,代码行数:12,代码来源:ArtGameSquare.cpp


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