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


C++ CC_PROFILER_START函数代码示例

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


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

示例1: event

void CustomEventDispatchingPerfTest::generateTestFunctions()
{
    TestFunction testFunctions[] = {
        { "custom-scenegraph",    [=](){
            auto dispatcher = Director::getInstance()->getEventDispatcher();
            if (_quantityOfNodes != _lastRenderedCount)
            {
                auto listener = EventListenerCustom::create("custom_event_test_scenegraph", [](EventCustom* event){});
                
                // Create new nodes listen to custom event
                for (int i = 0; i < this->_quantityOfNodes; ++i)
                {
                    auto node = Node::create();
                    node->setTag(1000 + i);
                    this->addChild(node);
                    this->_nodes.push_back(node);
                    dispatcher->addEventListenerWithSceneGraphPriority(listener->clone(), node);
                }
                
                _lastRenderedCount = _quantityOfNodes;
            }
            
            EventCustom event("custom_event_test_scenegraph");
            
            CC_PROFILER_START(this->profilerName());
            dispatcher->dispatchEvent(&event);
            CC_PROFILER_STOP(this->profilerName());
        } } ,
        { "custom-fixed",    [=](){
            auto dispatcher = Director::getInstance()->getEventDispatcher();
            if (_quantityOfNodes != _lastRenderedCount)
            {
                auto listener = EventListenerCustom::create("custom_event_test_fixed", [](EventCustom* event){});
                
                for (int i = 0; i < this->_quantityOfNodes; ++i)
                {
                    auto l = listener->clone();
                    this->_fixedPriorityListeners.push_back(l);
                    dispatcher->addEventListenerWithFixedPriority(l, i+1);
                }
                
                _lastRenderedCount = _quantityOfNodes;
            }
            
            EventCustom event("custom_event_test_fixed");
            
            CC_PROFILER_START(this->profilerName());
            dispatcher->dispatchEvent(&event);
            CC_PROFILER_STOP(this->profilerName());
        } } ,
    };
    
    for (const auto& func : testFunctions)
    {
        _testFunctions.push_back(func);
    }
}
开发者ID:AomXD,项目名称:workspace,代码行数:57,代码来源:PerformanceEventDispatcherTest.cpp

示例2: Rect

////////////////////////////////////////////////////////
//
// RemoveSpriteSheet
//
////////////////////////////////////////////////////////
void RemoveSpriteSheet::update(float dt)
{
    //srandom(0);

    // 100 percent
    int totalToAdd = currentQuantityOfNodes * 1;

    if( totalToAdd > 0 )
    {
        Sprite **sprites = new Sprite*[totalToAdd];

        // Don't include the sprite creation time as part of the profiling
        for(int i=0;i<totalToAdd;i++)
        {
            sprites[i] = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,32,32));
        }

        // add them with random Z (very important!)
        for( int i=0; i < totalToAdd;i++ )
        {
            batchNode->addChild( sprites[i], CCRANDOM_MINUS1_1() * 50, kTagBase+i);
        }

        // remove them
        CC_PROFILER_START( this->profilerName() );
        for( int i=0;i <  totalToAdd;i++)
        {
            batchNode->removeChild( sprites[i], true);
        }
        CC_PROFILER_STOP( this->profilerName() );

        delete [] sprites;
    }
}
开发者ID:ntotani,项目名称:amiconveyor,代码行数:39,代码来源:PerformanceNodeChildrenTest.cpp

示例3: CC_PROFILER_START

void Label::onDraw()
{
    CC_PROFILER_START("Label - draw");

    // Optimization: Fast Dispatch
    if( _batchNodes.size() == 1 && _textureAtlas->getTotalQuads() == 0 )
    {
        return;
    }

    CC_NODE_DRAW_SETUP();

    if (_useDistanceField && _currLabelEffect != LabelEffect::NORMAL)
    {
        _shaderProgram->setUniformLocationWith3f(_uniformEffectColor, _effectColor.r/255.0f,_effectColor.g/255.0f,_effectColor.b/255.0f);
    }

    for(const auto &child: _children)
    {
        child->updateTransform();
    }

    GL::blendFunc( _blendFunc.src, _blendFunc.dst );

    for (const auto& batchNode:_batchNodes)
    {
        batchNode->getTextureAtlas()->drawQuads();
    }

    CC_PROFILER_STOP("Label - draw");
}
开发者ID:12white,项目名称:CocoStudioSamples,代码行数:31,代码来源:CCLabel.cpp

示例4: CC_PROFILER_START

void Label::onDraw(const Mat4& transform, bool transformUpdated)
{
    CC_PROFILER_START("Label - draw");

    // Optimization: Fast Dispatch
    if( _batchNodes.size() == 1 && _textureAtlas->getTotalQuads() == 0 )
    {
        return;
    }

    auto glprogram = getGLProgram();
    glprogram->use();
    GL::blendFunc( _blendFunc.src, _blendFunc.dst );

    if(_shadowEnabled && _shadowBlurRadius <= 0)
    {
        glprogram->setUniformLocationWith4f(_uniformTextColor,
            _shadowColor.r, _shadowColor.g, _shadowColor.b, _shadowColor.a);
        glprogram->setUniformLocationWith4f(_uniformEffectColor,
            _shadowColor.r, _shadowColor.g, _shadowColor.b, _shadowColor.a);

        getGLProgram()->setUniformsForBuiltins(_shadowTransform);
        for (const auto &child : _children)
        {
            child->updateTransform();
        }
        for (const auto& batchNode : _batchNodes)
        {
            batchNode->getTextureAtlas()->drawQuads();
        }
    }

    if (_currentLabelType == LabelType::TTF)
    {
        glprogram->setUniformLocationWith4f(_uniformTextColor,
            _textColorF.r, _textColorF.g, _textColorF.b, _textColorF.a);
    }

    if (_currLabelEffect == LabelEffect::OUTLINE || _currLabelEffect == LabelEffect::GLOW)
    {
        glprogram->setUniformLocationWith4f(_uniformEffectColor,
            _effectColorF.r, _effectColorF.g, _effectColorF.b, _effectColorF.a);
    }

    glprogram->setUniformsForBuiltins(transform);

    for(const auto &child: _children)
    {
        if(child->getTag() >= 0)
            child->updateTransform();
    }

    for (const auto& batchNode:_batchNodes)
    {
        batchNode->getTextureAtlas()->drawQuads();
    }

    CC_PROFILER_STOP("Label - draw");
}
开发者ID:HeavenWesker,项目名称:ContraGame,代码行数:59,代码来源:CCLabel.cpp

示例5: XFUNC_START

void XSpriteBatchNode::draw()
{
	XFUNC_START();
	CC_PROFILER_START("XSpriteBatchNode - draw");

	if (m_pobTextureAtlas->getTotalQuads() == 0)
	{
		return;
	}
	do 
	{
		ccGLEnable(m_eGLServerState);
		if (m_pShaderKTX)
		{
			CCGLProgram* pProg = m_pShaderKTX->GetProgram();
			if (pProg)
			{
				pProg->use();
				pProg->setUniformsForBuiltins();
			}
		}
		else
		{
			if (getShaderProgram())
			{
				getShaderProgram()->use();
				getShaderProgram()->setUniformsForBuiltins();
			}			
		}
		if(m_pShaderOnce)
		{
			m_pShaderOnce->use();
			m_pShaderOnce->setUniformsForBuiltins();
			if(m_pShaderOnce->m_pShader)
				m_pShaderOnce->m_pShader->RunBeforeDraw();
			m_pShaderOnce = NULL;
		}
		//else if(m_pobTextureAtlas->getTexture())
		//{
		//	static XShaderBloom stShaderBloom;
		//	stShaderBloom.UseShader();
		//	stShaderBloom.SetTexSize(SCRPIX_W, SCRPIX_H);
		//}
	} while (0);
	arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCSprite*);
	ccGLBlendFunc(m_blendFunc.src, m_blendFunc.dst);
	if (m_pTexKtxAlpha)
	{
		ccGLBindTexture2DN(1, m_pTexKtxAlpha->getName());
		if (m_pShaderKTX)
		{
			m_pShaderKTX->RunBeforeDraw();
		}	
	}
	m_pobTextureAtlas->drawQuads();
	CC_PROFILER_STOP("XSpriteBatchNode - draw");
	
	XFUNC_END();
}
开发者ID:SLS-ACT,项目名称:TeamTest,代码行数:59,代码来源:XSpriteBatchNode.cpp

示例6: CC_PROFILER_START

void InvokeStdFunctionPerfTest::onUpdate(float dt)
{
    CC_PROFILER_START(_profileName.c_str());
    for (int i = 0; i < LOOP_COUNT; ++i)
    {
        _callback(dt);
    }
    CC_PROFILER_STOP(_profileName.c_str());
}
开发者ID:AnySDK,项目名称:Sample_Lua,代码行数:9,代码来源:PerformanceCallbackTest.cpp

示例7: CC_PROFILER_START

void VisitSceneGraph::update(float dt)
{
    CC_PROFILER_START( this->profilerName() );
    this->visit();
    CC_PROFILER_STOP( this->profilerName() );

    // Call `Renderer::clean` to prevent crash if current scene is destroyed.
    // The render commands associated with current scene should be cleaned.
    Director::getInstance()->getRenderer()->clean();
}
开发者ID:289997171,项目名称:cocos2d-x,代码行数:10,代码来源:PerformanceNodeChildrenTest.cpp

示例8: CC_PROFILER_START

void ParticleBatchNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
    CC_PROFILER_START("CCParticleBatchNode - draw");

    if( _textureAtlas->getTotalQuads() == 0 )
    {
        return;
    }
    _batchCommand.init(_globalZOrder, getGLProgram(), _blendFunc, _textureAtlas, _modelViewTransform, flags);
    renderer->addCommand(&_batchCommand);
    CC_PROFILER_STOP("CCParticleBatchNode - draw");
}
开发者ID:1005491398,项目名称:Threes,代码行数:12,代码来源:CCParticleBatchNode.cpp

示例9: CC_PROFILER_START

void NodeCreateTest::update(float dt)
{
    // iterate using fast enumeration protocol

    Node **nodes = new Node*[quantityOfNodes];

    CC_PROFILER_START(this->profilerName());
    for( int i=0; i<quantityOfNodes; ++i)
        nodes[i] = Node::create();
    CC_PROFILER_STOP(this->profilerName());

    delete [] nodes;
}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:13,代码来源:PerformanceAllocTest.cpp

示例10: CC_PROFILER_START

////////////////////////////////////////////////////////
//
// CallFuncsSpriteSheetForEach
//
////////////////////////////////////////////////////////
void CallFuncsSpriteSheetForEach::update(float dt)
{
    // iterate using fast enumeration protocol
    auto& children = batchNode->getChildren();

    CC_PROFILER_START(this->profilerName());

    std::for_each(std::begin(children), std::end(children), [](Node* obj) {
        obj->getPosition();
    });

    CC_PROFILER_STOP(this->profilerName());
}
开发者ID:ntotani,项目名称:amiconveyor,代码行数:18,代码来源:PerformanceNodeChildrenTest.cpp

示例11: CC_PROFILER_START

void Label::onDraw(const kmMat4& transform, bool transformUpdated)
{
    CC_PROFILER_START("Label - draw");

    // Optimization: Fast Dispatch
    if( _batchNodes.size() == 1 && _textureAtlas->getTotalQuads() == 0 )
    {
        return;
    }

    _shaderProgram->use();
    GL::blendFunc( _blendFunc.src, _blendFunc.dst );
    bool trans = false;

    if (_currLabelEffect == LabelEffect::OUTLINE)
    {
         _shaderProgram->setUniformLocationWith4f(_uniformEffectColor, _outlineColor.r/255.0f,_outlineColor.g/255.0f,_outlineColor.b/255.0f,_outlineColor.a/255.0f);
    }
    else if (_currLabelEffect == LabelEffect::GLOW)
    {
        _shaderProgram->setUniformLocationWith3f(_uniformEffectColor, _effectColor.r/255.0f,_effectColor.g/255.0f,_effectColor.b/255.0f);
    }
    else if(_currLabelEffect == LabelEffect::SHADOW && _shadowBlurRadius <= 0)
    {
        trans = true;
        drawShadowWithoutBlur();
    }

    _shaderProgram->setUniformsForBuiltins(transform);
   
    for(const auto &child: _children)
    {
        if(child->getTag() >= 0)
            child->updateTransform();
    }  

    for (const auto& batchNode:_batchNodes)
    {
        batchNode->getTextureAtlas()->drawQuads();
    }

    if (trans)
    {
        kmGLPopMatrix();
    }    

    CC_PROFILER_STOP("Label - draw");
}
开发者ID:khanhbui,项目名称:ThreeDots,代码行数:48,代码来源:CCLabel.cpp

示例12: CC_PROFILER_START

void CCParticleBatchNode::draw(void)
{
    CC_PROFILER_START("CCParticleBatchNode - draw");

    if( m_pTextureAtlas->getTotalQuads() == 0 )
    {
        return;
    }

    CC_NODE_DRAW_SETUP();

    ccGLBlendFunc( m_tBlendFunc.src, m_tBlendFunc.dst );

    m_pTextureAtlas->drawQuads();

    CC_PROFILER_STOP("CCParticleBatchNode - draw");
}
开发者ID:caoguoping,项目名称:warCraft,代码行数:17,代码来源:CCParticleBatchNode.cpp

示例13: CC_PROFILER_START

void ParticleBatchNode::draw(void)
{
    CC_PROFILER_START("CCParticleBatchNode - draw");

    if( _textureAtlas->getTotalQuads() == 0 )
    {
        return;
    }

    CC_NODE_DRAW_SETUP();

    GL::blendFunc( _blendFunc.src, _blendFunc.dst );

    _textureAtlas->drawQuads();

    CC_PROFILER_STOP("CCParticleBatchNode - draw");
}
开发者ID:CryQ,项目名称:coclua,代码行数:17,代码来源:CCParticleBatchNode.cpp

示例14: CC_PROFILER_START

void ParticleBatchNode::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{
    CC_PROFILER_START("CCParticleBatchNode - draw");

    if( _textureAtlas->getTotalQuads() == 0 )
    {
        return;
    }

    _batchCommand.init(
                       _globalZOrder,
                       _shaderProgram,
                       _blendFunc,
                       _textureAtlas,
                       _modelViewTransform);
    renderer->addCommand(&_batchCommand);
    CC_PROFILER_STOP("CCParticleBatchNode - draw");
}
开发者ID:BellyWong,项目名称:EarthWarrior3D,代码行数:18,代码来源:CCParticleBatchNode.cpp

示例15: CC_PROFILER_START

void CABatchView::draw(void)
{
    CC_PROFILER_START("CABatchView - draw");

    CC_RETURN_IF(!m_pobImageAtlas);
    CC_RETURN_IF(m_pobImageAtlas->getTotalQuads() == 0);
    
    CC_NODE_DRAW_SETUP();

    CAVector<CAView*>::const_iterator itr;
    for (itr=m_obSubviews.begin(); itr!=m_obSubviews.end(); itr++)
        (*itr)->updateTransform();

    ccGLBlendFunc( m_blendFunc.src, m_blendFunc.dst );

    m_pobImageAtlas->drawQuads();

    CC_PROFILER_STOP("CABatchView - draw");
}
开发者ID:Brian1900,项目名称:CrossApp,代码行数:19,代码来源:CABatchView.cpp


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