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


C++ CCParticleSystem::getTexture方法代码示例

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


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

示例1: addParticleSystem

CCParticleSystem* ADParticleSystemCache::addParticleSystem( const char *pFileName )
{
	CCParticleSystem *pRetPart = NULL;
	ParticleSystemBatchMap::iterator iter = m_particleBatchesIdle.find( pFileName );
	if( iter == m_particleBatchesIdle.end() )
	{
		pRetPart = CCParticleSystemQuad::create( pFileName );
		CCParticleBatchNode *pNode = CCParticleBatchNode::createWithTexture( pRetPart->getTexture(), 100 );
		m_pRootNode->addChild( pNode );
		pNode->addChild( pRetPart );

		m_particleBatchesUsed[pFileName]._pBatchNode = pNode;

		m_particleBatchesIdle[pFileName]._pBatchNode = pNode;
	}
	else
	{
		if( iter->second._particleSystems.empty() )
		{
			pRetPart = _createNewParticleSystem( pFileName, iter->second._pBatchNode );
			iter->second._particleSystems.push_back( pRetPart );
		}
		else
		{
			pRetPart = iter->second._particleSystems.front();
			iter->second._particleSystems.pop_front();
		}
	}

	CCAssert( pRetPart != NULL, " add particle system error " );

	m_particleBatchesUsed[pFileName]._particleSystems.push_back( pRetPart );

	return pRetPart;
}
开发者ID:Bazingaaa,项目名称:alphadig,代码行数:35,代码来源:ADParticleSystemCache.cpp

示例2: addChild

void CCParticleBatchNode::addChild(CCNode * child, int zOrder, int tag)
{
    CCAssert( child != NULL, "Argument must be non-NULL");
    CCAssert( dynamic_cast<CCParticleSystem*>(child) != NULL, "CCParticleBatchNode only supports CCQuadParticleSystems as children");
    CCParticleSystem* pChild = (CCParticleSystem*)child;
    CCAssert( pChild->getTexture()->getName() == m_pTextureAtlas->getTexture()->getName(), "CCParticleSystem is not using the same texture id");
    // If this is the 1st children, then copy blending function
    if( m_pChildren->count() == 0 ) 
    {
        setBlendFunc(pChild->getBlendFunc());
    }

    CCAssert( m_tBlendFunc.src  == pChild->getBlendFunc().src && m_tBlendFunc.dst  == pChild->getBlendFunc().dst, "Can't add a PaticleSystem that uses a different blending function");

    //no lazy sorting, so don't call super addChild, call helper instead
    unsigned int pos = addChildHelper(pChild,zOrder,tag);

    //get new atlasIndex
    unsigned int atlasIndex = 0;

    if (pos != 0) 
    {
        CCParticleSystem* p = (CCParticleSystem*)m_pChildren->objectAtIndex(pos-1);
        atlasIndex = p->getAtlasIndex() + p->getTotalParticles();

    }
    else
    {
        atlasIndex = 0;
    }

    insertChild(pChild, atlasIndex);

    // update quad info
    pChild->setBatchNode(this);
}
开发者ID:caoguoping,项目名称:warCraft,代码行数:36,代码来源:CCParticleBatchNode.cpp


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