PuzzleSDK
UILayoutTest_Layout_Scaled_Widget类 参考

#include <UILayoutTest.h>

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

Public 成员函数

 UILayoutTest_Layout_Scaled_Widget ()
 
 ~UILayoutTest_Layout_Scaled_Widget ()
 
virtual bool init () override
 
 CREATE_FUNC (UILayoutTest_Layout_Scaled_Widget)
 
- 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.h127 行定义.

构造及析构函数说明

◆ UILayoutTest_Layout_Scaled_Widget()

UILayoutTest_Layout_Scaled_Widget::UILayoutTest_Layout_Scaled_Widget ( )

在文件 UILayoutTest.cpp756 行定义.

757{
758}

◆ ~UILayoutTest_Layout_Scaled_Widget()

UILayoutTest_Layout_Scaled_Widget::~UILayoutTest_Layout_Scaled_Widget ( )

在文件 UILayoutTest.cpp760 行定义.

761{
762}

成员函数说明

◆ CREATE_FUNC()

UILayoutTest_Layout_Scaled_Widget::CREATE_FUNC ( UILayoutTest_Layout_Scaled_Widget  )

◆ init()

bool UILayoutTest_Layout_Scaled_Widget::init ( )
overridevirtual

重载 UIScene .

在文件 UILayoutTest.cpp764 行定义.

765{
766 if (UIScene::init())
767 {
768 Size widgetSize = _widget->getContentSize();
769
770 // Add the alert
771 Text* alert = Text::create("Layout Scaled Widget", "fonts/Marker Felt.ttf", 20);
772 alert->setColor(Color3B(159, 168, 176));
773 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 4.5f));
774 _uiLayer->addChild(alert);
775
776 Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));
777
778 Layout* background = dynamic_cast<Layout*>(root->getChildByName("background_Panel"));
779
780 // Create the layout
781 Layout* layout = Layout::create();
782 layout->setLayoutType(Layout::Type::HORIZONTAL);
783 layout->setContentSize(Size(280, 150));
784 Size backgroundSize = background->getContentSize();
785 layout->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
786 (backgroundSize.width - layout->getContentSize().width) / 2.0f,
787 (widgetSize.height - backgroundSize.height) / 2.0f +
788 (backgroundSize.height - layout->getContentSize().height) / 2.0f));
789 _uiLayer->addChild(layout);
790
791 ImageView* imageView_Center1 = ImageView::create("cocosui/scrollviewbg.png");
792 imageView_Center1->setScale(0.5);
793 layout->addChild(imageView_Center1);
794
795 ImageView* imageView_Center2 = ImageView::create("cocosui/scrollviewbg.png");
796 imageView_Center2->setScale(1.2);
797 layout->addChild(imageView_Center2);
798
799 ImageView* imageView_Center3 = ImageView::create("cocosui/scrollviewbg.png");
800 imageView_Center3->setScale(0.8);
801 layout->addChild(imageView_Center3);
802
803 return true;
804 }
805
806 return false;
807}
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().

+ 函数调用图:

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