PuzzleSDK
MultipleParticleSystemsBatched类 参考

#include <ParticleTest.h>

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

Public 成员函数

 CREATE_FUNC (MultipleParticleSystemsBatched)
 
virtual void onEnter () override
 
virtual void update (float dt) override
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
- Public 成员函数 继承自 ParticleDemo
 ~ParticleDemo ()
 
void toggleCallback (cocos2d::Ref *sender)
 
void onTouchesBegan (const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
 
void onTouchesMoved (const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
 
void onTouchesEnded (const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
 
void setEmitterPosition ()
 
- 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 属性 继承自 ParticleDemo
cocos2d::ParticleSystemQuad * _emitter
 
cocos2d::Sprite * _background
 
cocos2d::LayerColor * _color
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 ParticleTest.h306 行定义.

成员函数说明

◆ CREATE_FUNC()

MultipleParticleSystemsBatched::CREATE_FUNC ( MultipleParticleSystemsBatched  )

◆ onEnter()

void MultipleParticleSystemsBatched::onEnter ( )
overridevirtual

重载 ParticleDemo .

在文件 ParticleTest.cpp1552 行定义.

1553{
1555
1556 _color->setColor(Color3B::BLACK);
1557 removeChild(_background, true);
1558 _background = nullptr;
1559
1560 ParticleBatchNode *batchNode = ParticleBatchNode::createWithTexture(nullptr, 3000);
1561
1562 addChild(batchNode, 1, 2);
1563
1564 for (int i = 0; i<5; i++) {
1565
1566 auto particleSystem = ParticleSystemQuad::create("Particles/SpinningPeas.plist");
1567
1568 particleSystem->setPositionType(ParticleSystem::PositionType::GROUPED);
1569 particleSystem->setPosition(Vec2(i*50.0f,i*50.0f));
1570
1571 batchNode->setTexture(particleSystem->getTexture());
1572 batchNode->addChild(particleSystem);
1573 }
1574
1575 _emitter = nullptr;
1576}
cocos2d::Sprite * _background
Definition: ParticleTest.h:36
virtual void onEnter() override
cocos2d::ParticleSystemQuad * _emitter
Definition: ParticleTest.h:35
cocos2d::LayerColor * _color
Definition: ParticleTest.h:37

引用了 ParticleDemo::_background, ParticleDemo::_color, ParticleDemo::_emitter , 以及 ParticleDemo::onEnter().

+ 函数调用图:

◆ subtitle()

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

重载 ParticleDemo .

在文件 ParticleTest.cpp1603 行定义.

1604{
1605 return "v1.1 test: should perform better than previous test";
1606}

◆ title()

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

重载 ParticleDemo .

在文件 ParticleTest.cpp1598 行定义.

1599{
1600 return "Multiple particle systems batched";
1601}

◆ update()

void MultipleParticleSystemsBatched::update ( float  dt)
overridevirtual

重载 ParticleDemo .

在文件 ParticleTest.cpp1578 行定义.

1579{
1580 auto atlas = (LabelAtlas*) getChildByTag(kTagParticleCount);
1581
1582 int count = 0;
1583
1584 auto batchNode = getChildByTag(2);
1585 for(const auto &child : batchNode->getChildren()) {
1586 auto item = dynamic_cast<ParticleSystem*>(child);
1587 if (item != nullptr)
1588 {
1589 count += item->getParticleCount();
1590 }
1591 }
1592
1593 char str[50] = {0};
1594 sprintf(str, "%4d", count);
1595 atlas->setString(str);
1596}
@ kTagParticleCount

引用了 kTagParticleCount.


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