PuzzleSDK
LabelItalics类 参考

#include <LabelTestNew.h>

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

Public 成员函数

 CREATE_FUNC (LabelItalics)
 
 LabelItalics ()
 
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.h833 行定义.

构造及析构函数说明

◆ LabelItalics()

LabelItalics::LabelItalics ( )

在文件 LabelTestNew.cpp3034 行定义.

3035{
3036 auto s = Director::getInstance()->getWinSize();
3037
3038 // LabelBMFont
3039 auto label1 = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "hello non-italics", TextHAlignment::CENTER, s.width);
3040 addChild(label1, 0, kTagBitmapAtlas1);
3041 label1->setPosition(Vec2(s.width/2, s.height*4/6));
3042 // you can enable italics by calling this method
3043
3044 _label1a = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "hello italics", TextHAlignment::CENTER, s.width);
3045 addChild(_label1a, 0, kTagBitmapAtlas1);
3046 _label1a->setPosition(Vec2(s.width/2, s.height*3/6));
3047 // you can enable italics by calling this method
3048 _label1a->enableItalics();
3049
3050
3051 // LabelTTF
3052 TTFConfig ttfConfig("fonts/arial.ttf",24);
3053 auto label2 = Label::createWithTTF(ttfConfig, "hello non-italics", TextHAlignment::CENTER,s.width);
3054 addChild(label2, 0, kTagBitmapAtlas2);
3055 label2->setPosition(Vec2(s.width/2, s.height*2/6));
3056
3057 // or by setting the italics parameter on TTFConfig
3058 ttfConfig.italics = true;
3059 _label2a = Label::createWithTTF(ttfConfig, "hello italics", TextHAlignment::CENTER,s.width);
3060 addChild(_label2a, 0, kTagBitmapAtlas2);
3061 _label2a->setPosition(Vec2(s.width/2, s.height*1/6));
3062
3063 auto menuItem = MenuItemFont::create("disable italics", [&](cocos2d::Ref* sender) {
3064 _label2a->disableEffect(LabelEffect::ITALICS);
3065 _label1a->disableEffect(LabelEffect::ITALICS);
3066 });
3067 menuItem->setFontSizeObj(12);
3068 auto menu = Menu::createWithItem(menuItem);
3069 addChild(menu);
3070 auto winSize = Director::getInstance()->getWinSize();
3071 menu->setPosition(winSize.width * 0.9, winSize.height * 0.25f);
3072}
@ kTagBitmapAtlas2
@ kTagBitmapAtlas1
cocos2d::Label * _label1a
Definition: LabelTestNew.h:842
cocos2d::Label * _label2a
Definition: LabelTestNew.h:843

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

成员函数说明

◆ CREATE_FUNC()

LabelItalics::CREATE_FUNC ( LabelItalics  )

◆ subtitle()

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

重载 TestCase .

在文件 LabelTestNew.cpp3079 行定义.

3080{
3081 return "italics on TTF and BMfont";
3082}

◆ title()

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

重载 TestCase .

在文件 LabelTestNew.cpp3074 行定义.

3075{
3076 return "Testing Italics";
3077}

类成员变量说明

◆ _label1a

cocos2d::Label* LabelItalics::_label1a

在文件 LabelTestNew.h842 行定义.

被这些函数引用 LabelItalics().

◆ _label2a

cocos2d::Label* LabelItalics::_label2a

在文件 LabelTestNew.h843 行定义.

被这些函数引用 LabelItalics().


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