#include <SpriteTest.h>
◆ Sprite1()
在文件 SpriteTest.cpp 第 148 行定义.
150 auto listener = EventListenerTouchAllAtOnce::create();
152 _eventDispatcher->addEventListenerWithSceneGraphPriority(listener,
this);
154 auto s = Director::getInstance()->getWinSize();
void onTouchesEnded(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
void addNewSpriteWithCoords(cocos2d::Vec2 p)
引用了 addNewSpriteWithCoords() , 以及 onTouchesEnded().
◆ addNewSpriteWithCoords()
| void Sprite1::addNewSpriteWithCoords |
( |
cocos2d::Vec2 |
p | ) |
|
在文件 SpriteTest.cpp 第 158 行定义.
160 int idx = (int)(CCRANDOM_0_1() * 1400.0f / 100.0f);
161 int x = (idx%5) * 85;
162 int y = (idx/5) * 121;
165 auto sprite = Sprite::create(
"Images/grossini_dance_atlas.png", Rect(x,y,85,121) );
168 sprite->setPosition( Vec2( p.x, p.y) );
170 ActionInterval* action;
171 float random = CCRANDOM_0_1();
174 action = ScaleBy::create(3, 2);
175 else if(random < 0.40)
176 action = RotateBy::create(3, 360);
177 else if( random < 0.60)
178 action = Blink::create(1, 3);
179 else if( random < 0.8 )
180 action = TintBy::create(2, 0, -255, -255);
182 action = FadeOut::create(2);
183 auto action_back = action->reverse();
184 auto seq = Sequence::create( action, action_back,
nullptr );
186 sprite->runAction( RepeatForever::create(seq) );
被这些函数引用 onTouchesEnded() , 以及 Sprite1().
◆ CREATE_FUNC()
◆ onTouchesEnded()
| void Sprite1::onTouchesEnded |
( |
const std::vector< cocos2d::Touch * > & |
touches, |
|
|
cocos2d::Event * |
event |
|
) |
| |
◆ subtitle()
| std::string Sprite1::subtitle |
( |
| ) |
const |
|
overridevirtual |
◆ title()
| std::string Sprite1::title |
( |
| ) |
const |
|
overridevirtual |
该类的文档由以下文件生成:
- /Users/yujizhu/Documents/Git/cocos2d-x-4.0/tests/cpp-tests/Classes/SpriteTest/SpriteTest.h
- /Users/yujizhu/Documents/Git/cocos2d-x-4.0/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp