mirror of https://github.com/axmolengine/axmol.git
Merge pull request #2257 from dumganhar/master
Fixing compilation errors when CC_ENABLE_PROFILERS is enabled.
This commit is contained in:
commit
15d56f7f65
|
@ -203,9 +203,9 @@ It should work same as apples CFSwapInt32LittleToHost(..)
|
|||
#define CC_PROFILER_STOP_CATEGORY(__cat__, __name__) do{ if(__cat__) CCProfilingEndTimingBlock(__name__); } while(0)
|
||||
#define CC_PROFILER_RESET_CATEGORY(__cat__, __name__) do{ if(__cat__) CCProfilingResetTimingBlock(__name__); } while(0)
|
||||
|
||||
#define CC_PROFILER_START_INSTANCE(__id__, __name__) do{ CCProfilingBeginTimingBlock( [NSString stringWithFormat:@"%08X - %@", __id__, __name__] ); } while(0)
|
||||
#define CC_PROFILER_STOP_INSTANCE(__id__, __name__) do{ CCProfilingEndTimingBlock( [NSString stringWithFormat:@"%08X - %@", __id__, __name__] ); } while(0)
|
||||
#define CC_PROFILER_RESET_INSTANCE(__id__, __name__) do{ CCProfilingResetTimingBlock( [NSString stringWithFormat:@"%08X - %@", __id__, __name__] ); } while(0)
|
||||
#define CC_PROFILER_START_INSTANCE(__id__, __name__) do{ CCProfilingBeginTimingBlock( CCString::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)
|
||||
#define CC_PROFILER_STOP_INSTANCE(__id__, __name__) do{ CCProfilingEndTimingBlock( CCString::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)
|
||||
#define CC_PROFILER_RESET_INSTANCE(__id__, __name__) do{ CCProfilingResetTimingBlock( CCString::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)
|
||||
|
||||
|
||||
#else
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "support/zip_support/ZipUtils.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "kazmath/GL/matrix.h"
|
||||
#include "support/CCProfiling.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -402,7 +403,7 @@ void CCParticleBatchNode::removeAllChildrenWithCleanup(bool doCleanup)
|
|||
|
||||
void CCParticleBatchNode::draw(void)
|
||||
{
|
||||
CC_PROFILER_STOP("CCParticleBatchNode - draw");
|
||||
CC_PROFILER_START("CCParticleBatchNode - draw");
|
||||
|
||||
if( m_pTextureAtlas->getTotalQuads() == 0 )
|
||||
{
|
||||
|
|
|
@ -165,10 +165,7 @@ void NodeChildrenMainScene::updateQuantityLabel()
|
|||
////////////////////////////////////////////////////////
|
||||
IterateSpriteSheet::~IterateSpriteSheet()
|
||||
{
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfiler::releaseTimer(_profilingTimer);
|
||||
_profilingTimer = NULL;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void IterateSpriteSheet::updateQuantityOfNodes()
|
||||
|
@ -206,14 +203,10 @@ void IterateSpriteSheet::initWithQuantityOfNodes(unsigned int nNodes)
|
|||
|
||||
NodeChildrenMainScene::initWithQuantityOfNodes(nNodes);
|
||||
|
||||
#if CC_ENABLE_PROFILERS
|
||||
_profilingTimer = CCProfiler::timerWithName(profilerName().c_str(), this);
|
||||
#endif
|
||||
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
std::string IterateSpriteSheet::profilerName()
|
||||
const char* IterateSpriteSheet::profilerName()
|
||||
{
|
||||
return "none";
|
||||
}
|
||||
|
@ -229,9 +222,7 @@ void IterateSpriteSheetFastEnum::update(float dt)
|
|||
CCArray* pChildren = batchNode->getChildren();
|
||||
CCObject* pObject = NULL;
|
||||
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfilingBeginTimingBlock(_profilingTimer);
|
||||
#endif
|
||||
CC_PROFILER_START_INSTANCE(this, this->profilerName());
|
||||
|
||||
CCARRAY_FOREACH(pChildren, pObject)
|
||||
{
|
||||
|
@ -239,9 +230,7 @@ void IterateSpriteSheetFastEnum::update(float dt)
|
|||
pSprite->setVisible(false);
|
||||
}
|
||||
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfilingEndTimingBlock(_profilingTimer);
|
||||
#endif
|
||||
CC_PROFILER_STOP_INSTANCE(this, this->profilerName());
|
||||
}
|
||||
|
||||
std::string IterateSpriteSheetFastEnum::title()
|
||||
|
@ -254,7 +243,7 @@ std::string IterateSpriteSheetFastEnum::subtitle()
|
|||
return "Iterate children using Fast Enum API. See console";
|
||||
}
|
||||
|
||||
std::string IterateSpriteSheetFastEnum::profilerName()
|
||||
const char* IterateSpriteSheetFastEnum::profilerName()
|
||||
{
|
||||
return "iter fast enum";
|
||||
}
|
||||
|
@ -270,9 +259,7 @@ void IterateSpriteSheetCArray::update(float dt)
|
|||
CCArray* pChildren = batchNode->getChildren();
|
||||
CCObject* pObject = NULL;
|
||||
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfilingBeginTimingBlock(_profilingTimer);
|
||||
#endif
|
||||
CC_PROFILER_START(this->profilerName());
|
||||
|
||||
CCARRAY_FOREACH(pChildren, pObject)
|
||||
{
|
||||
|
@ -280,9 +267,7 @@ void IterateSpriteSheetCArray::update(float dt)
|
|||
pSprite->setVisible(false);
|
||||
}
|
||||
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfilingEndTimingBlock(_profilingTimer);
|
||||
#endif
|
||||
CC_PROFILER_STOP(this->profilerName());
|
||||
}
|
||||
|
||||
|
||||
|
@ -296,7 +281,7 @@ std::string IterateSpriteSheetCArray::subtitle()
|
|||
return "Iterate children using C Array API. See console";
|
||||
}
|
||||
|
||||
std::string IterateSpriteSheetCArray::profilerName()
|
||||
const char* IterateSpriteSheetCArray::profilerName()
|
||||
{
|
||||
return "iter c-array";
|
||||
}
|
||||
|
@ -308,10 +293,7 @@ std::string IterateSpriteSheetCArray::profilerName()
|
|||
////////////////////////////////////////////////////////
|
||||
AddRemoveSpriteSheet::~AddRemoveSpriteSheet()
|
||||
{
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfiler::releaseTimer(_profilingTimer);
|
||||
_profilingTimer = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void AddRemoveSpriteSheet::initWithQuantityOfNodes(unsigned int nNodes)
|
||||
|
@ -321,10 +303,6 @@ void AddRemoveSpriteSheet::initWithQuantityOfNodes(unsigned int nNodes)
|
|||
|
||||
NodeChildrenMainScene::initWithQuantityOfNodes(nNodes);
|
||||
|
||||
#if CC_ENABLE_PROFILERS
|
||||
_profilingTimer = CCProfiler::timerWithName(profilerName().c_str(), this);
|
||||
#endif
|
||||
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
|
@ -356,7 +334,7 @@ void AddRemoveSpriteSheet::updateQuantityOfNodes()
|
|||
currentQuantityOfNodes = quantityOfNodes;
|
||||
}
|
||||
|
||||
std::string AddRemoveSpriteSheet::profilerName()
|
||||
const char* AddRemoveSpriteSheet::profilerName()
|
||||
{
|
||||
return "none";
|
||||
}
|
||||
|
@ -388,18 +366,16 @@ void AddSpriteSheet::update(float dt)
|
|||
}
|
||||
|
||||
// add them with random Z (very important!)
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfilingBeginTimingBlock(_profilingTimer);
|
||||
#endif
|
||||
CC_PROFILER_START( this->profilerName() );
|
||||
|
||||
for( int i=0; i < totalToAdd;i++ )
|
||||
{
|
||||
batchNode->addChild((CCNode*) (sprites->objectAtIndex(i)), zs[i], kTagBase+i);
|
||||
}
|
||||
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfilingEndTimingBlock(_profilingTimer);
|
||||
#endif
|
||||
batchNode->sortAllChildren();
|
||||
|
||||
CC_PROFILER_STOP(this->profilerName());
|
||||
|
||||
// remove them
|
||||
for( int i=0;i < totalToAdd;i++)
|
||||
|
@ -421,7 +397,7 @@ std::string AddSpriteSheet::subtitle()
|
|||
return "Adds %10 of total sprites with random z. See console";
|
||||
}
|
||||
|
||||
std::string AddSpriteSheet::profilerName()
|
||||
const char* AddSpriteSheet::profilerName()
|
||||
{
|
||||
return "add sprites";
|
||||
}
|
||||
|
@ -456,18 +432,14 @@ void RemoveSpriteSheet::update(float dt)
|
|||
}
|
||||
|
||||
// remove them
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfilingBeginTimingBlock(_profilingTimer);
|
||||
#endif
|
||||
CC_PROFILER_START( this->profilerName() );
|
||||
|
||||
for( int i=0;i < totalToAdd;i++)
|
||||
{
|
||||
batchNode->removeChildByTag(kTagBase+i, true);
|
||||
}
|
||||
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfilingEndTimingBlock(_profilingTimer);
|
||||
#endif
|
||||
CC_PROFILER_STOP( this->profilerName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,7 +453,7 @@ std::string RemoveSpriteSheet::subtitle()
|
|||
return "Remove %10 of total sprites placed randomly. See console";
|
||||
}
|
||||
|
||||
std::string RemoveSpriteSheet::profilerName()
|
||||
const char* RemoveSpriteSheet::profilerName()
|
||||
{
|
||||
return "remove sprites";
|
||||
}
|
||||
|
@ -515,12 +487,10 @@ void ReorderSpriteSheet::update(float dt)
|
|||
batchNode->addChild((CCNode*) (sprites->objectAtIndex(i)), CCRANDOM_MINUS1_1() * 50, kTagBase+i);
|
||||
}
|
||||
|
||||
// [batchNode sortAllChildren];
|
||||
batchNode->sortAllChildren();
|
||||
|
||||
// reorder them
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfilingBeginTimingBlock(_profilingTimer);
|
||||
#endif
|
||||
CC_PROFILER_START( this->profilerName() );
|
||||
|
||||
for( int i=0;i < totalToAdd;i++)
|
||||
{
|
||||
|
@ -528,9 +498,8 @@ void ReorderSpriteSheet::update(float dt)
|
|||
batchNode->reorderChild(pNode, CCRANDOM_MINUS1_1() * 50);
|
||||
}
|
||||
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfilingEndTimingBlock(_profilingTimer);
|
||||
#endif
|
||||
batchNode->sortAllChildren();
|
||||
CC_PROFILER_STOP( this->profilerName() );
|
||||
|
||||
// remove them
|
||||
for( int i=0;i < totalToAdd;i++)
|
||||
|
@ -550,7 +519,7 @@ std::string ReorderSpriteSheet::subtitle()
|
|||
return "Reorder %10 of total sprites placed randomly. See console";
|
||||
}
|
||||
|
||||
std::string ReorderSpriteSheet::profilerName()
|
||||
const char* ReorderSpriteSheet::profilerName()
|
||||
{
|
||||
return "reorder sprites";
|
||||
}
|
||||
|
|
|
@ -38,14 +38,10 @@ public:
|
|||
virtual void updateQuantityOfNodes();
|
||||
virtual void initWithQuantityOfNodes(unsigned int nNodes);
|
||||
virtual void update(float dt) = 0;
|
||||
virtual std::string profilerName();
|
||||
virtual const char* profilerName();
|
||||
|
||||
protected:
|
||||
CCSpriteBatchNode *batchNode;
|
||||
|
||||
#if CC_ENABLE_PROFILERS
|
||||
CCProfilingTimer *_profilingTimer;
|
||||
#endif
|
||||
};
|
||||
|
||||
class IterateSpriteSheetFastEnum : public IterateSpriteSheet
|
||||
|
@ -55,7 +51,7 @@ public:
|
|||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual std::string profilerName();
|
||||
virtual const char* profilerName();
|
||||
};
|
||||
|
||||
class IterateSpriteSheetCArray : public IterateSpriteSheet
|
||||
|
@ -65,7 +61,7 @@ public:
|
|||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual std::string profilerName();
|
||||
virtual const char* profilerName();
|
||||
};
|
||||
|
||||
class AddRemoveSpriteSheet : public NodeChildrenMainScene
|
||||
|
@ -75,7 +71,7 @@ public:
|
|||
virtual void updateQuantityOfNodes();
|
||||
virtual void initWithQuantityOfNodes(unsigned int nNodes);
|
||||
virtual void update(float dt) = 0;
|
||||
virtual std::string profilerName();
|
||||
virtual const char* profilerName();
|
||||
|
||||
protected:
|
||||
CCSpriteBatchNode *batchNode;
|
||||
|
@ -92,7 +88,7 @@ public:
|
|||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual std::string profilerName();
|
||||
virtual const char* profilerName();
|
||||
};
|
||||
|
||||
class RemoveSpriteSheet : public AddRemoveSpriteSheet
|
||||
|
@ -102,7 +98,7 @@ public:
|
|||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual std::string profilerName();
|
||||
virtual const char* profilerName();
|
||||
};
|
||||
|
||||
class ReorderSpriteSheet : public AddRemoveSpriteSheet
|
||||
|
@ -112,7 +108,7 @@ public:
|
|||
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual std::string profilerName();
|
||||
virtual const char* profilerName();
|
||||
};
|
||||
|
||||
void runNodeChildrenTest();
|
||||
|
|
Loading…
Reference in New Issue