PuzzleSDK
LabelBold类 参考

#include <LabelTestNew.h>

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

Public 成员函数

 CREATE_FUNC (LabelBold)
 
 LabelBold ()
 
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.h846 行定义.

构造及析构函数说明

◆ LabelBold()

LabelBold::LabelBold ( )

在文件 LabelTestNew.cpp3086 行定义.

3087{
3088 auto s = Director::getInstance()->getWinSize();
3089
3090 // LabelBMFont
3091 auto label1 = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "hello non-bold", TextHAlignment::CENTER, s.width);
3092 addChild(label1, 0, kTagBitmapAtlas1);
3093 label1->setPosition(Vec2(s.width/2, s.height*4/6));
3094 // you can enable italics by calling this method
3095
3096 _label1a = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "hello bold", TextHAlignment::CENTER, s.width);
3097 addChild(_label1a, 0, kTagBitmapAtlas1);
3098 _label1a->setPosition(Vec2(s.width/2, s.height*3/6));
3099 // you can enable italics by calling this method
3100 _label1a->enableBold();
3101
3102
3103 // LabelTTF
3104 TTFConfig ttfConfig("fonts/arial.ttf",24);
3105 auto label2 = Label::createWithTTF(ttfConfig, "hello non-bold", TextHAlignment::CENTER,s.width);
3106 addChild(label2, 0, kTagBitmapAtlas2);
3107 label2->setPosition(Vec2(s.width/2, s.height*2/6));
3108
3109 // or by setting the italics parameter on TTFConfig
3110 ttfConfig.bold = true;
3111 _label2a = Label::createWithTTF(ttfConfig, "hello bold", TextHAlignment::CENTER,s.width);
3112 addChild(_label2a, 0, kTagBitmapAtlas2);
3113 _label2a->setPosition(Vec2(s.width/2, s.height*1/6));
3114
3115 auto menuItem = MenuItemFont::create("disable bold", [&](cocos2d::Ref* sender) {
3116 _label2a->disableEffect(LabelEffect::BOLD);
3117 _label1a->disableEffect(LabelEffect::BOLD);
3118 });
3119 menuItem->setFontSizeObj(12);
3120 auto menu = Menu::createWithItem(menuItem);
3121 addChild(menu);
3122 auto winSize = Director::getInstance()->getWinSize();
3123 menu->setPosition(winSize.width * 0.9, winSize.height * 0.25f);
3124}
@ kTagBitmapAtlas2
@ kTagBitmapAtlas1
cocos2d::Label * _label2a
Definition: LabelTestNew.h:856
cocos2d::Label * _label1a
Definition: LabelTestNew.h:855

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

成员函数说明

◆ CREATE_FUNC()

LabelBold::CREATE_FUNC ( LabelBold  )

◆ subtitle()

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

重载 TestCase .

在文件 LabelTestNew.cpp3131 行定义.

3132{
3133 return "Bold on TTF and BMfont";
3134}

◆ title()

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

重载 TestCase .

在文件 LabelTestNew.cpp3126 行定义.

3127{
3128 return "Testing Bold";
3129}

类成员变量说明

◆ _label1a

cocos2d::Label* LabelBold::_label1a

在文件 LabelTestNew.h855 行定义.

被这些函数引用 LabelBold().

◆ _label2a

cocos2d::Label* LabelBold::_label2a

在文件 LabelTestNew.h856 行定义.

被这些函数引用 LabelBold().


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