PuzzleSDK
SpriteRenderTextureBug类 参考

#include <RenderTextureTest.h>

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

class  SimpleSprite
 

Public 成员函数

 CREATE_FUNC (SpriteRenderTextureBug)
 
 SpriteRenderTextureBug ()
 
void onTouchesEnded (const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
SimpleSpriteaddNewSpriteWithCoords (const cocos2d::Vec2 &p)
 
- 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
 

额外继承的成员函数

- 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
 

详细描述

在文件 RenderTextureTest.h146 行定义.

构造及析构函数说明

◆ SpriteRenderTextureBug()

SpriteRenderTextureBug::SpriteRenderTextureBug ( )

在文件 RenderTextureTest.cpp700 行定义.

701{
702 auto listener = EventListenerTouchAllAtOnce::create();
703 listener->onTouchesEnded = CC_CALLBACK_2(SpriteRenderTextureBug::onTouchesEnded, this);
704 _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
705
706 auto s = Director::getInstance()->getWinSize();
707 addNewSpriteWithCoords(Vec2(s.width/2, s.height/2));
708}
void onTouchesEnded(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
SimpleSprite * addNewSpriteWithCoords(const cocos2d::Vec2 &p)

引用了 addNewSpriteWithCoords() , 以及 onTouchesEnded().

+ 函数调用图:

成员函数说明

◆ addNewSpriteWithCoords()

SpriteRenderTextureBug::SimpleSprite * SpriteRenderTextureBug::addNewSpriteWithCoords ( const cocos2d::Vec2 &  p)

在文件 RenderTextureTest.cpp710 行定义.

711{
712 int idx = CCRANDOM_0_1() * 1400 / 100;
713 int x = (idx%5) * 85;
714 int y = (idx/5) * 121;
715
716 auto sprite = SpriteRenderTextureBug::SimpleSprite::create("Images/grossini_dance_atlas.png",
717 Rect(x,y,85,121));
718 addChild(sprite);
719
720 sprite->setPosition(p);
721
722 FiniteTimeAction *action = nullptr;
723 float rd = CCRANDOM_0_1();
724
725 if (rd < 0.20)
726 action = ScaleBy::create(3, 2);
727 else if (rd < 0.40)
728 action = RotateBy::create(3, 360);
729 else if (rd < 0.60)
730 action = Blink::create(1, 3);
731 else if (rd < 0.8 )
732 action = TintBy::create(2, 0, -255, -255);
733 else
734 action = FadeOut::create(2);
735
736 auto action_back = action->reverse();
737 auto seq = Sequence::create(action, action_back, nullptr);
738
739 sprite->runAction(RepeatForever::create(seq));
740
741 //return sprite;
742 return nullptr;
743}
static SimpleSprite * create(const char *filename, const cocos2d::Rect &rect)

引用了 SpriteRenderTextureBug::SimpleSprite::create().

被这些函数引用 onTouchesEnded() , 以及 SpriteRenderTextureBug().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ CREATE_FUNC()

SpriteRenderTextureBug::CREATE_FUNC ( SpriteRenderTextureBug  )

◆ onTouchesEnded()

void SpriteRenderTextureBug::onTouchesEnded ( const std::vector< cocos2d::Touch * > &  touches,
cocos2d::Event *  event 
)

在文件 RenderTextureTest.cpp745 行定义.

746{
747 for (auto &touch: touches)
748 {
749 auto location = touch->getLocation();
750 addNewSpriteWithCoords(location);
751 }
752}

引用了 addNewSpriteWithCoords().

被这些函数引用 SpriteRenderTextureBug().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ subtitle()

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

重载 TestCase .

在文件 RenderTextureTest.cpp759 行定义.

760{
761 return "Touch the screen. Sprite should appear on under the touch";
762}

◆ title()

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

重载 TestCase .

在文件 RenderTextureTest.cpp754 行定义.

755{
756 return "SpriteRenderTextureBug";
757}

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