PuzzleSDK
Material_clone类 参考

#include <MaterialSystemTest.h>

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

Public 成员函数

 CREATE_FUNC (Material_clone)
 
virtual void onEnter () override
 
virtual std::string subtitle () const override
 
- Public 成员函数 继承自 MaterialSystemBaseTest
virtual std::string title () 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
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 MaterialSystemTest.h116 行定义.

成员函数说明

◆ CREATE_FUNC()

Material_clone::CREATE_FUNC ( Material_clone  )

◆ onEnter()

void Material_clone::onEnter ( )
overridevirtual

重载 TestCase .

在文件 MaterialSystemTest.cpp350 行定义.

351{
353
354 auto sprite = Sprite3D::create("Sprite3DTest/boss1.obj");
355 sprite->setScale(3);
356 this->addChild(sprite);
357 sprite->setPositionNormalized(Vec2(0.25f, 0.5f));
358
359 Material *mat = Material::createWithFilename("Materials/3d_effects.material");
360 sprite->setMaterial(mat);
361
362 auto rot = RotateBy::create(5, Vec3(360.0f,240.0f,120.0f));
363 auto repeat = RepeatForever::create(rot);
364 sprite->runAction(repeat);
365
366 // sprite 2... using same material
367 auto sprite2 = Sprite3D::create("Sprite3DTest/boss1.obj");
368 sprite2->setScale(3);
369 this->addChild(sprite2);
370 sprite2->setPositionNormalized(Vec2(0.5f, 0.5f));
371 sprite2->setMaterial(mat);
372 sprite2->runAction(repeat->clone());
373
374 // sprite 3... using cloned material
375 auto sprite3 = Sprite3D::create("Sprite3DTest/boss1.obj");
376 sprite3->setScale(3);
377 this->addChild(sprite3);
378 sprite3->setPositionNormalized(Vec2(0.75f, 0.5f));
379 auto mat2 = mat->clone();
380 sprite3->setMaterial(mat2);
381 sprite3->runAction(repeat->clone());
382
383 // testing clone
384 // should affect both sprite 1 and sprite 2
385 mat->setTechnique("outline");
386
387 // should affect only sprite 3
388// mat2->setTechnique("normal");
389
390}
virtual void onEnter() override
Definition: BaseTest.cpp:430

引用了 TestCase::onEnter().

+ 函数调用图:

◆ subtitle()

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

重载 TestCase .

在文件 MaterialSystemTest.cpp392 行定义.

393{
394 return "Testing material->clone()";
395}

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