PuzzleSDK
UILayoutTest_BackGroundImage_Scale9类 参考

#include <UILayoutTest.h>

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

Public 成员函数

 UILayoutTest_BackGroundImage_Scale9 ()
 
 ~UILayoutTest_BackGroundImage_Scale9 ()
 
virtual bool init () override
 
 CREATE_FUNC (UILayoutTest_BackGroundImage_Scale9)
 
- 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
 

额外继承的成员函数

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

详细描述

在文件 UILayoutTest.h77 行定义.

构造及析构函数说明

◆ UILayoutTest_BackGroundImage_Scale9()

UILayoutTest_BackGroundImage_Scale9::UILayoutTest_BackGroundImage_Scale9 ( )

在文件 UILayoutTest.cpp316 行定义.

317{
318}

◆ ~UILayoutTest_BackGroundImage_Scale9()

UILayoutTest_BackGroundImage_Scale9::~UILayoutTest_BackGroundImage_Scale9 ( )

在文件 UILayoutTest.cpp320 行定义.

321{
322}

成员函数说明

◆ CREATE_FUNC()

UILayoutTest_BackGroundImage_Scale9::CREATE_FUNC ( UILayoutTest_BackGroundImage_Scale9  )

◆ init()

bool UILayoutTest_BackGroundImage_Scale9::init ( )
overridevirtual

重载 UIScene .

在文件 UILayoutTest.cpp324 行定义.

325{
326 if (UIScene::init())
327 {
328 Size widgetSize = _widget->getContentSize();
329
330 // Add the alert
331 Text* alert = Text::create("Layout background image scale9", "fonts/Marker Felt.ttf", 20);
332 alert->setColor(Color3B(159, 168, 176));
333 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 4.5f));
334 _uiLayer->addChild(alert);
335
336 Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));
337
338 Layout* background = dynamic_cast<Layout*>(root->getChildByName("background_Panel"));
339
340 // Create the layout with background image
341 Layout* layout = Layout::create();
342 layout->setBackGroundImageScale9Enabled(true);
343 layout->setBackGroundImage("cocosui/green_edit.png");
344 layout->setContentSize(Size(280, 150));
345 Size backgroundSize = background->getContentSize();
346 layout->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
347 (backgroundSize.width - layout->getContentSize().width) / 2.0f,
348 (widgetSize.height - backgroundSize.height) / 2.0f +
349 (backgroundSize.height - layout->getContentSize().height) / 2.0f));
350 _uiLayer->addChild(layout);
351
352 Button* button = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png");
353 button->setPosition(Vec2(button->getContentSize().width / 2.0f,
354 layout->getContentSize().height - button->getContentSize().height / 2.0f));
355
356 layout->addChild(button);
357
358 Button* titleButton = Button::create("cocosui/backtotopnormal.png", "cocosui/backtotoppressed.png");
359 titleButton->setTitleText("Title Button");
360 titleButton->setPosition(Vec2(layout->getContentSize().width / 2.0f, layout->getContentSize().height / 2.0f));
361 layout->addChild(titleButton);
362
363 Button* button_scale9 = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png");
364 button_scale9->setScale9Enabled(true);
365 button_scale9->setContentSize(Size(100.0f, button_scale9->getVirtualRendererSize().height));
366 button_scale9->setPosition(Vec2(layout->getContentSize().width - button_scale9->getContentSize().width / 2.0f,
367 button_scale9->getContentSize().height / 2.0f));
368 layout->addChild(button_scale9);
369
370 return true;
371 }
372 return false;
373}
cocos2d::Layer * _uiLayer
Definition: UIScene.h:44
virtual bool init() override
Definition: UIScene.cpp:46
cocos2d::ui::Layout * _widget
Definition: UIScene.h:45

引用了 UIScene::_uiLayer, UIScene::_widget , 以及 UIScene::init().

+ 函数调用图:

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