diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index c2a512d482..d0e203bbf4 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -500,7 +500,7 @@ void Label::setFontSize(int fontSize) Node::setScale(1.0f*_fontSize/DISTANCEFIELD_ATLAS_FONTSIZE); } -void Label::draw() +void Label::onDraw() { CC_PROFILER_START("CCSpriteBatchNode - draw"); @@ -527,6 +527,13 @@ void Label::draw() CC_PROFILER_STOP("CCSpriteBatchNode - draw"); } +void Label::draw() +{ + _customCommand.init(0, _vertexZ); + _customCommand.func = CC_CALLBACK_0(Label::onDraw, this); + Director::getInstance()->getRenderer()->addCommand(&_customCommand); +} + ///// PROTOCOL STUFF Sprite * Label::getLetter(int ID) diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index 29f0cecb91..aa33f8b72c 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -29,6 +29,7 @@ #include "CCSpriteBatchNode.h" #include "CCLabelTextFormatProtocol.h" #include "ccTypes.h" +#include "renderer/CCCustomCommand.h" NS_CC_BEGIN @@ -119,6 +120,7 @@ public: virtual std::string getDescription() const override; virtual void draw(void) override; + virtual void onDraw(); private: /** @@ -172,7 +174,8 @@ private: Color3B _effectColor; GLuint _uniformEffectColor; - + + CustomCommand _customCommand; };