mirror of https://github.com/axmolengine/axmol.git
add text effect test
This commit is contained in:
parent
a52532c3c5
commit
c387ae3bc7
|
@ -74,9 +74,9 @@ static const char* s_testArray[] =
|
|||
"UITextAtlasTest",
|
||||
"UITextTest",
|
||||
"UITextTest_LineWrap",
|
||||
/*
|
||||
|
||||
"UILabelTest_Effect",
|
||||
*/
|
||||
|
||||
"UITextTest_TTF",
|
||||
"UITextBMFontTest",
|
||||
"UITextFieldTest",
|
||||
|
@ -275,10 +275,10 @@ Scene *UISceneManager::currentUIScene()
|
|||
case kUITextTest_LineWrap:
|
||||
return UITextTest_LineWrap::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||
|
||||
/*
|
||||
|
||||
case kUILabelTest_Effect:
|
||||
return UILabelTest_Effect::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||
*/
|
||||
|
||||
|
||||
case kUITextTest_TTF:
|
||||
return UITextTest_TTF::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||
|
|
|
@ -64,9 +64,8 @@ enum
|
|||
kUITextAtlasTest,
|
||||
kUITextTest,
|
||||
kUITextTest_LineWrap,
|
||||
/*
|
||||
|
||||
kUILabelTest_Effect,
|
||||
*/
|
||||
kUITextTest_TTF,
|
||||
kUITextBMFontTest,
|
||||
kUITextFieldTest,
|
||||
|
|
|
@ -54,7 +54,7 @@ bool UITextTest_LineWrap::init()
|
|||
|
||||
// UILabelTest_Effect
|
||||
|
||||
/*
|
||||
|
||||
bool UILabelTest_Effect::init()
|
||||
{
|
||||
if (UIScene::init())
|
||||
|
@ -62,7 +62,7 @@ bool UILabelTest_Effect::init()
|
|||
Size widgetSize = _widget->getSize();
|
||||
|
||||
Text* alert = Text::create();
|
||||
alert->setText("Label Effect");
|
||||
alert->setString("Label Effect");
|
||||
alert->setFontName("fonts/Marker Felt.ttf");
|
||||
alert->setFontSize(30);
|
||||
alert->setColor(Color3B(159, 168, 176));
|
||||
|
@ -73,83 +73,40 @@ bool UILabelTest_Effect::init()
|
|||
// create the shadow only label
|
||||
Text* shadow_label = Text::create();
|
||||
|
||||
Color3B tintColorRed = { 255, 0, 0 };
|
||||
Size shadowOffset(12.0f, 12.0f);
|
||||
|
||||
FontDefinition shadowTextDef;
|
||||
shadowTextDef._fontSize = 20;
|
||||
shadowTextDef._fontName = std::string("fonts/Marker Felt.ttf");
|
||||
|
||||
shadowTextDef._shadow._shadowEnabled = true;
|
||||
shadowTextDef._shadow._shadowOffset = shadowOffset;
|
||||
shadowTextDef._shadow._shadowOpacity = 1.0f;
|
||||
shadowTextDef._shadow._shadowBlur = 1.0f;
|
||||
shadowTextDef._fontFillColor = tintColorRed;
|
||||
|
||||
shadow_label->setTextDefinition(shadowTextDef);
|
||||
shadow_label->setText("Shadow");
|
||||
shadow_label->enableShadow();
|
||||
shadow_label->setString("Shadow");
|
||||
shadow_label->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + shadow_label->getSize().height));
|
||||
|
||||
_uiLayer->addChild(shadow_label);
|
||||
|
||||
|
||||
// create the stroke only label
|
||||
Text* stroke_label = Text::create();
|
||||
Text* glow_label = Text::create();
|
||||
glow_label->setFontName("fonts/Marker Felt.ttf");
|
||||
|
||||
glow_label->setString("Glow");
|
||||
glow_label->enableGlow(Color4B::RED);
|
||||
|
||||
|
||||
Color3B tintColorYellow = { 255, 255, 0 };
|
||||
Color3B strokeColor = { 0, 10, 255 };
|
||||
glow_label->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||
|
||||
FontDefinition strokeTextDef;
|
||||
strokeTextDef._fontSize = 20;
|
||||
strokeTextDef._fontName = std::string("fonts/Marker Felt.ttf");
|
||||
|
||||
strokeTextDef._stroke._strokeEnabled = true;
|
||||
strokeTextDef._stroke._strokeColor = strokeColor;
|
||||
strokeTextDef._stroke._strokeSize = 1.5f;
|
||||
|
||||
strokeTextDef._fontFillColor = tintColorYellow;
|
||||
|
||||
stroke_label->setTextDefinition(strokeTextDef);
|
||||
stroke_label->setText("Stroke");
|
||||
stroke_label->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||
|
||||
_uiLayer->addChild(stroke_label);
|
||||
_uiLayer->addChild(glow_label);
|
||||
|
||||
|
||||
// create the label stroke and shadow
|
||||
Text* strokeAndShadow_label = Text::create();
|
||||
Text* outline_label = Text::create();
|
||||
outline_label->enableOutline(Color4B::BLUE, 2);
|
||||
outline_label->setString("Outline");
|
||||
outline_label->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - shadow_label->getSize().height));
|
||||
|
||||
Color3B tintColorBlue = { 0, 0, 255 };
|
||||
Color3B strokeShadowColor = { 255, 0, 0 };
|
||||
|
||||
FontDefinition strokeShaodwTextDef;
|
||||
strokeShaodwTextDef._fontSize = 20;
|
||||
strokeShaodwTextDef._fontName = std::string("fonts/Marker Felt.ttf");
|
||||
|
||||
strokeShaodwTextDef._stroke._strokeEnabled = true;
|
||||
strokeShaodwTextDef._stroke._strokeColor = strokeShadowColor;
|
||||
strokeShaodwTextDef._stroke._strokeSize = 1.5f;
|
||||
|
||||
strokeShaodwTextDef._shadow._shadowEnabled = true;
|
||||
strokeShaodwTextDef._shadow._shadowOffset = shadowOffset;
|
||||
strokeShaodwTextDef._shadow._shadowOpacity = 1.0f;
|
||||
strokeShaodwTextDef._shadow._shadowBlur = 1.0f;
|
||||
|
||||
strokeShaodwTextDef._fontFillColor = tintColorBlue;
|
||||
|
||||
strokeAndShadow_label->setTextDefinition(strokeShaodwTextDef);
|
||||
// strokeAndShadow_label->setFontFillColor(tintColorRed);
|
||||
strokeAndShadow_label->setText("Stroke and Shadow");
|
||||
strokeAndShadow_label->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - shadow_label->getSize().height));
|
||||
|
||||
_uiLayer->addChild(strokeAndShadow_label);
|
||||
_uiLayer->addChild(outline_label);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// UITextTest_TTF
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ protected:
|
|||
UI_SCENE_CREATE_FUNC(UITextTest_LineWrap)
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
class UILabelTest_Effect : public UIScene
|
||||
{
|
||||
public:
|
||||
|
@ -54,7 +54,7 @@ public:
|
|||
protected:
|
||||
UI_SCENE_CREATE_FUNC(UILabelTest_Effect)
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
class UITextTest_TTF : public UIScene
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue