PuzzleSDK
NodeNormalizedPositionTest2类 参考

#include <NodeTest.h>

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

Public 成员函数

 CREATE_FUNC (NodeNormalizedPositionTest2)
 
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
 

Protected 成员函数

 NodeNormalizedPositionTest2 ()
 
void update (float dt) override
 
- Protected 成员函数 继承自 TestCocosNodeDemo
 TestCocosNodeDemo ()
 
virtual ~TestCocosNodeDemo ()
 

Protected 属性

cocos2d::Size _copyContentSize
 
float _accum
 
- Protected 属性 继承自 TestCocosNodeDemo
cocos2d::Director::Projection _preProjection
 
- 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
 

详细描述

在文件 NodeTest.h291 行定义.

构造及析构函数说明

◆ NodeNormalizedPositionTest2()

NodeNormalizedPositionTest2::NodeNormalizedPositionTest2 ( )
protected

在文件 NodeTest.cpp1154 行定义.

1155: _accum(0)
1156{
1157 Sprite *sprites[5];
1158 Vec2 positions[5];
1159 positions[0] = Vec2(0.0f,0.0f);
1160 positions[1] = Vec2(0.0f,1.0f);
1161 positions[2] = Vec2(0.5f,0.5f);
1162 positions[3] = Vec2(1.0f,0.0f);
1163 positions[4] = Vec2(1.0f,1.0f);
1164
1165 for(int i=0; i<5; i++) {
1166 sprites[i] = Sprite::create("Images/grossini.png");
1167 sprites[i]->setPositionNormalized(positions[i]);
1168 addChild(sprites[i]);
1169 }
1170 scheduleUpdate();
1171
1172 setContentSize( Director::getInstance()->getWinSize());
1173 _copyContentSize = getContentSize();
1174
1175// setAnchorPoint(Vec2(0.5,0.5));
1176// setPositionNormalized(Vec2(0.5,0.5));
1177}
cocos2d::Size _copyContentSize
Definition: NodeTest.h:302

引用了 _copyContentSize.

成员函数说明

◆ CREATE_FUNC()

NodeNormalizedPositionTest2::CREATE_FUNC ( NodeNormalizedPositionTest2  )

◆ subtitle()

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

重载 TestCase .

在文件 NodeTest.cpp1184 行定义.

1185{
1186 return "5 sprites: One in the center, the others on the corners of its parents";
1187}

◆ title()

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

重载 TestCocosNodeDemo .

在文件 NodeTest.cpp1179 行定义.

1180{
1181 return "setNormalizedPositon() #2";
1182}

◆ update()

void NodeNormalizedPositionTest2::update ( float  dt)
overrideprotected

在文件 NodeTest.cpp1189 行定义.

1190{
1191 _accum += dt;
1192
1193 // for 5 seconds
1194 float norm = sinf(_accum);
1195
1196 Size s = Size(_copyContentSize.width*norm, _copyContentSize.height*norm);
1197 setContentSize(s);
1198 CCLOG("s: %f,%f", s.width, s.height);
1199}

引用了 _accum , 以及 _copyContentSize.

类成员变量说明

◆ _accum

float NodeNormalizedPositionTest2::_accum
protected

在文件 NodeTest.h303 行定义.

被这些函数引用 update().

◆ _copyContentSize

cocos2d::Size NodeNormalizedPositionTest2::_copyContentSize
protected

在文件 NodeTest.h302 行定义.

被这些函数引用 NodeNormalizedPositionTest2() , 以及 update().


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