Merge pull request #6356 from Dhilan007/develop_v3

fixed drawDebugData of LabelBMFont/LabelAtlas.
This commit is contained in:
minggo 2014-04-23 15:24:30 +08:00
commit 55911e1e78
4 changed files with 12 additions and 11 deletions

View File

@ -249,18 +249,16 @@ void LabelAtlas::updateColor()
} }
//CCLabelAtlas - draw //CCLabelAtlas - draw
#if CC_LABELATLAS_DEBUG_DRAW
void LabelAtlas::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) void LabelAtlas::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
AtlasNode::draw(renderer, transform, transformUpdated); AtlasNode::draw(renderer, transform, transformUpdated);
#if CC_LABELATLAS_DEBUG_DRAW
_customDebugDrawCommand.init(_globalZOrder); _customDebugDrawCommand.init(_globalZOrder);
_customDebugDrawCommand.func = CC_CALLBACK_0(LabelAtlas::drawDebugData, this,transform,transformUpdated); _customDebugDrawCommand.func = CC_CALLBACK_0(LabelAtlas::drawDebugData, this,transform,transformUpdated);
renderer->addCommand(&_customDebugDrawCommand); renderer->addCommand(&_customDebugDrawCommand);
#endif
} }
#if CC_LABELATLAS_DEBUG_DRAW
void LabelAtlas::drawDebugData(const kmMat4& transform, bool transformUpdated) void LabelAtlas::drawDebugData(const kmMat4& transform, bool transformUpdated)
{ {
kmGLPushMatrix(); kmGLPushMatrix();

View File

@ -82,7 +82,10 @@ public:
virtual void setString(const std::string &label) override; virtual void setString(const std::string &label) override;
virtual const std::string& getString(void) const override; virtual const std::string& getString(void) const override;
virtual std::string getDescription() const override; virtual std::string getDescription() const override;
#if CC_LABELATLAS_DEBUG_DRAW
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
#endif
protected: protected:
LabelAtlas() LabelAtlas()
@ -98,7 +101,7 @@ protected:
#if CC_LABELATLAS_DEBUG_DRAW #if CC_LABELATLAS_DEBUG_DRAW
CustomCommand _customDebugDrawCommand; CustomCommand _customDebugDrawCommand;
void drawDebugData(const kmMat4& transform, bool transformUpdated); void drawDebugData(const kmMat4& transform, bool transformUpdated);
#endif //CC_SPRITE_DEBUG_DRAW #endif
// string to render // string to render
std::string _string; std::string _string;

View File

@ -206,18 +206,16 @@ Rect LabelBMFont::getBoundingBox() const
{ {
return _label->getBoundingBox(); return _label->getBoundingBox();
} }
#if CC_LABELBMFONT_DEBUG_DRAW
void LabelBMFont::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) void LabelBMFont::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated)
{ {
Node::draw(renderer, transform, transformUpdated); Node::draw(renderer, transform, transformUpdated);
#if CC_LABELBMFONT_DEBUG_DRAW
_customDebugDrawCommand.init(_globalZOrder); _customDebugDrawCommand.init(_globalZOrder);
_customDebugDrawCommand.func = CC_CALLBACK_0(LabelBMFont::drawDebugData, this,transform,transformUpdated); _customDebugDrawCommand.func = CC_CALLBACK_0(LabelBMFont::drawDebugData, this,transform,transformUpdated);
renderer->addCommand(&_customDebugDrawCommand); renderer->addCommand(&_customDebugDrawCommand);
#endif
} }
#if CC_LABELBMFONT_DEBUG_DRAW
void LabelBMFont::drawDebugData(const kmMat4& transform, bool transformUpdated) void LabelBMFont::drawDebugData(const kmMat4& transform, bool transformUpdated)
{ {
kmGLPushMatrix(); kmGLPushMatrix();

View File

@ -123,13 +123,15 @@ public:
virtual Rect getBoundingBox() const override; virtual Rect getBoundingBox() const override;
virtual std::string getDescription() const override; virtual std::string getDescription() const override;
#if CC_LABELBMFONT_DEBUG_DRAW
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override; virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
private: #endif
private:
#if CC_LABELBMFONT_DEBUG_DRAW #if CC_LABELBMFONT_DEBUG_DRAW
CustomCommand _customDebugDrawCommand; CustomCommand _customDebugDrawCommand;
void drawDebugData(const kmMat4& transform, bool transformUpdated); void drawDebugData(const kmMat4& transform, bool transformUpdated);
#endif // CC_LABELBMFONT_DEBUG_DRAW #endif
// name of fntFile // name of fntFile
std::string _fntFile; std::string _fntFile;