mirror of https://github.com/axmolengine/axmol.git
fixed shadow and outline can't take effect at the same time
This commit is contained in:
parent
7804fdf0a1
commit
3a556c24aa
|
@ -108,20 +108,31 @@ Label* Label::createWithTTF(const TTFConfig& ttfConfig, const std::string& text,
|
||||||
Label *ret = new Label(nullptr,alignment);
|
Label *ret = new Label(nullptr,alignment);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret->setTTFConfig(ttfConfig))
|
do
|
||||||
{
|
{
|
||||||
ret->setMaxLineWidth(lineSize);
|
if( FileUtils::getInstance()->isFileExist(ttfConfig.fontFilePath) && ret->setTTFConfig(ttfConfig))
|
||||||
ret->setString(text);
|
{
|
||||||
ret->autorelease();
|
break;
|
||||||
return ret;
|
}
|
||||||
}
|
|
||||||
else
|
FontDefinition fontDef;
|
||||||
{
|
fontDef._fontName = ttfConfig.fontFilePath;
|
||||||
delete ret;
|
fontDef._fontSize = ttfConfig.fontSize;
|
||||||
return nullptr;
|
fontDef._dimensions = Size::ZERO;
|
||||||
}
|
fontDef._alignment = alignment;
|
||||||
|
fontDef._vertAlignment = TextVAlignment::TOP;
|
||||||
|
ret->setFontDefinition(fontDef);
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
ret->setMaxLineWidth(lineSize);
|
||||||
|
ret->setString(text);
|
||||||
|
ret->autorelease();
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Label* Label::createWithTTF(const std::string& text, const std::string& fontFilePath, int fontSize, int lineSize /* = 0 */, TextHAlignment alignment /* = TextHAlignment::CENTER */, GlyphCollection glyphs /* = GlyphCollection::NEHE */, const char *customGlyphs /* = 0 */, bool useDistanceField /* = false */)
|
Label* Label::createWithTTF(const std::string& text, const std::string& fontFilePath, int fontSize, int lineSize /* = 0 */, TextHAlignment alignment /* = TextHAlignment::CENTER */, GlyphCollection glyphs /* = GlyphCollection::NEHE */, const char *customGlyphs /* = 0 */, bool useDistanceField /* = false */)
|
||||||
|
@ -933,7 +944,8 @@ void Label::onDraw(const kmMat4& transform, bool transformUpdated)
|
||||||
_shaderProgram->setUniformLocationWith4f(_uniformEffectColor,
|
_shaderProgram->setUniformLocationWith4f(_uniformEffectColor,
|
||||||
_effectColorF.r,_effectColorF.g,_effectColorF.b,_effectColorF.a);
|
_effectColorF.r,_effectColorF.g,_effectColorF.b,_effectColorF.a);
|
||||||
}
|
}
|
||||||
else if(_shadowEnabled && _shadowBlurRadius <= 0)
|
|
||||||
|
if(_shadowEnabled && _shadowBlurRadius <= 0)
|
||||||
{
|
{
|
||||||
drawShadowWithoutBlur();
|
drawShadowWithoutBlur();
|
||||||
}
|
}
|
||||||
|
@ -1406,4 +1418,5 @@ void Label::setBlendFunc(const BlendFunc &blendFunc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
Loading…
Reference in New Issue