mirror of https://github.com/axmolengine/axmol.git
fixed logical error.
This commit is contained in:
parent
774debd142
commit
89eba4424f
|
@ -345,7 +345,7 @@ void Label::reset()
|
|||
|
||||
_shadowEnabled = false;
|
||||
_clipEnabled = false;
|
||||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||
_blendFuncDirty = false;
|
||||
}
|
||||
|
||||
void Label::updateShaderProgram()
|
||||
|
@ -1014,7 +1014,10 @@ void Label::createSpriteWithFontDefinition()
|
|||
_textSprite->setAnchorPoint(Point::ANCHOR_BOTTOM_LEFT);
|
||||
this->setContentSize(_textSprite->getContentSize());
|
||||
texture->release();
|
||||
_textSprite->setBlendFunc(_blendFunc);
|
||||
if (_blendFuncDirty)
|
||||
{
|
||||
_textSprite->setBlendFunc(_blendFunc);
|
||||
}
|
||||
|
||||
Node::addChild(_textSprite,0,Node::INVALID_TAG);
|
||||
|
||||
|
@ -1086,7 +1089,10 @@ void Label::drawTextSprite(Renderer *renderer, bool parentTransformUpdated)
|
|||
if (_shadowEnabled && _shadowNode == nullptr)
|
||||
{
|
||||
_shadowNode = Sprite::createWithTexture(_textSprite->getTexture());
|
||||
_shadowNode->setBlendFunc(_blendFunc);
|
||||
if (_shadowNode)
|
||||
{
|
||||
_shadowNode->setBlendFunc(_blendFunc);
|
||||
}
|
||||
_shadowNode->setAnchorPoint(Point::ANCHOR_BOTTOM_LEFT);
|
||||
_shadowNode->setColor(_shadowColor);
|
||||
_shadowNode->setOpacity(_effectColorF.a * _displayedOpacity);
|
||||
|
@ -1392,4 +1398,17 @@ void Label::listenToFontAtlasPurge(EventCustom *event)
|
|||
}
|
||||
}
|
||||
|
||||
void Label::setBlendFunc(const BlendFunc &blendFunc)
|
||||
{
|
||||
_blendFunc = blendFunc;
|
||||
_blendFuncDirty = true;
|
||||
if (_textSprite)
|
||||
{
|
||||
_textSprite->setBlendFunc(blendFunc);
|
||||
if (_shadowNode)
|
||||
{
|
||||
_shadowNode->setBlendFunc(blendFunc);
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_CC_END
|
||||
|
|
|
@ -255,6 +255,7 @@ public:
|
|||
*/
|
||||
void listenToFontAtlasPurge(EventCustom *event);
|
||||
|
||||
virtual void setBlendFunc(const BlendFunc &blendFunc) override;
|
||||
protected:
|
||||
void onDraw(const kmMat4& transform, bool transformUpdated);
|
||||
|
||||
|
@ -378,6 +379,7 @@ protected:
|
|||
Color4F _textColorF;
|
||||
|
||||
bool _clipEnabled;
|
||||
bool _blendFuncDirty;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Label);
|
||||
|
|
Loading…
Reference in New Issue