Merge pull request #3709 from dumganhar/iss2087-new-event-dispatcher

Fixing SchedulerTest crash. We need to invoke parent's onExit in subclass::onExit.
This commit is contained in:
James Chen 2013-09-19 03:54:44 -07:00
commit 07f5ad445c
2 changed files with 7 additions and 17 deletions

View File

@ -58,15 +58,9 @@ bool MutiTouchTestLayer::init()
{ {
setTouchEnabled(true); setTouchEnabled(true);
// Register Touch Event auto title = LabelTTF::create("Please touch the screen!", "", 24);
// auto listener = TouchEventListener::create(Touch::DispatchMode::ALL_AT_ONCE); title->setPosition(VisibleRect::top()+Point(0, -40));
// addChild(title);
// listener->onTouchesBegan = CC_CALLBACK_2(MutiTouchTestLayer::onTouchesBegan, this);
// listener->onTouchesMoved = CC_CALLBACK_2(MutiTouchTestLayer::onTouchesMoved, this);
// listener->onTouchesEnded = CC_CALLBACK_2(MutiTouchTestLayer::onTouchesEnded, this);
// listener->onTouchesCancelled = CC_CALLBACK_2(MutiTouchTestLayer::onTouchesCancelled, this);
//
// EventDispatcher::getInstance()->registerEventListenerWithSceneGraphPriority(listener, this);
return true; return true;
} }
@ -75,14 +69,8 @@ bool MutiTouchTestLayer::init()
static Dictionary s_dic; static Dictionary s_dic;
//void MutiTouchTestLayer::registerWithTouchDispatcher(void)
//{
// Director::getInstance()->getTouchDispatcher()->addStandardDelegate(this, 0);
//}
void MutiTouchTestLayer::onTouchesBegan(const std::vector<Touch*>& touches, Event *event) void MutiTouchTestLayer::onTouchesBegan(const std::vector<Touch*>& touches, Event *event)
{ {
for ( auto &item: touches ) for ( auto &item: touches )
{ {
auto touch = item; auto touch = item;
@ -95,8 +83,6 @@ void MutiTouchTestLayer::onTouchesBegan(const std::vector<Touch*>& touches, Even
addChild(touchPoint); addChild(touchPoint);
s_dic.setObject(touchPoint, touch->getID()); s_dic.setObject(touchPoint, touch->getID());
} }
} }
void MutiTouchTestLayer::onTouchesMoved(const std::vector<Touch*>& touches, Event *event) void MutiTouchTestLayer::onTouchesMoved(const std::vector<Touch*>& touches, Event *event)

View File

@ -257,6 +257,7 @@ void SchedulerPauseResumeAll::onExit()
{ {
Director::getInstance()->getScheduler()->resumeTargets(_pausedTargets); Director::getInstance()->getScheduler()->resumeTargets(_pausedTargets);
} }
SchedulerTestLayer::onExit();
} }
void SchedulerPauseResumeAll::tick1(float dt) void SchedulerPauseResumeAll::tick1(float dt)
@ -343,6 +344,7 @@ void SchedulerPauseResumeAllUser::onExit()
{ {
Director::getInstance()->getScheduler()->resumeTargets(_pausedTargets); Director::getInstance()->getScheduler()->resumeTargets(_pausedTargets);
} }
SchedulerTestLayer::onExit();
} }
void SchedulerPauseResumeAllUser::tick1(float dt) void SchedulerPauseResumeAllUser::tick1(float dt)
@ -465,6 +467,8 @@ void SchedulerUnscheduleAllHard::onExit()
auto director = Director::getInstance(); auto director = Director::getInstance();
director->getScheduler()->scheduleUpdateForTarget(director->getActionManager(), Scheduler::PRIORITY_SYSTEM, false); director->getScheduler()->scheduleUpdateForTarget(director->getActionManager(), Scheduler::PRIORITY_SYSTEM, false);
} }
SchedulerTestLayer::onExit();
} }
void SchedulerUnscheduleAllHard::tick1(float dt) void SchedulerUnscheduleAllHard::tick1(float dt)