PuzzleSDK
LabelTTFCJKWrappingTest类 参考

#include <LabelTestNew.h>

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

Public 成员函数

 CREATE_FUNC (LabelTTFCJKWrappingTest)
 
 LabelTTFCJKWrappingTest ()
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
- 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
 
virtual void onEnter () override
 

额外继承的成员函数

- 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.h290 行定义.

构造及析构函数说明

◆ LabelTTFCJKWrappingTest()

LabelTTFCJKWrappingTest::LabelTTFCJKWrappingTest ( )

在文件 LabelTestNew.cpp1051 行定义.

1052{
1053 auto size = Director::getInstance()->getWinSize();
1054
1055 auto drawNode = DrawNode::create();
1056 drawNode->setAnchorPoint(Vec2(0, 0));
1057 this->addChild(drawNode);
1058 drawNode->drawSegment(
1059 Vec2(size.width * 0.1f, size.height * 0.8f),
1060 Vec2(size.width * 0.1, 0.0f), 1, Color4F(1.0f, 0.0f, 0.0f, 1.0f));
1061 drawNode->drawSegment(
1062 Vec2(size.width * 0.85f, size.height * 0.8f),
1063 Vec2(size.width * 0.85f, 0.0f), 1, Color4F(1.0f, 0.0f, 0.0f, 1.0f));
1064
1065 TTFConfig ttfConfig("fonts/HKYuanMini.ttf", 25, GlyphCollection::DYNAMIC);
1066 auto label1 = Label::createWithTTF(ttfConfig,
1067 "你好,Cocos2d-x v3的New Label.", TextHAlignment::LEFT, size.width * 0.75f);
1068 if(label1) {
1069 label1->setTextColor(Color4B(128, 255, 255, 255));
1070 label1->setPosition(Vec2(size.width * 0.1f, size.height * 0.6f));
1071 label1->setAnchorPoint(Vec2(0.0f, 0.5f));
1072 this->addChild(label1);
1073 // Demo for unloadFontAtlasTTF function, after it been called, all UI widget
1074 // use the special font must reset font, because the old one is invalid.
1075 FontAtlasCache::unloadFontAtlasTTF("fonts/HKYuanMini.ttf");
1076 label1->setTTFConfig(ttfConfig);
1077 }
1078
1079 auto label2 = Label::createWithTTF(ttfConfig,
1080 "早上好,Cocos2d-x v3的New Label.", TextHAlignment::LEFT, size.width * 0.75f);
1081 if(label2) {
1082 label2->setTextColor(Color4B(255, 128, 255, 255));
1083 label2->setPosition(Vec2(size.width * 0.1f, size.height * 0.4f));
1084 label2->setAnchorPoint(Vec2(0.0f, 0.5f));
1085 this->addChild(label2);
1086 }
1087
1088 auto label3 = Label::createWithTTF(ttfConfig,
1089 "美好的一天啊美好的一天啊美好的一天啊", TextHAlignment::LEFT, size.width * 0.75f);
1090 if(label3) {
1091 label3->setTextColor(Color4B(255, 255, 128, 255));
1092 label3->setPosition(Vec2(size.width * 0.1f, size.height * 0.2f));
1093 label3->setAnchorPoint(Vec2(0.0f, 0.5f));
1094 this->addChild(label3);
1095 }
1096}

成员函数说明

◆ CREATE_FUNC()

LabelTTFCJKWrappingTest::CREATE_FUNC ( LabelTTFCJKWrappingTest  )

◆ subtitle()

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

重载 TestCase .

在文件 LabelTestNew.cpp1103 行定义.

1104{
1105 return "New Label with CJK + ASCII characters\n"
1106 "Characters should stay in the correct position";
1107}

◆ title()

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

重载 TestCase .

在文件 LabelTestNew.cpp1098 行定义.

1099{
1100 return "New Label + .TTF";
1101}

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