fixed shadow and outline can't take effect at the same time

This commit is contained in:
Dhilan007 2014-04-01 11:37:36 +08:00
parent 7804fdf0a1
commit 3a556c24aa
1 changed files with 25 additions and 12 deletions

View File

@ -108,20 +108,31 @@ Label* Label::createWithTTF(const TTFConfig& ttfConfig, const std::string& text,
Label *ret = new Label(nullptr,alignment);
if (!ret)
return nullptr;
if (ret->setTTFConfig(ttfConfig))
{
return nullptr;
}
do
{
if( FileUtils::getInstance()->isFileExist(ttfConfig.fontFilePath) && ret->setTTFConfig(ttfConfig))
{
break;
}
FontDefinition fontDef;
fontDef._fontName = ttfConfig.fontFilePath;
fontDef._fontSize = ttfConfig.fontSize;
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;
}
else
{
delete ret;
return nullptr;
}
}
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,
_effectColorF.r,_effectColorF.g,_effectColorF.b,_effectColorF.a);
}
else if(_shadowEnabled && _shadowBlurRadius <= 0)
if(_shadowEnabled && _shadowBlurRadius <= 0)
{
drawShadowWithoutBlur();
}
@ -1406,4 +1418,5 @@ void Label::setBlendFunc(const BlendFunc &blendFunc)
}
}
}
NS_CC_END