From 6449ced0ab6cf32b867c77100972868052f60eb9 Mon Sep 17 00:00:00 2001 From: andyque Date: Wed, 26 Mar 2014 14:41:53 +0800 Subject: [PATCH 01/12] closed #4560, fixed UISlider hitTest Point --- cocos/ui/UISlider.cpp | 10 ++++++++++ cocos/ui/UISlider.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/cocos/ui/UISlider.cpp b/cocos/ui/UISlider.cpp index 37d6845325..7d03f3d0f4 100644 --- a/cocos/ui/UISlider.cpp +++ b/cocos/ui/UISlider.cpp @@ -377,6 +377,16 @@ void Slider::setPercent(int percent) spriteRenderer->setTextureRect(rect, spriteRenderer->isTextureRectRotated(), rect.size); } } + +bool Slider::hitTest(const cocos2d::Point &pt) +{ + Point nsp = this->_slidBallNormalRenderer->convertToNodeSpace(pt); + Rect ballRect = this->_slidBallNormalRenderer->getTextureRect(); + if (ballRect.containsPoint(nsp)) { + return true; + } + return false; +} bool Slider::onTouchBegan(Touch *touch, Event *unusedEvent) { diff --git a/cocos/ui/UISlider.h b/cocos/ui/UISlider.h index c3ab3cffcc..de702eacef 100644 --- a/cocos/ui/UISlider.h +++ b/cocos/ui/UISlider.h @@ -189,6 +189,8 @@ public: //override "ignoreContentAdaptWithSize" method of widget. virtual void ignoreContentAdaptWithSize(bool ignore) override; + //override the widget's hitTest function to perfom its own + virtual bool hitTest(const Point &pt) override; /** * Returns the "class name" of widget. */ From 41110ec49ac2911ebf24c9b09dba9772d4e7327d Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Wed, 26 Mar 2014 10:41:17 +0000 Subject: [PATCH 02/12] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cocos2dx_files.json.REMOVED.git-id b/templates/cocos2dx_files.json.REMOVED.git-id index 089a8e7561..c937acbc30 100644 --- a/templates/cocos2dx_files.json.REMOVED.git-id +++ b/templates/cocos2dx_files.json.REMOVED.git-id @@ -1 +1 @@ -d53bc7d6e68a49984c5971344f59bba8414d142b \ No newline at end of file +8cce920bd091a03ab1e10db03eb397451b0d70c5 \ No newline at end of file From ebc09373e3a50d65caa7cef6f52dc047a6253c7a Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Wed, 26 Mar 2014 10:42:58 +0000 Subject: [PATCH 03/12] [AUTO]: updating luabinding automatically --- cocos/scripting/lua-bindings/auto/api/Helper.lua | 11 ++--------- .../auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id | 2 +- .../lua-bindings/auto/lua_cocos2dx_ui_auto.hpp | 1 - 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/cocos/scripting/lua-bindings/auto/api/Helper.lua b/cocos/scripting/lua-bindings/auto/api/Helper.lua index 777b62a0fe..7777897e6e 100644 --- a/cocos/scripting/lua-bindings/auto/api/Helper.lua +++ b/cocos/scripting/lua-bindings/auto/api/Helper.lua @@ -2,13 +2,6 @@ -------------------------------- -- @module Helper --------------------------------- --- @function [parent=#Helper] seekActionWidgetByActionTag --- @param self --- @param #ccui.Widget widget --- @param #int int --- @return Widget#Widget ret (return value: ccui.Widget) - -------------------------------- -- @function [parent=#Helper] seekWidgetByTag -- @param self @@ -17,10 +10,10 @@ -- @return Widget#Widget ret (return value: ccui.Widget) -------------------------------- --- @function [parent=#Helper] seekWidgetByRelativeName +-- @function [parent=#Helper] seekActionWidgetByActionTag -- @param self -- @param #ccui.Widget widget --- @param #char char +-- @param #int int -- @return Widget#Widget ret (return value: ccui.Widget) -------------------------------- diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id index 96b25dd5ca..6dff430fb1 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp.REMOVED.git-id @@ -1 +1 @@ -4fac42101ef2fb9622f22ccabc18c918622908ad \ No newline at end of file +d608beef525313b9c497786a1dd7b2460ff65d84 \ No newline at end of file diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp index 3a1b0bb858..75d07761f8 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp @@ -366,7 +366,6 @@ int register_all_cocos2dx_ui(lua_State* tolua_S); - #endif // __cocos2dx_ui_h__ From 44d446ef1d63738ebc95459f33e92c74f5a9d342 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Wed, 26 Mar 2014 18:48:01 +0800 Subject: [PATCH 04/12] Reverse CONSTRUCTOR_ACCESS --- cocos/2d/ccConfig.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/2d/ccConfig.h b/cocos/2d/ccConfig.h index e4455d21f1..a58092458f 100644 --- a/cocos/2d/ccConfig.h +++ b/cocos/2d/ccConfig.h @@ -273,7 +273,7 @@ To enable set it to a value different than 0. Disabled by default. protected by default. */ #ifndef CC_CONSTRUCTOR_ACCESS -#define CC_CONSTRUCTOR_ACCESS public +#define CC_CONSTRUCTOR_ACCESS protected #endif #endif // __CCCONFIG_H__ From d9b4b70ed7c757f14412538871085f584083a368 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 26 Mar 2014 19:24:10 +0800 Subject: [PATCH 05/12] Removed unused include file. --- external/chipmunk/src/cpCollision.c | 1 - 1 file changed, 1 deletion(-) diff --git a/external/chipmunk/src/cpCollision.c b/external/chipmunk/src/cpCollision.c index 439314efb6..e29e4bf82e 100644 --- a/external/chipmunk/src/cpCollision.c +++ b/external/chipmunk/src/cpCollision.c @@ -21,7 +21,6 @@ #include #include -#include #include "chipmunk_private.h" From 491dc202dff1c59efa1d111cbbdfe2db59b0f346 Mon Sep 17 00:00:00 2001 From: faryang-rmbp Date: Wed, 26 Mar 2014 19:42:07 +0800 Subject: [PATCH 06/12] remove deprecated code in lua tests & template --- templates/lua-template-default/src/main.lua | 6 ++++-- templates/lua-template-runtime/src/main.lua | 6 ++++-- tests/lua-empty-test/src/hello.lua | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/templates/lua-template-default/src/main.lua b/templates/lua-template-default/src/main.lua index ec894a7787..3be63ad14f 100644 --- a/templates/lua-template-default/src/main.lua +++ b/templates/lua-template-default/src/main.lua @@ -1,4 +1,6 @@ require "Cocos2d" +require "Cocos2dConstants" + -- cclog cclog = function(...) print(string.format(...)) @@ -43,7 +45,7 @@ local function main() local frameHeight = 95 -- create dog animate - local textureDog = cc.TextureCache:getInstance():addImage("dog.png") + local textureDog = cc.Director:getInstance():getTextureCache():addImage("dog.png") local rect = cc.rect(0, 0, frameWidth, frameHeight) local frame0 = cc.SpriteFrame:createWithTexture(textureDog, rect) rect = cc.rect(frameWidth, 0, frameWidth, frameHeight) @@ -206,7 +208,7 @@ local function main() -- uncomment below for the BlackBerry version local bgMusicPath = nil if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) then - bgMusicPath = CCFileUtils:getInstance():fullPathForFilename("res/background.caf") + bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.caf") else bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.mp3") end diff --git a/templates/lua-template-runtime/src/main.lua b/templates/lua-template-runtime/src/main.lua index ec894a7787..3be63ad14f 100644 --- a/templates/lua-template-runtime/src/main.lua +++ b/templates/lua-template-runtime/src/main.lua @@ -1,4 +1,6 @@ require "Cocos2d" +require "Cocos2dConstants" + -- cclog cclog = function(...) print(string.format(...)) @@ -43,7 +45,7 @@ local function main() local frameHeight = 95 -- create dog animate - local textureDog = cc.TextureCache:getInstance():addImage("dog.png") + local textureDog = cc.Director:getInstance():getTextureCache():addImage("dog.png") local rect = cc.rect(0, 0, frameWidth, frameHeight) local frame0 = cc.SpriteFrame:createWithTexture(textureDog, rect) rect = cc.rect(frameWidth, 0, frameWidth, frameHeight) @@ -206,7 +208,7 @@ local function main() -- uncomment below for the BlackBerry version local bgMusicPath = nil if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) then - bgMusicPath = CCFileUtils:getInstance():fullPathForFilename("res/background.caf") + bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.caf") else bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.mp3") end diff --git a/tests/lua-empty-test/src/hello.lua b/tests/lua-empty-test/src/hello.lua index 2916f16686..4041c89bb2 100644 --- a/tests/lua-empty-test/src/hello.lua +++ b/tests/lua-empty-test/src/hello.lua @@ -1,4 +1,6 @@ require "Cocos2d" +require "Cocos2dConstants" + -- cclog cclog = function(...) print(string.format(...)) @@ -39,7 +41,7 @@ local function main() local frameHeight = 95 -- create dog animate - local textureDog = cc.TextureCache:getInstance():addImage("res/dog.png") + local textureDog = cc.Director:getInstance():getTextureCache():addImage("res/dog.png") local rect = cc.rect(0, 0, frameWidth, frameHeight) local frame0 = cc.SpriteFrame:createWithTexture(textureDog, rect) rect = cc.rect(frameWidth, 0, frameWidth, frameHeight) @@ -195,7 +197,7 @@ local function main() -- uncomment below for the BlackBerry version local bgMusicPath = nil if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) then - bgMusicPath = CCFileUtils:getInstance():fullPathForFilename("res/background.caf") + bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.caf") else bgMusicPath = cc.FileUtils:getInstance():fullPathForFilename("res/background.mp3") end From 8ca714fa67b7a674c4022bd8d17094058a940299 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 26 Mar 2014 19:43:34 +0800 Subject: [PATCH 07/12] Windows will not include . --- external/chipmunk/src/cpCollision.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/external/chipmunk/src/cpCollision.c b/external/chipmunk/src/cpCollision.c index e29e4bf82e..3474dc6700 100644 --- a/external/chipmunk/src/cpCollision.c +++ b/external/chipmunk/src/cpCollision.c @@ -22,6 +22,10 @@ #include #include +#ifndef WIN32 +#include +#endif + #include "chipmunk_private.h" #if DEBUG && 0 From 8efb9ad4e0b52cfb86aceab7488ce4e7d05a4dda Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Wed, 26 Mar 2014 12:09:41 +0000 Subject: [PATCH 08/12] [AUTO]: updating luabinding automatically --- cocos/scripting/lua-bindings/auto/api/Slider.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cocos/scripting/lua-bindings/auto/api/Slider.lua b/cocos/scripting/lua-bindings/auto/api/Slider.lua index 2e6bbacca6..7ac618430b 100644 --- a/cocos/scripting/lua-bindings/auto/api/Slider.lua +++ b/cocos/scripting/lua-bindings/auto/api/Slider.lua @@ -111,6 +111,12 @@ -- @param self -- @return string#string ret (return value: string) +-------------------------------- +-- @function [parent=#Slider] hitTest +-- @param self +-- @param #point_table point +-- @return bool#bool ret (return value: bool) + -------------------------------- -- @function [parent=#Slider] getContentSize -- @param self From 5ba2cbb5a0647f30f51f8a2ed9d075c8e107d9cc Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 26 Mar 2014 20:15:13 +0800 Subject: [PATCH 09/12] Update AUTHORS [ci skip] --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index af63114d5a..bca68ac83b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -793,6 +793,9 @@ Developers: LoungeKatt Corrected a mistake of building android project in README.md + + flashjay + Remove deprecated code in lua tests & template Retired Core Developers: WenSheng Yang From 7f2255e48587c3ee55390b4015e53ed69defba0b Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 27 Mar 2014 10:01:46 +0800 Subject: [PATCH 10/12] Fixed #4566: Fix coding style problems --- cocos/2d/CCLayer.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cocos/2d/CCLayer.cpp b/cocos/2d/CCLayer.cpp index c6bb960173..49ac9275a7 100644 --- a/cocos/2d/CCLayer.cpp +++ b/cocos/2d/CCLayer.cpp @@ -627,12 +627,13 @@ std::string LayerColor::getDescription() const { return StringUtils::format("", _tag); } + // // LayerGradient // LayerGradient::LayerGradient() -: _startColor(Color4B(0, 0, 0, 255)) -, _endColor(Color4B(0, 0, 0, 255)) +: _startColor(Color4B::BLACK) +, _endColor(Color4B::BLACK) , _startOpacity(255) , _endOpacity(255) , _alongVector(Point(0, -1)) @@ -640,9 +641,11 @@ LayerGradient::LayerGradient() { } -LayerGradient::~LayerGradient() { - + +LayerGradient::~LayerGradient() +{ } + LayerGradient* LayerGradient::create(const Color4B& start, const Color4B& end) { LayerGradient * layer = new LayerGradient(); From 413e0010f5d7c04c0d10f7af108051d9e65aa6f6 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 27 Mar 2014 10:22:04 +0800 Subject: [PATCH 11/12] Fixed #4566: Fix LayerTest bug --- tests/cpp-tests/Classes/LayerTest/LayerTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp index 8087e7e9e1..b696010737 100644 --- a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp +++ b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp @@ -637,7 +637,7 @@ std::string LayerGradientTest::subtitle() const //------------------------------------------------------------------ LayerGradientTest2::LayerGradientTest2() { - auto layer = new LayerGradient; + auto layer = LayerGradient::create(); layer->initWithColor(Color4B(255,0,0,255), Color4B(255,255,0,255)); layer->autorelease(); addChild(layer); From 87f9eb3217c5409f1437fa79d592d0f00bdbfb52 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 27 Mar 2014 10:25:39 +0800 Subject: [PATCH 12/12] Fixed #4566: Remove autorelease for create construct in LayerTest --- tests/cpp-tests/Classes/LayerTest/LayerTest.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp index b696010737..262356b723 100644 --- a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp +++ b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp @@ -639,7 +639,6 @@ LayerGradientTest2::LayerGradientTest2() { auto layer = LayerGradient::create(); layer->initWithColor(Color4B(255,0,0,255), Color4B(255,255,0,255)); - layer->autorelease(); addChild(layer); }