Fixed some test cases of action not respond click event as expected.

This commit is contained in:
WenhaiLin 2015-04-09 14:20:59 +08:00
parent 9891a94e87
commit a378651320
2 changed files with 4 additions and 5 deletions

View File

@ -1399,9 +1399,9 @@ void ActionStacked::onEnter()
this->centerSprites(0);
/*auto listener = EventListenerTouchAllAtOnce::create();
auto listener = EventListenerTouchAllAtOnce::create();
listener->onTouchesEnded = CC_CALLBACK_2(ActionStacked::onTouchesEnded, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);*/
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
auto s = Director::getInstance()->getWinSize();
this->addNewSpriteWithCoords(Vec2(s.width/2, s.height/2));
@ -1427,14 +1427,13 @@ void ActionStacked::runActionsInSprite(Sprite *sprite)
// override me
}
/*
void ActionStacked::onTouchesEnded(const std::vector<Touch*>& touches, Event* event)
{
for ( auto &touch: touches ) {
auto location = touch->getLocation();
addNewSpriteWithCoords( location );
}
}*/
}
std::string ActionStacked::title() const
{

View File

@ -405,7 +405,7 @@ public:
virtual std::string subtitle() const override;
virtual void addNewSpriteWithCoords(cocos2d::Vec2 p);
virtual void runActionsInSprite(cocos2d::Sprite* sprite);
//void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event) override;
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
};
class ActionMoveStacked : public ActionStacked