fix label not appear on the screen

This commit is contained in:
Dhilan007 2014-01-04 10:56:14 +08:00
parent e017609fc4
commit b14999a7a7
2 changed files with 12 additions and 2 deletions

View File

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

View File

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