From 82867b00737ca85cfb53d1799e2a82a66b712701 Mon Sep 17 00:00:00 2001 From: XiaoFeng Date: Tue, 22 Dec 2015 18:41:44 +0800 Subject: [PATCH 1/2] Roll back disable force GC change on windows platform, this cause lua binding can not respond mouse click Remove 3d touch demo iOS sdk checking, it SDK defines won't work in cpp compile --- cocos/2d/CCMenuItem.cpp | 8 ++++++++ tests/cpp-tests/Classes/TouchesTest/TouchesTest.cpp | 8 +------- tests/cpp-tests/Classes/TouchesTest/TouchesTest.h | 2 -- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cocos/2d/CCMenuItem.cpp b/cocos/2d/CCMenuItem.cpp index ef446b0e02..e9f6f0de2e 100644 --- a/cocos/2d/CCMenuItem.cpp +++ b/cocos/2d/CCMenuItem.cpp @@ -104,6 +104,14 @@ void MenuItem::activate() { _callback(this); } +#if CC_ENABLE_SCRIPT_BINDING + if (kScriptTypeNone != _scriptType) + { + BasicScriptData data(this); + ScriptEvent scriptEvent(kMenuClickedEvent, &data); + ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent); + } +#endif } } diff --git a/tests/cpp-tests/Classes/TouchesTest/TouchesTest.cpp b/tests/cpp-tests/Classes/TouchesTest/TouchesTest.cpp index 17954b46c6..55133f5ed0 100644 --- a/tests/cpp-tests/Classes/TouchesTest/TouchesTest.cpp +++ b/tests/cpp-tests/Classes/TouchesTest/TouchesTest.cpp @@ -22,9 +22,7 @@ enum TouchesTests::TouchesTests() { ADD_TEST_CASE(PongScene); -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 // Use 9.0 or higher SDK to compile ADD_TEST_CASE(ForceTouchTest); -#endif } //------------------------------------------------------------------ // @@ -115,8 +113,6 @@ void PongLayer::doStep(float delta) resetAndScoreBallForPlayer( kHighPlayer ); } -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 // Use 9.0 or higher SDK to compile - const char * _Info_Formatter = "Current force value : %0.02f, maximum possible force : %0.02f"; char formatBuffer[256] = {0, }; @@ -146,7 +142,7 @@ std::string ForceTouchTest::title() const std::string ForceTouchTest::subtitle() const { - return std::string("Touch with force to see info label changes"); + return std::string("Touch with force to see info label changes\nOnly work on iPhone6s / iPhone6s Plus"); } void ForceTouchTest::onTouchesBegan(const std::vector& touches, cocos2d::Event* event) @@ -169,5 +165,3 @@ void ForceTouchTest::onTouchesEnded(const std::vector& touches, sprintf(formatBuffer, _Info_Formatter, 0.0f, 0.0f); _infoLabel->setString(std::string(formatBuffer)); } - -#endif diff --git a/tests/cpp-tests/Classes/TouchesTest/TouchesTest.h b/tests/cpp-tests/Classes/TouchesTest/TouchesTest.h index eba38e7ed9..ba5175daa1 100644 --- a/tests/cpp-tests/Classes/TouchesTest/TouchesTest.h +++ b/tests/cpp-tests/Classes/TouchesTest/TouchesTest.h @@ -31,7 +31,6 @@ public: void doStep(float delta); }; -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 // Use 9.0 or higher SDK to compile class ForceTouchTest : public TestCase { public: @@ -50,6 +49,5 @@ protected: cocos2d::Label * _infoLabel; }; -#endif #endif From 3fd8f36a90f865110d5a6d76a367bf0c8ce95c00 Mon Sep 17 00:00:00 2001 From: XiaoFeng Date: Wed, 23 Dec 2015 12:30:59 +0800 Subject: [PATCH 2/2] Limit force GC in menu item only work in lua-binding --- cocos/2d/CCMenuItem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/2d/CCMenuItem.cpp b/cocos/2d/CCMenuItem.cpp index e9f6f0de2e..08ca2a0936 100644 --- a/cocos/2d/CCMenuItem.cpp +++ b/cocos/2d/CCMenuItem.cpp @@ -105,7 +105,7 @@ void MenuItem::activate() _callback(this); } #if CC_ENABLE_SCRIPT_BINDING - if (kScriptTypeNone != _scriptType) + if (kScriptTypeLua == _scriptType) { BasicScriptData data(this); ScriptEvent scriptEvent(kMenuClickedEvent, &data);