PuzzleSDK
LabelUnderline类 参考

#include <LabelTestNew.h>

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

Public 成员函数

 CREATE_FUNC (LabelUnderline)
 
 LabelUnderline ()
 
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 属性

cocos2d::Label * _label1a
 
cocos2d::Label * _label2a
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 LabelTestNew.h859 行定义.

构造及析构函数说明

◆ LabelUnderline()

LabelUnderline::LabelUnderline ( )

在文件 LabelTestNew.cpp3138 行定义.

3139{
3140 auto s = Director::getInstance()->getWinSize();
3141
3142 // LabelBMFont
3143 auto label1 = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "hello non-underline", TextHAlignment::CENTER, s.width);
3144 addChild(label1, 0, kTagBitmapAtlas1);
3145 label1->setPosition(Vec2(s.width/2, s.height*4/6));
3146 // you can enable italics by calling this method
3147
3148 _label1a = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "hello underline", TextHAlignment::CENTER, s.width);
3149 addChild(_label1a, 0, kTagBitmapAtlas1);
3150 _label1a->setPosition(Vec2(s.width/2, s.height*3/6));
3151 // you can enable underline by calling this method
3152 _label1a->enableUnderline();
3153
3154
3155 // LabelTTF
3156 TTFConfig ttfConfig("fonts/arial.ttf",24);
3157 auto label2 = Label::createWithTTF(ttfConfig, "hello non-underline", TextHAlignment::CENTER,s.width);
3158 addChild(label2, 0, kTagBitmapAtlas2);
3159 label2->setPosition(Vec2(s.width/2, s.height*2/6));
3160
3161 // or by setting the italics parameter on TTFConfig
3162 ttfConfig.underline = true;
3163 _label2a = Label::createWithTTF(ttfConfig, "hello underline", TextHAlignment::CENTER,s.width);
3164 addChild(_label2a, 0, kTagBitmapAtlas2);
3165 _label2a->setPosition(Vec2(s.width/2, s.height*1/6));
3166
3167 auto menuItem = MenuItemFont::create("disable underline", [&](cocos2d::Ref* sender) {
3168 _label2a->disableEffect(LabelEffect::UNDERLINE);
3169 _label1a->disableEffect(LabelEffect::UNDERLINE);
3170 });
3171 menuItem->setFontSizeObj(12);
3172 auto menu = Menu::createWithItem(menuItem);
3173 addChild(menu);
3174 auto winSize = Director::getInstance()->getWinSize();
3175 menu->setPosition(winSize.width * 0.9, winSize.height * 0.25f);
3176}
@ kTagBitmapAtlas2
@ kTagBitmapAtlas1
cocos2d::Label * _label2a
Definition: LabelTestNew.h:869
cocos2d::Label * _label1a
Definition: LabelTestNew.h:868

引用了 _label1a, _label2a, kTagBitmapAtlas1 , 以及 kTagBitmapAtlas2.

成员函数说明

◆ CREATE_FUNC()

LabelUnderline::CREATE_FUNC ( LabelUnderline  )

◆ subtitle()

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

重载 TestCase .

在文件 LabelTestNew.cpp3183 行定义.

3184{
3185 return "Underline on TTF and BMfont";
3186}

◆ title()

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

重载 TestCase .

在文件 LabelTestNew.cpp3178 行定义.

3179{
3180 return "Testing Underline";
3181}

类成员变量说明

◆ _label1a

cocos2d::Label* LabelUnderline::_label1a

在文件 LabelTestNew.h868 行定义.

被这些函数引用 LabelUnderline().

◆ _label2a

cocos2d::Label* LabelUnderline::_label2a

在文件 LabelTestNew.h869 行定义.

被这些函数引用 LabelUnderline().


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