这篇教程C++ CC_PROFILER_START函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CC_PROFILER_START函数的典型用法代码示例。如果您正苦于以下问题:C++ CC_PROFILER_START函数的具体用法?C++ CC_PROFILER_START怎么用?C++ CC_PROFILER_START使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CC_PROFILER_START函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: eventvoid 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,
示例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,
示例3: CC_PROFILER_STARTvoid 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,
示例4: CC_PROFILER_STARTvoid 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,
示例5: XFUNC_STARTvoid 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,
示例6: CC_PROFILER_STARTvoid 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,
示例7: CC_PROFILER_STARTvoid 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,
示例8: CC_PROFILER_STARTvoid 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,
示例9: CC_PROFILER_STARTvoid 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,
示例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,
示例11: CC_PROFILER_STARTvoid 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,
示例12: CC_PROFILER_STARTvoid 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,
示例13: CC_PROFILER_STARTvoid 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,
示例14: CC_PROFILER_STARTvoid 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,
示例15: CC_PROFILER_STARTvoid 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,
示例16: CC_PROFILER_STARTvoid IsometryNode::draw(void){ CC_PROFILER_START("CCSpriteBatchNode - draw"); // Optimization: Fast Dispatch /*if( m_pobTextureAtlas->getTotalQuads() == 0 ) { return; }*/ CC_NODE_DRAW_SETUP(); arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCSprite*); //ccGLBlendFunc( m_blendFunc.src, m_blendFunc.dst ); //m_pobTextureAtlas->drawQuads(); Process(); CC_PROFILER_STOP("CCSpriteBatchNode - draw");}
开发者ID:track3r,项目名称:cocos2dx-autoBatchNode,代码行数:21,
示例17: CC_PROFILER_STARTvoid ArrayPerfTest::generateTestFunctions(){ auto createArray = [this](){ __Array* ret = Array::create(); for( int i=0; i<quantityOfNodes; ++i) { auto node = Node::create(); node->setTag(i); ret->addObject(node); } return ret; }; TestFunction testFunctions[] = { { "addObject", [=](){ __Array* nodeVector = Array::create(); CC_PROFILER_START(this->profilerName()); for( int i=0; i<quantityOfNodes; ++i) nodeVector->addObject(Node::create()); CC_PROFILER_STOP(this->profilerName()); } } , { "insertObject", [=](){ __Array* nodeVector = Array::create(); CC_PROFILER_START(this->profilerName()); for( int i=0; i<quantityOfNodes; ++i) nodeVector->insertObject(Node::create(), 0); CC_PROFILER_STOP(this->profilerName()); } } , { "setObject", [=](){ __Array* nodeVector = createArray(); srand((unsigned)time(nullptr)); ssize_t index = rand() % quantityOfNodes; CC_PROFILER_START(this->profilerName()); for( int i=0; i<quantityOfNodes; ++i) nodeVector->setObject(Node::create(), index); CC_PROFILER_STOP(this->profilerName()); } } , { "getIndexOfObject", [=](){ __Array* nodeVector = createArray(); Ref* objToGet = nodeVector->getObjectAtIndex(quantityOfNodes/3); ssize_t index = 0; CC_PROFILER_START(this->profilerName()); for( int i=0; i<quantityOfNodes; ++i) index = nodeVector->getIndexOfObject(objToGet); CC_PROFILER_STOP(this->profilerName()); // Uses `index` to avoids `getIndex` invoking was optimized in release mode if (index == quantityOfNodes/3) { nodeVector->removeAllObjects(); } } } , { "getObjectAtIndex", [=](){ __Array* nodeVector = createArray(); CC_PROFILER_START(this->profilerName()); for( int i=0; i<quantityOfNodes; ++i) nodeVector->getObjectAtIndex(quantityOfNodes/3); CC_PROFILER_STOP(this->profilerName()); } } , { "containsObject", [=](){ __Array* nodeVector = createArray(); Ref* objToGet = nodeVector->getObjectAtIndex(quantityOfNodes/3); CC_PROFILER_START(this->profilerName()); for( int i=0; i<quantityOfNodes; ++i) nodeVector->containsObject(objToGet); CC_PROFILER_STOP(this->profilerName()); } } , { "removeObject", [=](){ __Array* nodeVector = createArray(); Node** nodes = (Node**)malloc(sizeof(Node*) * quantityOfNodes); for (int i = 0; i < quantityOfNodes; ++i) { nodes[i] = static_cast<Node*>(nodeVector->getObjectAtIndex(i)); } CC_PROFILER_START(this->profilerName()); for( int i=0; i<quantityOfNodes; ++i) nodeVector->removeObject(nodes[i]); CC_PROFILER_STOP(this->profilerName()); CCASSERT(nodeVector->count() == 0, "nodeVector was not empty."); free(nodes); } } , { "removeObjectAtIndex", [=](){ __Array* nodeVector = createArray(); CC_PROFILER_START(this->profilerName()); for( int i=0; i<quantityOfNodes; ++i) nodeVector->removeObjectAtIndex(0); CC_PROFILER_STOP(this->profilerName()); CCASSERT(nodeVector->count() == 0, "nodeVector was not empty.");//.........这里部分代码省略.........
开发者ID:AppleJDay,项目名称:cocos2d-x,代码行数:101,
示例18: newvoid TouchEventDispatchingPerfTest::generateTestFunctions(){ TestFunction testFunctions[] = { { "OneByOne-scenegraph", [=](){ auto dispatcher = Director::getInstance()->getEventDispatcher(); if (_quantityOfNodes != _lastRenderedCount) { auto listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = [](Touch* touch, Event* event){ return false; }; listener->onTouchMoved = [](Touch* touch, Event* event){}; listener->onTouchEnded = [](Touch* touch, Event* event){}; // Create new touchable nodes 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; } Size size = Director::getInstance()->getWinSize(); EventTouch touchEvent; touchEvent.setEventCode(EventTouch::EventCode::BEGAN); std::vector<Touch*> touches; for (int i = 0; i < 4; ++i) { Touch* touch = new (std::nothrow) Touch(); touch->autorelease(); touch->setTouchInfo(i, rand() % 200, rand() % 200); touches.push_back(touch); } touchEvent.setTouches(touches); CC_PROFILER_START(this->profilerName()); dispatcher->dispatchEvent(&touchEvent); CC_PROFILER_STOP(this->profilerName()); } } , { "OneByOne-fixed", [=](){ auto dispatcher = Director::getInstance()->getEventDispatcher(); if (_quantityOfNodes != _lastRenderedCount) { auto listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = [](Touch* touch, Event* event){ return false; }; listener->onTouchMoved = [](Touch* touch, Event* event){}; listener->onTouchEnded = [](Touch* touch, Event* 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; } Size size = Director::getInstance()->getWinSize(); EventTouch touchEvent; touchEvent.setEventCode(EventTouch::EventCode::BEGAN); std::vector<Touch*> touches; for (int i = 0; i < 4; ++i) { Touch* touch = new (std::nothrow) Touch(); touch->autorelease(); touch->setTouchInfo(i, rand() % 200, rand() % 200); touches.push_back(touch); } touchEvent.setTouches(touches); CC_PROFILER_START(this->profilerName()); dispatcher->dispatchEvent(&touchEvent); CC_PROFILER_STOP(this->profilerName()); } } , { "AllAtOnce-scenegraph", [=](){ auto dispatcher = Director::getInstance()->getEventDispatcher(); if (_quantityOfNodes != _lastRenderedCount) { auto listener = EventListenerTouchAllAtOnce::create(); listener->onTouchesBegan = [](const std::vector<Touch*> touches, Event* event){}; listener->onTouchesMoved = [](const std::vector<Touch*> touches, Event* event){}; listener->onTouchesEnded = [](const std::vector<Touch*> touches, Event* event){}; // Create new touchable nodes for (int i = 0; i < this->_quantityOfNodes; ++i) {//.........这里部分代码省略.........
开发者ID:AomXD,项目名称:workspace,代码行数:101,
示例19: addChildvoid TouchesPerformTest3::onEnter(){ PerformBasicLayer::onEnter(); auto s = Director::getInstance()->getWinSize(); // add title auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32); addChild(label, 1); label->setPosition(Vec2(s.width/2, s.height-50)); #define TOUCH_PROFILER_NAME "TouchProfileName"#define TOUCHABLE_NODE_NUM 1000 srand((unsigned)time(nullptr)); for (int i = 0; i < TOUCHABLE_NODE_NUM; ++i) { int zorder = rand() % TOUCHABLE_NODE_NUM; auto layer = new (std::nothrow) TouchableLayer(); auto listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = CC_CALLBACK_2(TouchableLayer::onTouchBegan, layer); listener->onTouchMoved = CC_CALLBACK_2(TouchableLayer::onTouchMoved, layer); listener->onTouchEnded = CC_CALLBACK_2(TouchableLayer::onTouchEnded, layer); listener->onTouchCancelled = CC_CALLBACK_2(TouchableLayer::onTouchCancelled, layer); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, layer); addChild(layer, zorder); layer->release(); } auto emitEventlabel = Label::createWithSystemFont("Emit Touch Event", "", 24); auto menuItem = MenuItemLabel::create(emitEventlabel, [this](Ref* sender){ CC_PROFILER_PURGE_ALL(); std::vector<Touch*> touches; for (int i = 0; i < EventTouch::MAX_TOUCHES; ++i) { Touch* touch = new (std::nothrow) Touch(); touch->setTouchInfo(i, 10, (i+1) * 10); touches.push_back(touch); } EventTouch event; event.setEventCode(EventTouch::EventCode::BEGAN); event.setTouches(touches); for (int i = 0; i < 100; ++i) { CC_PROFILER_START(TOUCH_PROFILER_NAME); _eventDispatcher->dispatchEvent(&event); CC_PROFILER_STOP(TOUCH_PROFILER_NAME); } CC_PROFILER_DISPLAY_TIMERS(); for (auto& touch : touches) { touch->release(); } }); menuItem->setPosition(Vec2(0, -20)); auto menu = Menu::create(menuItem, nullptr); addChild(menu);}
开发者ID:AnySDK,项目名称:Sample_Lua,代码行数:71,
注:本文中的CC_PROFILER_START函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CC_RADIANS_TO_DEGREES函数代码示例 C++ CC_POINT_PIXELS_TO_POINTS函数代码示例 |