mirror of https://github.com/axmolengine/axmol.git
Add shadow, outline, glow filter support for UITextField
This commit is contained in:
parent
f4d8e396e2
commit
7ece807a63
|
@ -336,6 +336,24 @@ void Text::updateTextureRGBA()
|
|||
{
|
||||
updateRGBAToRenderer(_labelRenderer);
|
||||
}
|
||||
|
||||
void Text::enableShadow(const Color4B& shadowColor,const Size &offset, int blurRadius) {
|
||||
_labelRenderer->enableShadow(shadowColor, offset, blurRadius);
|
||||
}
|
||||
|
||||
void Text::enableOutline(const Color4B& outlineColor,int outlineSize) {
|
||||
if (_type == Type::TTF)
|
||||
_labelRenderer->enableOutline(outlineColor, outlineSize);
|
||||
}
|
||||
|
||||
void Text::enableGlow(const Color4B& glowColor) {
|
||||
if (_type == Type::TTF)
|
||||
_labelRenderer->enableGlow(glowColor);
|
||||
}
|
||||
|
||||
void Text::disableEffect() {
|
||||
_labelRenderer->disableEffect();
|
||||
}
|
||||
|
||||
Widget* Text::createCloneInstance()
|
||||
{
|
||||
|
|
|
@ -158,6 +158,22 @@ public:
|
|||
|
||||
TextVAlignment getTextVerticalAlignment();
|
||||
|
||||
/**
|
||||
* Enable shadow for the label
|
||||
*
|
||||
* @todo support blur for shadow effect
|
||||
*/
|
||||
void enableShadow(const Color4B& shadowColor = Color4B::BLACK,const Size &offset = Size(2,-2), int blurRadius = 0);
|
||||
|
||||
/** only support for TTF */
|
||||
void enableOutline(const Color4B& outlineColor,int outlineSize = -1);
|
||||
|
||||
/** only support for TTF */
|
||||
void enableGlow(const Color4B& glowColor);
|
||||
|
||||
/** disable shadow/outline/glow rendering */
|
||||
void disableEffect();
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
virtual bool init() override;
|
||||
virtual bool init(const std::string& textContent,
|
||||
|
|
Loading…
Reference in New Issue