PuzzleSDK
LabelTTFOldNew类 参考

#include <LabelTestNew.h>

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

Public 成员函数

 CREATE_FUNC (LabelTTFOldNew)
 
 LabelTTFOldNew ()
 
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.h411 行定义.

构造及析构函数说明

◆ LabelTTFOldNew()

LabelTTFOldNew::LabelTTFOldNew ( )

在文件 LabelTestNew.cpp1537 行定义.

1538{
1539 auto s = Director::getInstance()->getWinSize();
1540 float delta = s.height/4;
1541
1542 auto label1 = Label::createWithSystemFont("Cocos2d-x Label Test", "arial", 24);
1543 addChild(label1, 0, kTagBitmapAtlas1);
1544 label1->setPosition(Vec2(s.width/2, delta * 2));
1545 label1->setColor(Color3B::RED);
1546
1547 TTFConfig ttfConfig("fonts/arial.ttf", 24);
1548 auto label2 = Label::createWithTTF(ttfConfig, "Cocos2d-x Label Test");
1549 addChild(label2, 0, kTagBitmapAtlas2);
1550 label2->setPosition(Vec2(s.width/2, delta * 2));
1551
1552 auto drawNode = DrawNode::create();
1553 auto labelSize = label1->getContentSize();
1554 auto origin = Director::getInstance()->getWinSize();
1555
1556 origin.width = origin.width / 2 - (labelSize.width / 2);
1557 origin.height = origin.height / 2 - (labelSize.height / 2);
1558
1559 Vec2 vertices[4]=
1560 {
1561 Vec2(origin.width, origin.height),
1562 Vec2(labelSize.width + origin.width, origin.height),
1563 Vec2(labelSize.width + origin.width, labelSize.height + origin.height),
1564 Vec2(origin.width, labelSize.height + origin.height)
1565 };
1566 drawNode->drawPoly(vertices, 4, true, Color4F(1.0f, 0.0f, 0.0f, 1.0f));
1567
1568 labelSize = label2->getContentSize();
1569 origin = Director::getInstance()->getWinSize();
1570
1571 origin.width = origin.width / 2 - (labelSize.width / 2);
1572 origin.height = origin.height / 2 - (labelSize.height / 2);
1573
1574 Vec2 vertices2[4]=
1575 {
1576 Vec2(origin.width, origin.height),
1577 Vec2(labelSize.width + origin.width, origin.height),
1578 Vec2(labelSize.width + origin.width, labelSize.height + origin.height),
1579 Vec2(origin.width, labelSize.height + origin.height)
1580 };
1581 drawNode->drawPoly(vertices2, 4, true, Color4F(1.0f, 1.0f, 1.0f, 1.0f));
1582
1583 addChild(drawNode);
1584}
@ kTagBitmapAtlas2
@ kTagBitmapAtlas1

引用了 kTagBitmapAtlas1 , 以及 kTagBitmapAtlas2.

成员函数说明

◆ CREATE_FUNC()

LabelTTFOldNew::CREATE_FUNC ( LabelTTFOldNew  )

◆ subtitle()

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

重载 TestCase .

在文件 LabelTestNew.cpp1591 行定义.

1592{
1593 return "Comparison between old(red) and new(white) TTF label";
1594}

◆ title()

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

重载 TestCase .

在文件 LabelTestNew.cpp1586 行定义.

1587{
1588 return "New / Old TTF";
1589}

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