From b14999a7a7154a34b844e21e93f85aa946fadce8 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Sat, 4 Jan 2014 10:56:14 +0800 Subject: [PATCH] fix label not appear on the screen --- cocos/2d/CCLabel.cpp | 9 ++++++++- cocos/2d/CCLabel.h | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) 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; };