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
#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();

View File

@ -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;

View File

@ -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();

View File

@ -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;