From a4ac5ab05434e66ec4a52677ef244267f3a43f3a Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Wed, 23 Apr 2014 15:05:02 +0800 Subject: [PATCH] fixed drawDebugData of LabelBMFont/LabelAtlas. --- cocos/2d/CCLabelAtlas.cpp | 6 ++---- cocos/2d/CCLabelAtlas.h | 5 ++++- cocos/2d/CCLabelBMFont.cpp | 6 ++---- cocos/2d/CCLabelBMFont.h | 6 ++++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/cocos/2d/CCLabelAtlas.cpp b/cocos/2d/CCLabelAtlas.cpp index f3ccb5a4cd..6e07b83f30 100644 --- a/cocos/2d/CCLabelAtlas.cpp +++ b/cocos/2d/CCLabelAtlas.cpp @@ -249,18 +249,16 @@ void LabelAtlas::updateColor() } //CCLabelAtlas - draw - +#if CC_LABELATLAS_DEBUG_DRAW void LabelAtlas::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) { AtlasNode::draw(renderer, transform, transformUpdated); -#if CC_LABELATLAS_DEBUG_DRAW + _customDebugDrawCommand.init(_globalZOrder); _customDebugDrawCommand.func = CC_CALLBACK_0(LabelAtlas::drawDebugData, this,transform,transformUpdated); renderer->addCommand(&_customDebugDrawCommand); -#endif } -#if CC_LABELATLAS_DEBUG_DRAW void LabelAtlas::drawDebugData(const kmMat4& transform, bool transformUpdated) { kmGLPushMatrix(); diff --git a/cocos/2d/CCLabelAtlas.h b/cocos/2d/CCLabelAtlas.h index d6a55643ed..fda65f0e53 100644 --- a/cocos/2d/CCLabelAtlas.h +++ b/cocos/2d/CCLabelAtlas.h @@ -82,7 +82,10 @@ public: virtual void setString(const std::string &label) override; virtual const std::string& getString(void) const override; virtual std::string getDescription() const override; + +#if CC_LABELATLAS_DEBUG_DRAW virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override; +#endif protected: LabelAtlas() @@ -98,7 +101,7 @@ protected: #if CC_LABELATLAS_DEBUG_DRAW CustomCommand _customDebugDrawCommand; void drawDebugData(const kmMat4& transform, bool transformUpdated); -#endif //CC_SPRITE_DEBUG_DRAW +#endif // string to render std::string _string; diff --git a/cocos/2d/CCLabelBMFont.cpp b/cocos/2d/CCLabelBMFont.cpp index 2a038aced9..fa9f9cd9b1 100644 --- a/cocos/2d/CCLabelBMFont.cpp +++ b/cocos/2d/CCLabelBMFont.cpp @@ -206,18 +206,16 @@ Rect LabelBMFont::getBoundingBox() const { return _label->getBoundingBox(); } - +#if CC_LABELBMFONT_DEBUG_DRAW void LabelBMFont::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) { Node::draw(renderer, transform, transformUpdated); -#if CC_LABELBMFONT_DEBUG_DRAW + _customDebugDrawCommand.init(_globalZOrder); _customDebugDrawCommand.func = CC_CALLBACK_0(LabelBMFont::drawDebugData, this,transform,transformUpdated); renderer->addCommand(&_customDebugDrawCommand); -#endif } -#if CC_LABELBMFONT_DEBUG_DRAW void LabelBMFont::drawDebugData(const kmMat4& transform, bool transformUpdated) { kmGLPushMatrix(); diff --git a/cocos/2d/CCLabelBMFont.h b/cocos/2d/CCLabelBMFont.h index 9437fcf508..455b35605f 100644 --- a/cocos/2d/CCLabelBMFont.h +++ b/cocos/2d/CCLabelBMFont.h @@ -123,13 +123,15 @@ public: virtual Rect getBoundingBox() const override; virtual std::string getDescription() const override; +#if CC_LABELBMFONT_DEBUG_DRAW virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override; -private: +#endif +private: #if CC_LABELBMFONT_DEBUG_DRAW CustomCommand _customDebugDrawCommand; void drawDebugData(const kmMat4& transform, bool transformUpdated); -#endif // CC_LABELBMFONT_DEBUG_DRAW +#endif // name of fntFile std::string _fntFile;