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

View File

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