PuzzleSDK
UITextBMFontTest类 参考

#include <UITextBMFontTest.h>

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

Public 成员函数

virtual bool init () override
 
void printWidgetResources (cocos2d::Ref *sender)
 
- Public 成员函数 继承自 UIScene
 UIScene ()
 
 ~UIScene ()
 
virtual void onEnter () override
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual std::string title () const
 
virtual std::string subtitle () const
 
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
 

Protected 属性

cocos2d::ui::TextBMFont * _textBMFont
 
- Protected 属性 继承自 UIScene
cocos2d::Layer * _uiLayer
 
cocos2d::ui::Layout * _widget
 
cocos2d::ui::Text * _sceneTitle
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 

详细描述

在文件 UITextBMFontTest.h33 行定义.

成员函数说明

◆ init()

bool UITextBMFontTest::init ( )
overridevirtual

重载 UIScene .

在文件 UITextBMFontTest.cpp36 行定义.

37{
38 if (UIScene::init())
39 {
40 Size widgetSize = _widget->getContentSize();
41
42 Text* alert = Text::create("TextBMFont","TextBMFont",30);
43 alert->setColor(Color3B(159, 168, 176));
44 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
45 _uiLayer->addChild(alert);
46
47 // Create the TextBMFont
48 TextBMFont* textBMFont = TextBMFont::create("BMFont", "cocosui/bitmapFontTest2.fnt");
49 textBMFont->setPosition(Vec2(widgetSize.width / 2, widgetSize.height / 2.0f + textBMFont->getContentSize().height / 8.0f));
50 _uiLayer->addChild(textBMFont);
51
52 _textBMFont = textBMFont;
53
54 TTFConfig ttfConfig("fonts/arial.ttf", 15);
55 auto label1 = Label::createWithTTF(ttfConfig, "Print Resources");
56 auto item1 = MenuItemLabel::create(label1, CC_CALLBACK_1(UITextBMFontTest::printWidgetResources, this));
57 item1->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y + item1->getContentSize().height * 3));
58 auto pMenu1 = Menu::create(item1, nullptr);
59 pMenu1->setPosition(Vec2(0, 0));
60 this->addChild(pMenu1, 10);
61
62 return true;
63 }
64 return false;
65}
cocos2d::Layer * _uiLayer
Definition: UIScene.h:44
virtual bool init() override
Definition: UIScene.cpp:46
cocos2d::ui::Layout * _widget
Definition: UIScene.h:45
cocos2d::ui::TextBMFont * _textBMFont
void printWidgetResources(cocos2d::Ref *sender)
static cocos2d::Vec2 bottom()
Definition: VisibleRect.cpp:63
static cocos2d::Vec2 left()
Definition: VisibleRect.cpp:45

引用了 _textBMFont, UIScene::_uiLayer, UIScene::_widget, VisibleRect::bottom(), UIScene::init(), VisibleRect::left() , 以及 printWidgetResources().

+ 函数调用图:

◆ printWidgetResources()

void UITextBMFontTest::printWidgetResources ( cocos2d::Ref *  sender)

在文件 UITextBMFontTest.cpp66 行定义.

67{
68 cocos2d::ResourceData textureFile = _textBMFont->getRenderFile();
69 CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type);
70}

引用了 _textBMFont.

被这些函数引用 init().

+ 这是这个函数的调用关系图:

类成员变量说明

◆ _textBMFont

cocos2d::ui::TextBMFont* UITextBMFontTest::_textBMFont
protected

在文件 UITextBMFontTest.h41 行定义.

被这些函数引用 init() , 以及 printWidgetResources().


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