From d32fb93e07b83f4ab37c814f2c0c474d5be1bbd1 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 19 Sep 2013 18:53:45 +0800 Subject: [PATCH 1/2] Fixing SchedulerTest crash. We need to invoke parent's onExit in subclass::onExit. --- samples/Cpp/TestCpp/Classes/SchedulerTest/SchedulerTest.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/Cpp/TestCpp/Classes/SchedulerTest/SchedulerTest.cpp b/samples/Cpp/TestCpp/Classes/SchedulerTest/SchedulerTest.cpp index 82982654a4..96ee66292b 100644 --- a/samples/Cpp/TestCpp/Classes/SchedulerTest/SchedulerTest.cpp +++ b/samples/Cpp/TestCpp/Classes/SchedulerTest/SchedulerTest.cpp @@ -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) From 153794ba6cc8cc03f84a3132de334390ed428d17 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 19 Sep 2013 18:54:26 +0800 Subject: [PATCH 2/2] Updating MutiTouchTest.cpp. Adding title. Removing unused codes. --- .../Classes/MutiTouchTest/MutiTouchTest.cpp | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/samples/Cpp/TestCpp/Classes/MutiTouchTest/MutiTouchTest.cpp b/samples/Cpp/TestCpp/Classes/MutiTouchTest/MutiTouchTest.cpp index 15493fcc5a..76caec059c 100644 --- a/samples/Cpp/TestCpp/Classes/MutiTouchTest/MutiTouchTest.cpp +++ b/samples/Cpp/TestCpp/Classes/MutiTouchTest/MutiTouchTest.cpp @@ -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& touches, Event *event) { - for ( auto &item: touches ) { auto touch = item; @@ -95,8 +83,6 @@ void MutiTouchTestLayer::onTouchesBegan(const std::vector& touches, Even addChild(touchPoint); s_dic.setObject(touchPoint, touch->getID()); } - - } void MutiTouchTestLayer::onTouchesMoved(const std::vector& touches, Event *event)