PuzzleSDK
LabelShadowTest类 参考

#include <LabelTestNew.h>

+ 类 LabelShadowTest 继承关系图:
+ LabelShadowTest 的协作图:

Public 成员函数

 CREATE_FUNC (LabelShadowTest)
 
 LabelShadowTest ()
 
virtual void onEnter () override
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
void sliderEvent (cocos2d::Ref *sender, cocos2d::ui::Slider::EventType type)
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual Type getTestType () const
 
virtual float getDuration () const
 
virtual std::string getExpectedOutput () const
 
virtual std::string getActualOutput () const
 
virtual void restartTestCallback (cocos2d::Ref *sender)
 
virtual void nextTestCallback (cocos2d::Ref *sender)
 
virtual void priorTestCallback (cocos2d::Ref *sender)
 
virtual void onBackCallback (cocos2d::Ref *sender)
 
void setTestSuite (TestSuite *testSuite)
 
TestSuitegetTestSuite () const
 
float getRunTime () const
 
void setTestCaseName (const std::string &name)
 
std::string getTestCaseName () const
 
const cocos2d::Label * getSubtitleLable () const
 
const cocos2d::MenuItemImage * getRestartTestItem () const
 

Private 属性

cocos2d::Label * shadowLabelOutline
 
cocos2d::Label * shadowLabelTTF
 
cocos2d::Label * shadowLabelGrow
 
cocos2d::Label * shadowLabelBMFont
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 LabelTestNew.h348 行定义.

构造及析构函数说明

◆ LabelShadowTest()

LabelShadowTest::LabelShadowTest ( )

在文件 LabelTestNew.cpp1319 行定义.

1320{
1321
1322}

成员函数说明

◆ CREATE_FUNC()

LabelShadowTest::CREATE_FUNC ( LabelShadowTest  )

◆ onEnter()

void LabelShadowTest::onEnter ( )
overridevirtual

重载 TestCase .

在文件 LabelTestNew.cpp1324 行定义.

1325{
1327
1328 auto size = Director::getInstance()->getWinSize();
1329
1330 auto bg = LayerColor::create(Color4B(200,191,231,255));
1331 this->addChild(bg);
1332
1333 auto slider = ui::Slider::create();
1334 slider->setTag(1);
1335 slider->setTouchEnabled(true);
1336 slider->loadBarTexture("cocosui/sliderTrack.png");
1337 slider->loadSlidBallTextures("cocosui/sliderThumb.png", "cocosui/sliderThumb.png", "");
1338 slider->loadProgressBarTexture("cocosui/sliderProgress.png");
1339 slider->setPosition(Vec2(size.width / 2.0f, size.height * 0.15f + slider->getContentSize().height * 2.0f));
1340 slider->setPercent(52);
1341 slider->addEventListener(CC_CALLBACK_2(LabelShadowTest::sliderEvent, this));
1342 addChild(slider, 999);
1343
1344 auto slider2 = ui::Slider::create();
1345 slider2->setTag(2);
1346 slider2->setTouchEnabled(true);
1347 slider2->loadBarTexture("cocosui/sliderTrack.png");
1348 slider2->loadSlidBallTextures("cocosui/sliderThumb.png", "cocosui/sliderThumb.png", "");
1349 slider2->loadProgressBarTexture("cocosui/sliderProgress.png");
1350 slider2->setPosition(Vec2(size.width * 0.15f, size.height / 2.0f));
1351 slider2->setRotation(90);
1352 slider2->setPercent(52);
1353 slider2->addEventListener(CC_CALLBACK_2(LabelShadowTest::sliderEvent, this));
1354 addChild(slider2, 999);
1355
1356 float subtitleY = _subtitleLabel->getPosition().y;
1357 float horizontalSliderY = slider->getPosition().y;
1358 float step = (subtitleY - horizontalSliderY) / 4;
1359
1360 TTFConfig ttfConfig("fonts/arial.ttf", 40, GlyphCollection::DYNAMIC,nullptr,true);
1361
1362 shadowLabelTTF = Label::createWithTTF(ttfConfig,"TTF:Shadow");
1363 shadowLabelTTF->setPosition( Vec2(size.width/2, horizontalSliderY + step * (0.5f + 3)) );
1364 shadowLabelTTF->setTextColor( Color4B::RED );
1365 shadowLabelTTF->enableShadow(Color4B::BLACK);
1366 addChild(shadowLabelTTF);
1367
1368 shadowLabelOutline = Label::createWithTTF(ttfConfig,"TTF:Shadow");
1369 shadowLabelOutline->setPosition( Vec2(size.width/2, horizontalSliderY + step * (0.5f + 2)) );
1370 shadowLabelOutline->setTextColor( Color4B::RED );
1371 shadowLabelOutline->enableOutline(Color4B::YELLOW,1);
1372 shadowLabelOutline->enableShadow(Color4B::GREEN);
1373 addChild(shadowLabelOutline);
1374
1375 shadowLabelGrow = Label::createWithTTF(ttfConfig,"TTF:Shadow");
1376 shadowLabelGrow->setPosition( Vec2(size.width/2, horizontalSliderY + step * (0.5f + 1)) );
1377 shadowLabelGrow->setTextColor( Color4B::RED );
1378 shadowLabelGrow->enableGlow(Color4B::YELLOW);
1379 shadowLabelGrow->enableShadow(Color4B::BLUE);
1380 addChild(shadowLabelGrow);
1381
1382 shadowLabelBMFont = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "BMFont:Shadow");
1383 shadowLabelBMFont->setPosition( Vec2(size.width/2, horizontalSliderY + step * 0.5f));
1384 shadowLabelBMFont->setColor( Color3B::RED );
1385 shadowLabelBMFont->enableShadow(Color4B::GREEN);
1386 addChild(shadowLabelBMFont);
1387}
cocos2d::Label * shadowLabelGrow
Definition: LabelTestNew.h:363
void sliderEvent(cocos2d::Ref *sender, cocos2d::ui::Slider::EventType type)
cocos2d::Label * shadowLabelOutline
Definition: LabelTestNew.h:361
cocos2d::Label * shadowLabelTTF
Definition: LabelTestNew.h:362
cocos2d::Label * shadowLabelBMFont
Definition: LabelTestNew.h:364
virtual void onEnter() override
Definition: BaseTest.cpp:430
cocos2d::Label * _subtitleLabel
Definition: BaseTest.h:107

引用了 TestCase::_subtitleLabel, TestCase::onEnter(), shadowLabelBMFont, shadowLabelGrow, shadowLabelOutline, shadowLabelTTF , 以及 sliderEvent().

+ 函数调用图:

◆ sliderEvent()

void LabelShadowTest::sliderEvent ( cocos2d::Ref *  sender,
cocos2d::ui::Slider::EventType  type 
)

在文件 LabelTestNew.cpp1389 行定义.

1390{
1391 if (type == Slider::EventType::ON_PERCENTAGE_CHANGED)
1392 {
1393 Slider* slider = (Slider*)this->getChildByTag(1);
1394 Slider* slider2 = (Slider*)this->getChildByTag(2);
1395
1396 auto offset = Size(slider->getPercent()-50,50 - slider2->getPercent());
1397 shadowLabelTTF->enableShadow(Color4B::BLACK,offset);
1398 shadowLabelBMFont->enableShadow(Color4B::GREEN,offset);
1399 shadowLabelOutline->enableShadow(Color4B::GREEN,offset);
1400 shadowLabelGrow->enableShadow(Color4B::BLUE,offset);
1401 }
1402}

引用了 shadowLabelBMFont, shadowLabelGrow, shadowLabelOutline , 以及 shadowLabelTTF.

被这些函数引用 onEnter().

+ 这是这个函数的调用关系图:

◆ subtitle()

std::string LabelShadowTest::subtitle ( ) const
overridevirtual

重载 TestCase .

在文件 LabelTestNew.cpp1409 行定义.

1410{
1411 return "Testing shadow of label";
1412}

◆ title()

std::string LabelShadowTest::title ( ) const
overridevirtual

重载 TestCase .

在文件 LabelTestNew.cpp1404 行定义.

1405{
1406 return "New Label";
1407}

类成员变量说明

◆ shadowLabelBMFont

cocos2d::Label* LabelShadowTest::shadowLabelBMFont
private

在文件 LabelTestNew.h364 行定义.

被这些函数引用 onEnter() , 以及 sliderEvent().

◆ shadowLabelGrow

cocos2d::Label* LabelShadowTest::shadowLabelGrow
private

在文件 LabelTestNew.h363 行定义.

被这些函数引用 onEnter() , 以及 sliderEvent().

◆ shadowLabelOutline

cocos2d::Label* LabelShadowTest::shadowLabelOutline
private

在文件 LabelTestNew.h361 行定义.

被这些函数引用 onEnter() , 以及 sliderEvent().

◆ shadowLabelTTF

cocos2d::Label* LabelShadowTest::shadowLabelTTF
private

在文件 LabelTestNew.h362 行定义.

被这些函数引用 onEnter() , 以及 sliderEvent().


该类的文档由以下文件生成: