From a2fc7a85d621c496cf1e2a8c7e6eef343db440ab Mon Sep 17 00:00:00 2001 From: pandamicro Date: Wed, 27 May 2015 14:40:08 +0800 Subject: [PATCH 01/30] upgrade submodules --- tools/bindings-generator | 2 +- web | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/bindings-generator b/tools/bindings-generator index ca96fc9301..7b8245f586 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit ca96fc9301c1fd7eceff05f033eb96cb09d74a47 +Subproject commit 7b8245f5865722f86e3860ce23979e98c94d0039 diff --git a/web b/web index 39e53a863b..3c92e4a692 160000 --- a/web +++ b/web @@ -1 +1 @@ -Subproject commit 39e53a863b3f663562c4f044f1bd50d782e4cc89 +Subproject commit 3c92e4a6920316ed7cc9f38e5c978aa2eccaa939 From fdec552ed7669509311159815f0ddaaee57dbfbe Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 2 Jun 2015 10:08:13 +0800 Subject: [PATCH 02/30] Fix cocos2d/cocos2d-js#1658: Fix js_load_remote_image issue with multithread and improve Downloader --- .../jsb_cocos2dx_extension_manual.cpp | 156 +++++++++++------- .../extension/jsb_cocos2dx_extension_manual.h | 13 +- extensions/assets-manager/Downloader.cpp | 36 ++-- extensions/assets-manager/Downloader.h | 4 +- .../src/TextureCacheTest/TextureCacheTest.js | 21 +-- 5 files changed, 136 insertions(+), 94 deletions(-) diff --git a/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp b/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp index 00edfc795d..bb3cd6c8e4 100644 --- a/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp +++ b/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp @@ -908,7 +908,7 @@ bool js_cocos2dx_ext_release(JSContext *cx, uint32_t argc, jsval *vp) } -__JSDownloaderDelegator::__JSDownloaderDelegator(JSContext *cx, JS::HandleObject obj, const std::string &url, JS::HandleValue callback) +__JSDownloaderDelegator::__JSDownloaderDelegator(JSContext *cx, JS::HandleObject obj, const std::string &url, JS::HandleObject callback) : _cx(cx) , _url(url) , _buffer(nullptr) @@ -917,7 +917,27 @@ __JSDownloaderDelegator::__JSDownloaderDelegator(JSContext *cx, JS::HandleObject _obj.ref().set(obj); _jsCallback.construct(_cx); _jsCallback.ref().set(callback); - +} + +__JSDownloaderDelegator::~__JSDownloaderDelegator() +{ + _obj.destroyIfConstructed(); + _jsCallback.destroyIfConstructed(); + if (_buffer != nullptr) + free(_buffer); + _downloader->setErrorCallback(nullptr); + _downloader->setSuccessCallback(nullptr); +} + +__JSDownloaderDelegator *__JSDownloaderDelegator::create(JSContext *cx, JS::HandleObject obj, const std::string &url, JS::HandleObject callback) +{ + __JSDownloaderDelegator *delegate = new (std::nothrow) __JSDownloaderDelegator(cx, obj, url, callback); + delegate->autorelease(); + return delegate; +} + +void __JSDownloaderDelegator::startDownload() +{ if (Director::getInstance()->getTextureCache()->getTextureForKey(_url)) { onSuccess(nullptr, nullptr, nullptr); @@ -929,8 +949,9 @@ __JSDownloaderDelegator::__JSDownloaderDelegator(JSContext *cx, JS::HandleObject _downloader->setErrorCallback( std::bind(&__JSDownloaderDelegator::onError, this, std::placeholders::_1) ); _downloader->setSuccessCallback( std::bind(&__JSDownloaderDelegator::onSuccess, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3) ); - long contentSize = _downloader->getContentSize(_url); - if (contentSize == -1) { + cocos2d::extension::Downloader::HeaderInfo info = _downloader->getHeader(_url); + long contentSize = info.contentSize; + if (contentSize == -1 || info.responseCode >= 400) { cocos2d::extension::Downloader::Error err; onError(err); } @@ -942,79 +963,85 @@ __JSDownloaderDelegator::__JSDownloaderDelegator(JSContext *cx, JS::HandleObject } } -__JSDownloaderDelegator::~__JSDownloaderDelegator() +void __JSDownloaderDelegator::download() { - if (_buffer != nullptr) - free(_buffer); - _downloader->setErrorCallback(nullptr); - _downloader->setSuccessCallback(nullptr); + retain(); + startDownload(); +} + +void __JSDownloaderDelegator::downloadAsync() +{ + retain(); + auto t = std::thread(&__JSDownloaderDelegator::startDownload, this); + t.detach(); } void __JSDownloaderDelegator::onError(const cocos2d::extension::Downloader::Error &error) { - if (!_jsCallback.ref().isNull()) { - JSContext *cx = ScriptingCore::getInstance()->getGlobalContext(); - JS::RootedObject global(cx, ScriptingCore::getInstance()->getGlobalObject()); - - JSAutoCompartment ac(_cx, _obj.ref()); - - jsval succeed = BOOLEAN_TO_JSVAL(false); - JS::RootedValue retval(cx); - JS_CallFunctionValue(cx, global, _jsCallback.ref(), JS::HandleValueArray::fromMarkedLocation(1, &succeed), &retval); - } - this->release(); + Director::getInstance()->getScheduler()->performFunctionInCocosThread([this] + { + JS::RootedValue callback(_cx, OBJECT_TO_JSVAL(_jsCallback.ref())); + if (!callback.isNull()) { + JS::RootedObject global(_cx, ScriptingCore::getInstance()->getGlobalObject()); + JSAutoCompartment ac(_cx, global); + + jsval succeed = BOOLEAN_TO_JSVAL(false); + JS::RootedValue retval(_cx); + JS_CallFunctionValue(_cx, global, callback, JS::HandleValueArray::fromMarkedLocation(1, &succeed), &retval); + } + release(); + }); } void __JSDownloaderDelegator::onSuccess(const std::string &srcUrl, const std::string &storagePath, const std::string &customId) { Image *image = new Image(); - jsval valArr[2]; - JSContext *cx = ScriptingCore::getInstance()->getGlobalContext(); - JS::RootedObject global(cx, ScriptingCore::getInstance()->getGlobalObject()); cocos2d::TextureCache *cache = Director::getInstance()->getTextureCache(); - JSAutoCompartment ac(_cx, _obj.ref() ? _obj.ref() : global); - Texture2D *tex = cache->getTextureForKey(_url); - if (tex) + if (!tex) { - valArr[0] = BOOLEAN_TO_JSVAL(true); - js_proxy_t* p = jsb_get_native_proxy(tex); - valArr[1] = OBJECT_TO_JSVAL(p->obj); + if (image->initWithImageData(_buffer, _size)) + { + tex = Director::getInstance()->getTextureCache()->addImage(image, _url); + } } - else if (image->initWithImageData(_buffer, _size)) - { - tex = Director::getInstance()->getTextureCache()->addImage(image, _url); - valArr[0] = BOOLEAN_TO_JSVAL(true); - - JS::RootedObject texProto(cx, jsb_cocos2d_Texture2D_prototype); - JSObject *obj = JS_NewObject(cx, jsb_cocos2d_Texture2D_class, texProto, global); - // link the native object with the javascript object - js_proxy_t* p = jsb_new_proxy(tex, obj); - JS::AddNamedObjectRoot(cx, &p->obj, "cocos2d::Texture2D"); - valArr[1] = OBJECT_TO_JSVAL(p->obj); - } - else - { - valArr[0] = BOOLEAN_TO_JSVAL(false); - valArr[1] = JSVAL_NULL; - } - image->release(); - if (!_jsCallback.ref().isNull()) { - JS::RootedValue retval(cx); - JS_CallFunctionValue(cx, global, _jsCallback.ref(), JS::HandleValueArray::fromMarkedLocation(2, valArr), &retval); - } - this->release(); -} - -void __JSDownloaderDelegator::download(JSContext *cx, JS::HandleObject obj, const std::string &url, JS::HandleValue callback) -{ - auto t = std::thread([cx, obj, url, callback]() { - new __JSDownloaderDelegator(cx, obj, url, callback); + Director::getInstance()->getScheduler()->performFunctionInCocosThread([this, tex] + { + JS::RootedObject global(_cx, ScriptingCore::getInstance()->getGlobalObject()); + JSAutoCompartment ac(_cx, global); + + jsval valArr[2]; + if (tex) + { + valArr[0] = BOOLEAN_TO_JSVAL(true); + js_proxy_t* p = jsb_get_native_proxy(tex); + if (!p) + { + JS::RootedObject texProto(_cx, jsb_cocos2d_Texture2D_prototype); + JSObject *obj = JS_NewObject(_cx, jsb_cocos2d_Texture2D_class, texProto, global); + // link the native object with the javascript object + p = jsb_new_proxy(tex, obj); + JS::AddNamedObjectRoot(_cx, &p->obj, "cocos2d::Texture2D"); + } + valArr[1] = OBJECT_TO_JSVAL(p->obj); + } + else + { + valArr[0] = BOOLEAN_TO_JSVAL(false); + valArr[1] = JSVAL_NULL; + } + + JS::RootedValue callback(_cx, OBJECT_TO_JSVAL(_jsCallback.ref())); + if (!callback.isNull()) + { + JS::RootedValue retval(_cx); + JS_CallFunctionValue(_cx, global, callback, JS::HandleValueArray::fromMarkedLocation(2, valArr), &retval); + } + release(); }); - t.detach(); } // jsb.loadRemoteImg(url, function(succeed, result) {}) @@ -1022,14 +1049,15 @@ bool js_load_remote_image(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp)); - if (argc == 2) { + if (argc == 2) + { std::string url; bool ok = jsval_to_std_string(cx, args.get(0), &url); - JS::RootedValue callback(cx, args.get(1)); + JSB_PRECONDITION2(ok, cx, false, "js_load_remote_image : Error processing arguments"); + JS::RootedObject callback(cx, args.get(1).toObjectOrNull()); - __JSDownloaderDelegator::download(cx, obj, url, callback); - - JSB_PRECONDITION2(ok, cx, false, "js_console_log : Error processing arguments"); + __JSDownloaderDelegator *delegate = __JSDownloaderDelegator::create(cx, obj, url, callback); + delegate->downloadAsync(); args.rval().setUndefined(); return true; diff --git a/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.h b/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.h index 29cd76e94b..ebc68c5645 100644 --- a/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.h +++ b/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.h @@ -32,12 +32,17 @@ class __JSDownloaderDelegator : cocos2d::Ref { public: - static void download(JSContext *cx, JS::HandleObject obj, const std::string &url, JS::HandleValue callback); + void downloadAsync(); + void download(); + static __JSDownloaderDelegator *create(JSContext *cx, JS::HandleObject obj, const std::string &url, JS::HandleObject callback); + protected: - __JSDownloaderDelegator(JSContext *cx, JS::HandleObject obj, const std::string &url, JS::HandleValue callback); + __JSDownloaderDelegator(JSContext *cx, JS::HandleObject obj, const std::string &url, JS::HandleObject callback); ~__JSDownloaderDelegator(); + void startDownload(); + private: void onSuccess(const std::string &srcUrl, const std::string &storagePath, const std::string &customId); void onError(const cocos2d::extension::Downloader::Error &error); @@ -46,8 +51,8 @@ private: std::shared_ptr _downloader; std::string _url; JSContext *_cx; - mozilla::Maybe _jsCallback; - mozilla::Maybe _obj; + mozilla::Maybe _jsCallback; + mozilla::Maybe _obj; }; void register_all_cocos2dx_extension_manual(JSContext* cx, JS::HandleObject global); diff --git a/extensions/assets-manager/Downloader.cpp b/extensions/assets-manager/Downloader.cpp index 1175e6baa3..092e18c486 100644 --- a/extensions/assets-manager/Downloader.cpp +++ b/extensions/assets-manager/Downloader.cpp @@ -332,6 +332,11 @@ long Downloader::getContentSize(const std::string &srcUrl) return info.contentSize; } +Downloader::HeaderInfo Downloader::getHeader(const std::string &srcUrl) +{ + return prepareHeader(srcUrl); +} + void Downloader::getHeaderAsync(const std::string &srcUrl, const HeaderCallback &callback) { setHeaderCallback(callback); @@ -412,25 +417,26 @@ void Downloader::downloadToBuffer(const std::string &srcUrl, const std::string & CURLcode res = curl_easy_perform(curl); if (res != CURLE_OK) { - _fileUtils->removeFile(data.path + data.name + TEMP_EXT); - std::string msg = StringUtils::format("Unable to download file: [curl error]%s", curl_easy_strerror(res)); + std::string msg = StringUtils::format("Unable to download file to buffer: [curl error]%s", curl_easy_strerror(res)); this->notifyError(msg, customId, res); } + else + { + Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]{ + if (!ptr.expired()) + { + std::shared_ptr downloader = ptr.lock(); + + auto successCB = downloader->getSuccessCallback(); + if (successCB != nullptr) + { + successCB(data.url, "", data.customId); + } + } + }); + } curl_easy_cleanup(curl); - - Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]{ - if (!ptr.expired()) - { - std::shared_ptr downloader = ptr.lock(); - - auto successCB = downloader->getSuccessCallback(); - if (successCB != nullptr) - { - successCB(data.url, "", data.customId); - } - } - }); } void Downloader::downloadAsync(const std::string &srcUrl, const std::string &storagePath, const std::string &customId/* = ""*/) diff --git a/extensions/assets-manager/Downloader.h b/extensions/assets-manager/Downloader.h index 46893ec6ce..88e91c7faa 100644 --- a/extensions/assets-manager/Downloader.h +++ b/extensions/assets-manager/Downloader.h @@ -107,7 +107,7 @@ public: std::string url; std::string contentType; double contentSize; - double responseCode; + long responseCode; }; typedef std::unordered_map DownloadUnits; @@ -139,6 +139,8 @@ public: long getContentSize(const std::string &srcUrl); + HeaderInfo getHeader(const std::string &srcUrl); + void getHeaderAsync(const std::string &srcUrl, const HeaderCallback &callback); void downloadToBufferAsync(const std::string &srcUrl, unsigned char *buffer, const long &size, const std::string &customId = ""); diff --git a/tests/js-tests/src/TextureCacheTest/TextureCacheTest.js b/tests/js-tests/src/TextureCacheTest/TextureCacheTest.js index 0b6b819726..f28860582c 100644 --- a/tests/js-tests/src/TextureCacheTest/TextureCacheTest.js +++ b/tests/js-tests/src/TextureCacheTest/TextureCacheTest.js @@ -192,7 +192,6 @@ var RemoteTextureTest = TextureCacheTestBase.extend({ _title:"Remote Texture Test", _subtitle:"", _remoteTex: "http://cn.cocos2d-x.org/image/logo.png", - _sprite : null, onEnter:function () { this._super(); if('opengl' in cc.sys.capabilities && !cc.sys.isNative){ @@ -205,19 +204,21 @@ var RemoteTextureTest = TextureCacheTestBase.extend({ }, startDownload: function() { - cc.textureCache.addImageAsync(this._remoteTex, this.texLoaded, this); + var imageUrlArray = ["http://www.cocos2d-x.org/s/upload/v35.jpg", "http://www.cocos2d-x.org/s/upload/testin.jpg", "http://www.cocos2d-x.org/s/upload/geometry_dash.jpg", "http://cn.cocos2d-x.org/image/logo.png"]; + + for (var i = 0; i < imageUrlArray.length; i++) { + cc.textureCache.addImageAsync(imageUrlArray[i], this.texLoaded, this); + } }, texLoaded: function(texture) { if (texture instanceof cc.Texture2D) { - cc.log("Remote texture loaded: " + this._remoteTex); - if (this._sprite) { - this.removeChild(this._sprite); - } - this._sprite = new cc.Sprite(texture); - this._sprite.x = cc.winSize.width/2; - this._sprite.y = cc.winSize.height/2; - this.addChild(this._sprite); + cc.log("Remote texture loaded"); + + var sprite = new cc.Sprite(texture); + sprite.x = cc.winSize.width/2; + sprite.y = cc.winSize.height/2; + this.addChild(sprite); } else { cc.log("Fail to load remote texture"); From 97d0265e326f864b61bbe848b09d0dd22497a22b Mon Sep 17 00:00:00 2001 From: jianglong0156 Date: Tue, 2 Jun 2015 10:23:30 +0800 Subject: [PATCH 03/30] gzip test --- cocos/network/HttpClient.cpp | 2 ++ tests/js-tests/src/XHRTest/XHRTest.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cocos/network/HttpClient.cpp b/cocos/network/HttpClient.cpp index 53f13907ae..7f4773671c 100644 --- a/cocos/network/HttpClient.cpp +++ b/cocos/network/HttpClient.cpp @@ -202,6 +202,8 @@ static bool configureCURL(HttpClient* client, CURL* handle, char* errorBuffer) // Document is here: http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTNOSIGNAL curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1L); + curl_easy_setopt(handle, CURLOPT_ACCEPT_ENCODING, ""); + return true; } diff --git a/tests/js-tests/src/XHRTest/XHRTest.js b/tests/js-tests/src/XHRTest/XHRTest.js index 002da553db..21c1bf5427 100644 --- a/tests/js-tests/src/XHRTest/XHRTest.js +++ b/tests/js-tests/src/XHRTest/XHRTest.js @@ -127,8 +127,9 @@ var XHRTestLayer = cc.Layer.extend({ var xhr = cc.loader.getXMLHttpRequest(); streamXHREventsToLabel(xhr, statusPostLabel, responseLabel, "POST"); + xhr.setRequestHeader("Accept-Encoding","gzip,deflate"); + xhr.open("POST", "http://httpbin.org/post", true); - xhr.open("POST", "http://httpbin.org/post"); //set Content-type "text/plain;charset=UTF-8" to post plain text xhr.setRequestHeader("Content-Type","text/plain;charset=UTF-8"); xhr.send("plain text message"); From 7e6eed58328434ee4e8472883740793faba774ca Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 2 Jun 2015 10:42:50 +0800 Subject: [PATCH 04/30] Reverse change in submodules --- tools/bindings-generator | 2 +- web | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/bindings-generator b/tools/bindings-generator index 7b8245f586..3407739ca2 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 7b8245f5865722f86e3860ce23979e98c94d0039 +Subproject commit 3407739ca2e73f380304e4d7b76ba0fc0127f6f7 diff --git a/web b/web index 3c92e4a692..9e68d34194 160000 --- a/web +++ b/web @@ -1 +1 @@ -Subproject commit 3c92e4a6920316ed7cc9f38e5c978aa2eccaa939 +Subproject commit 9e68d341941b40c8027e974d8888d37ed15a1a7b From a51a32fa9d3bf036c3c1727e9a5ca74b6ad70c9e Mon Sep 17 00:00:00 2001 From: zhangcheng Date: Wed, 3 Jun 2015 15:10:48 +0800 Subject: [PATCH 05/30] 1, add onEnter and onExit of components to CCNode's onEnter and onExit function. --- cocos/2d/CCNode.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 423a60286e..ce220e5636 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -1414,6 +1414,11 @@ void Node::onEnter() if (_onEnterCallback) _onEnterCallback(); + if (_componentContainer && !_componentContainer->isEmpty()) + { + _componentContainer->onEnter(); + } + #if CC_ENABLE_SCRIPT_BINDING if (_scriptType == kScriptTypeJavascript) { @@ -1493,6 +1498,11 @@ void Node::onExit() if (_onExitCallback) _onExitCallback(); + if (_componentContainer && !_componentContainer->isEmpty()) + { + _componentContainer->onExit(); + } + #if CC_ENABLE_SCRIPT_BINDING if (_scriptType == kScriptTypeJavascript) { From 164e4c8314ee18856cd2553eb3cb7c0c3a84bd47 Mon Sep 17 00:00:00 2001 From: gyf19 Date: Wed, 3 Jun 2015 19:41:14 +0800 Subject: [PATCH 06/30] HttpClient Android supports gzip --- .../lib/Cocos2dxHttpURLConnection.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHttpURLConnection.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHttpURLConnection.java index c0d9c5f7c4..00ddc97845 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHttpURLConnection.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHttpURLConnection.java @@ -28,6 +28,8 @@ import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; +import java.util.zip.GZIPInputStream; +import java.util.zip.InflaterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; import java.net.HttpURLConnection; @@ -260,11 +262,20 @@ public class Cocos2dxHttpURLConnection } static byte[] getResponseContent(HttpURLConnection http) { - DataInputStream in; - try { - in = new DataInputStream(http.getInputStream()); + InputStream in; + try { + in = http.getInputStream(); + String contentEncoding = http.getContentEncoding(); + if (contentEncoding != null) { + if(contentEncoding.equalsIgnoreCase("gzip")){ + in = new GZIPInputStream(http.getInputStream()); //reads 2 bytes to determine GZIP stream! + } + else if(contentEncoding.equalsIgnoreCase("deflate")){ + in = new InflaterInputStream(http.getInputStream()); + } + } } catch (IOException e) { - in = new DataInputStream(http.getErrorStream()); + in = http.getErrorStream(); } catch (Exception e) { Log.e("Cocos2dxHttpURLConnection exception", e.toString()); return null; From fbd5a09cfd51f203840bf45f558de5153d01e940 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 4 Jun 2015 11:58:22 +0800 Subject: [PATCH 07/30] issue #10323: Fix the compile error when COCOS2D_DEBUG>=2. --- cocos/base/CCData.cpp | 1 + cocos/base/CCEventListener.cpp | 1 + cocos/base/CCEventListenerAcceleration.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/cocos/base/CCData.cpp b/cocos/base/CCData.cpp index db4f639e95..7c5a1e1bdf 100644 --- a/cocos/base/CCData.cpp +++ b/cocos/base/CCData.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "base/CCData.h" +#include "base/CCConsole.h" NS_CC_BEGIN diff --git a/cocos/base/CCEventListener.cpp b/cocos/base/CCEventListener.cpp index 0c7c32f598..562a129241 100644 --- a/cocos/base/CCEventListener.cpp +++ b/cocos/base/CCEventListener.cpp @@ -23,6 +23,7 @@ ****************************************************************************/ #include "base/CCEventListener.h" +#include "base/CCConsole.h" NS_CC_BEGIN diff --git a/cocos/base/CCEventListenerAcceleration.cpp b/cocos/base/CCEventListenerAcceleration.cpp index 2f15f46985..099919be97 100644 --- a/cocos/base/CCEventListenerAcceleration.cpp +++ b/cocos/base/CCEventListenerAcceleration.cpp @@ -24,6 +24,7 @@ #include "base/CCEventListenerAcceleration.h" #include "base/CCEventAcceleration.h" +#include "base/CCConsole.h" NS_CC_BEGIN From 73d815b0ab9844f30b6d97d1603c8a609c045f75 Mon Sep 17 00:00:00 2001 From: yangxiao Date: Thu, 4 Jun 2015 12:04:41 +0800 Subject: [PATCH 08/30] rename syncToNode and syncToPhysics --- cocos/physics3d/CCPhysics3DComponent.cpp | 8 +++--- cocos/physics3d/CCPhysics3DComponent.h | 8 +++--- cocos/physics3d/CCPhysicsSprite3D.cpp | 8 +++--- cocos/physics3d/CCPhysicsSprite3D.h | 8 +++--- .../Classes/Physics3DTest/Physics3DTest.cpp | 26 +++++++++---------- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/cocos/physics3d/CCPhysics3DComponent.cpp b/cocos/physics3d/CCPhysics3DComponent.cpp index c7bb88795f..bfdde807b0 100644 --- a/cocos/physics3d/CCPhysics3DComponent.cpp +++ b/cocos/physics3d/CCPhysics3DComponent.cpp @@ -147,7 +147,7 @@ void Physics3DComponent::preSimulate() { if (((int)_syncFlag & (int)Physics3DComponent::PhysicsSyncFlag::NODE_TO_PHYSICS) && _physics3DObj && _owner) { - syncToNode(); + syncNodeToPhysics(); } } @@ -155,7 +155,7 @@ void Physics3DComponent::postSimulate() { if (((int)_syncFlag & (int)Physics3DComponent::PhysicsSyncFlag::PHYSICS_TO_NODE) && _physics3DObj && _owner) { - syncToPhysics(); + syncPhysicsToNode(); } } @@ -174,7 +174,7 @@ void Physics3DComponent::setSyncFlag(PhysicsSyncFlag syncFlag) _syncFlag = syncFlag; } -void Physics3DComponent::syncToPhysics() +void Physics3DComponent::syncPhysicsToNode() { if (_physics3DObj->getObjType() == Physics3DObject::PhysicsObjType::RIGID_BODY) { @@ -207,7 +207,7 @@ void Physics3DComponent::syncToPhysics() } } -void Physics3DComponent::syncToNode() +void Physics3DComponent::syncNodeToPhysics() { if (_physics3DObj->getObjType() == Physics3DObject::PhysicsObjType::RIGID_BODY) { diff --git a/cocos/physics3d/CCPhysics3DComponent.h b/cocos/physics3d/CCPhysics3DComponent.h index 1c036c8225..19da86b0b2 100644 --- a/cocos/physics3d/CCPhysics3DComponent.h +++ b/cocos/physics3d/CCPhysics3DComponent.h @@ -110,14 +110,14 @@ public: void setSyncFlag(PhysicsSyncFlag syncFlag); /** - * align node and physics according to physics object + * synchronize node transformation to physics */ - void syncToPhysics(); + void syncNodeToPhysics(); /** - * align node and physics according to node + * synchronize physics transformation to node */ - void syncToNode(); + void syncPhysicsToNode(); CC_CONSTRUCTOR_ACCESS: Physics3DComponent(); diff --git a/cocos/physics3d/CCPhysicsSprite3D.cpp b/cocos/physics3d/CCPhysicsSprite3D.cpp index e9f2a94d0b..2fcc846fb9 100644 --- a/cocos/physics3d/CCPhysicsSprite3D.cpp +++ b/cocos/physics3d/CCPhysicsSprite3D.cpp @@ -57,16 +57,16 @@ void PhysicsSprite3D::setSyncFlag(Physics3DComponent::PhysicsSyncFlag syncFlag) _physicsComponent->setSyncFlag(syncFlag); } -void PhysicsSprite3D::syncToPhysics() +void PhysicsSprite3D::syncNodeToPhysics() { if (_physicsComponent) - _physicsComponent->syncToPhysics(); + _physicsComponent->syncNodeToPhysics(); } -void PhysicsSprite3D::syncToNode() +void PhysicsSprite3D::syncPhysicsToNode() { if (_physicsComponent) - _physicsComponent->syncToNode(); + _physicsComponent->syncPhysicsToNode(); } PhysicsSprite3D::PhysicsSprite3D() diff --git a/cocos/physics3d/CCPhysicsSprite3D.h b/cocos/physics3d/CCPhysicsSprite3D.h index e67ff584ea..0ccb713fd6 100644 --- a/cocos/physics3d/CCPhysicsSprite3D.h +++ b/cocos/physics3d/CCPhysicsSprite3D.h @@ -56,11 +56,11 @@ public: /** Set synchronization flag, see Physics3DComponent. */ void setSyncFlag(Physics3DComponent::PhysicsSyncFlag syncFlag); - /** Physics synchronize rendering. */ - void syncToPhysics(); + /** synchronize node transformation to physics. */ + void syncNodeToPhysics(); - /** Rendering synchronize physics. */ - void syncToNode(); + /** synchronize physics transformation to node. */ + void syncPhysicsToNode(); CC_CONSTRUCTOR_ACCESS: PhysicsSprite3D(); diff --git a/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp b/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp index cb2d1e9934..6118454ee7 100644 --- a/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp +++ b/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp @@ -210,7 +210,7 @@ void Physics3DTestDemo::shootBox( const cocos2d::Vec3 &des ) this->addChild(sprite); sprite->setPosition3D(_camera->getPosition3D()); sprite->setScale(0.5f); - sprite->syncToNode(); + sprite->syncNodeToPhysics(); //optimize, only sync node to physics sprite->setSyncFlag(Physics3DComponent::PhysicsSyncFlag::PHYSICS_TO_NODE); //sync node to physics @@ -239,7 +239,7 @@ bool BasicPhysics3DDemo::init() floor->setScaleZ(60); this->addChild(floor); floor->setCameraMask((unsigned short)CameraFlag::USER1); - floor->syncToNode(); + floor->syncNodeToPhysics(); //static object sync is not needed floor->setSyncFlag(Physics3DComponent::PhysicsSyncFlag::NONE); @@ -263,7 +263,7 @@ bool BasicPhysics3DDemo::init() auto sprite = PhysicsSprite3D::create("Sprite3DTest/box.c3t", &rbDes); sprite->setTexture("Images/CyanSquare.png"); sprite->setPosition3D(Vec3(x, y, z)); - sprite->syncToNode(); + sprite->syncNodeToPhysics(); sprite->setSyncFlag(Physics3DComponent::PhysicsSyncFlag::PHYSICS_TO_NODE); sprite->setCameraMask((unsigned short)CameraFlag::USER1); sprite->setScale(0.8f); @@ -303,7 +303,7 @@ bool Physics3DKinematicDemo::init() floor->setPosition3D(Vec3(0.f, -1.f, 0.f)); this->addChild(floor); floor->setCameraMask((unsigned short)CameraFlag::USER1); - floor->syncToNode(); + floor->syncNodeToPhysics(); //static object sync is not needed floor->setSyncFlag(Physics3DComponent::PhysicsSyncFlag::NONE); @@ -354,7 +354,7 @@ bool Physics3DKinematicDemo::init() sprite->setScale(1.0f / sprite->getContentSize().width); this->addChild(sprite); sprite->setPosition3D(Vec3(x, y, z)); - sprite->syncToNode(); + sprite->syncNodeToPhysics(); sprite->setSyncFlag(Physics3DComponent::PhysicsSyncFlag::PHYSICS_TO_NODE); } @@ -391,7 +391,7 @@ bool Physics3DConstraintDemo::init() sprite->setScale(0.4f); sprite->setPosition3D(Vec3(-20.f, 5.f, 0.f)); //sync node position to physics - component->syncToNode(); + component->syncNodeToPhysics(); //physics controlled, we will not set position for it, so we can skip sync node position to physics component->setSyncFlag(Physics3DComponent::PhysicsSyncFlag::PHYSICS_TO_NODE); @@ -414,7 +414,7 @@ bool Physics3DConstraintDemo::init() sprite->addComponent(component); sprite->setCameraMask((unsigned short)CameraFlag::USER1); this->addChild(sprite); - component->syncToNode(); + component->syncNodeToPhysics(); rigidBody->setAngularVelocity(Vec3(0,3,0)); constraint = Physics3DHingeConstraint::create(rigidBody, Vec3(4.f, 4.f, 0.5f), Vec3(0.f, 1.f, 0.f)); physicsScene->getPhysics3DWorld()->addPhysics3DConstraint(constraint); @@ -433,7 +433,7 @@ bool Physics3DConstraintDemo::init() sprite->addComponent(component); sprite->setCameraMask((unsigned short)CameraFlag::USER1); this->addChild(sprite); - component->syncToNode(); + component->syncNodeToPhysics(); rigidBody->setLinearVelocity(Vec3(0,3,0)); rbDes.mass = 0.0f; @@ -447,7 +447,7 @@ bool Physics3DConstraintDemo::init() sprite->addComponent(component); sprite->setCameraMask((unsigned short)CameraFlag::USER1); this->addChild(sprite); - component->syncToNode(); + component->syncNodeToPhysics(); Mat4 frameInA, frameInB; Mat4::createRotationZ(CC_DEGREES_TO_RADIANS(90), &frameInA); @@ -471,7 +471,7 @@ bool Physics3DConstraintDemo::init() sprite->addComponent(component); sprite->setCameraMask((unsigned short)CameraFlag::USER1); this->addChild(sprite); - component->syncToNode(); + component->syncNodeToPhysics(); Mat4::createRotationZ(CC_DEGREES_TO_RADIANS(90), &frameInA); frameInA.m[12] = 0.f; @@ -493,7 +493,7 @@ bool Physics3DConstraintDemo::init() sprite->addComponent(component); sprite->setCameraMask((unsigned short)CameraFlag::USER1); this->addChild(sprite); - component->syncToNode(); + component->syncNodeToPhysics(); frameInA.setIdentity(); constraint = Physics3D6DofConstraint::create(rigidBody, frameInA, false); physicsScene->getPhysics3DWorld()->addPhysics3DConstraint(constraint); @@ -592,7 +592,7 @@ bool Physics3DTerrainDemo::init() auto component = Physics3DComponent::create(rigidBody); terrain->addComponent(component); this->addChild(terrain); - component->syncToNode(); + component->syncNodeToPhysics(); component->setSyncFlag(Physics3DComponent::PhysicsSyncFlag::NONE); @@ -619,7 +619,7 @@ bool Physics3DTerrainDemo::init() sprite->setScale(1.0f / sprite->getContentSize().width); sprite->setPosition3D(Vec3(x, y, z)); this->addChild(sprite); - sprite->syncToNode(); + sprite->syncNodeToPhysics(); sprite->setSyncFlag(Physics3DComponent::PhysicsSyncFlag::PHYSICS_TO_NODE); } } From 8d3d3a0348d29d6b24147552d7d2af34022debaa Mon Sep 17 00:00:00 2001 From: zhangcheng Date: Thu, 4 Jun 2015 14:06:31 +0800 Subject: [PATCH 09/30] 1, Add onAdd and onRemove function to replace onEnter and onCancel used in onAdd and onRemove of ComponentContainer. --- cocos/2d/CCComponent.cpp | 22 +++++++++++++++++++ cocos/2d/CCComponent.h | 4 ++++ cocos/2d/CCComponentContainer.cpp | 8 +++---- .../editor-support/cocostudio/CCComAudio.cpp | 10 +++++++++ cocos/editor-support/cocostudio/CCComAudio.h | 10 +++++++++ .../cocostudio/CCComController.cpp | 12 ++++++++++ .../cocostudio/CCComController.h | 10 +++++++++ .../editor-support/cocostudio/CCComRender.cpp | 16 ++++++++++++++ cocos/editor-support/cocostudio/CCComRender.h | 10 +++++++++ .../EnemyController.cpp | 6 ++--- .../EnemyController.h | 4 ++-- .../PlayerController.cpp | 6 ++--- .../PlayerController.h | 4 ++-- .../ProjectileController.cpp | 6 ++--- .../ProjectileController.h | 4 ++-- .../SceneController.cpp | 6 ++--- .../SceneController.h | 4 ++-- 17 files changed, 118 insertions(+), 24 deletions(-) diff --git a/cocos/2d/CCComponent.cpp b/cocos/2d/CCComponent.cpp index 2a252db2d0..5b7049e6f7 100644 --- a/cocos/2d/CCComponent.cpp +++ b/cocos/2d/CCComponent.cpp @@ -91,6 +91,28 @@ void Component::onExit() #endif } +void Component::onAdd() +{ +#if CC_ENABLE_SCRIPT_BINDING + if (_scriptType == kScriptTypeJavascript) + { + if (sendComponentEventToJS(this, kComponentOnAdd)) + return; + } +#endif +} + +void Component::onRemove() +{ +#if CC_ENABLE_SCRIPT_BINDING + if (_scriptType == kScriptTypeJavascript) + { + if (sendComponentEventToJS(this, kComponentOnRemove)) + return; + } +#endif +} + void Component::update(float delta) { #if CC_ENABLE_SCRIPT_BINDING diff --git a/cocos/2d/CCComponent.h b/cocos/2d/CCComponent.h index 90d6de8ca3..226d410ef1 100644 --- a/cocos/2d/CCComponent.h +++ b/cocos/2d/CCComponent.h @@ -38,6 +38,8 @@ class Node; enum { kComponentOnEnter, kComponentOnExit, + kComponentOnAdd, + kComponentOnRemove, kComponentOnUpdate }; @@ -58,6 +60,8 @@ public: virtual void onEnter(); virtual void onExit(); + virtual void onAdd(); + virtual void onRemove(); virtual void update(float delta); virtual bool serialize(void* r); virtual bool isEnabled() const; diff --git a/cocos/2d/CCComponentContainer.cpp b/cocos/2d/CCComponentContainer.cpp index 0de3cd8cdc..963e73369d 100644 --- a/cocos/2d/CCComponentContainer.cpp +++ b/cocos/2d/CCComponentContainer.cpp @@ -68,7 +68,7 @@ bool ComponentContainer::add(Component *com) CC_BREAK_IF(component); com->setOwner(_owner); _components->insert(com->getName(), com); - com->onEnter(); + com->onAdd(); ret = true; } while(0); return ret; @@ -85,7 +85,7 @@ bool ComponentContainer::remove(const std::string& name) CC_BREAK_IF(iter == _components->end()); auto com = iter->second; - com->onExit(); + com->onRemove(); com->setOwner(nullptr); _components->erase(iter); @@ -105,7 +105,7 @@ bool ComponentContainer::remove(Component *com) { if (iter->second == com) { - com->onExit(); + com->onRemove(); com->setOwner(nullptr); _components->erase(iter); break; @@ -122,7 +122,7 @@ void ComponentContainer::removeAll() { for (auto iter = _components->begin(); iter != _components->end(); ++iter) { - iter->second->onExit(); + iter->second->onRemove(); iter->second->setOwner(nullptr); } diff --git a/cocos/editor-support/cocostudio/CCComAudio.cpp b/cocos/editor-support/cocostudio/CCComAudio.cpp index 25c334f87a..8e53f5eb88 100644 --- a/cocos/editor-support/cocostudio/CCComAudio.cpp +++ b/cocos/editor-support/cocostudio/CCComAudio.cpp @@ -56,6 +56,16 @@ void ComAudio::onExit() stopAllEffects(); } +void ComAudio::onAdd() +{ +} + +void ComAudio::onRemove() +{ + stopBackgroundMusic(true); + stopAllEffects(); +} + bool ComAudio::isEnabled() const { return _enabled; diff --git a/cocos/editor-support/cocostudio/CCComAudio.h b/cocos/editor-support/cocostudio/CCComAudio.h index d91dbe7bee..a5997aadeb 100644 --- a/cocos/editor-support/cocostudio/CCComAudio.h +++ b/cocos/editor-support/cocostudio/CCComAudio.h @@ -59,6 +59,16 @@ public: * @lua NA */ virtual void onExit() override; + /** + * @js NA + * @lua NA + */ + virtual void onAdd() override; + /** + * @js NA + * @lua NA + */ + virtual void onRemove() override; virtual bool isEnabled() const override; virtual void setEnabled(bool b) override; virtual bool serialize(void* r) override; diff --git a/cocos/editor-support/cocostudio/CCComController.cpp b/cocos/editor-support/cocostudio/CCComController.cpp index a258321ba1..f24b7bebf5 100644 --- a/cocos/editor-support/cocostudio/CCComController.cpp +++ b/cocos/editor-support/cocostudio/CCComController.cpp @@ -54,6 +54,18 @@ void ComController::onExit() { } +void ComController::onAdd() +{ + if (_owner != nullptr) + { + _owner->scheduleUpdate(); + } +} + +void ComController::onRemove() +{ +} + void ComController::update(float delta) { } diff --git a/cocos/editor-support/cocostudio/CCComController.h b/cocos/editor-support/cocostudio/CCComController.h index 8a3ad4f32a..c3dda3fd1e 100644 --- a/cocos/editor-support/cocostudio/CCComController.h +++ b/cocos/editor-support/cocostudio/CCComController.h @@ -59,6 +59,16 @@ public: * @lua NA */ virtual void onExit() override; + /** + * @js NA + * @lua NA + */ + virtual void onAdd() override; + /** + * @js NA + * @lua NA + */ + virtual void onRemove() override; virtual void update(float delta) override; virtual bool isEnabled() const override; virtual void setEnabled(bool b) override; diff --git a/cocos/editor-support/cocostudio/CCComRender.cpp b/cocos/editor-support/cocostudio/CCComRender.cpp index 4243e3aafb..b69e0570d2 100644 --- a/cocos/editor-support/cocostudio/CCComRender.cpp +++ b/cocos/editor-support/cocostudio/CCComRender.cpp @@ -68,6 +68,22 @@ void ComRender::onExit() } } +void ComRender::onAdd() +{ + if (_owner != nullptr) + { + _owner->addChild(_render); + } +} + +void ComRender::onRemove() +{ + if (_owner != nullptr) + { + _owner->removeChild(_render, true); + } +} + cocos2d::Node* ComRender::getNode() { return _render; diff --git a/cocos/editor-support/cocostudio/CCComRender.h b/cocos/editor-support/cocostudio/CCComRender.h index 02b6e3fdd5..2911359bd8 100644 --- a/cocos/editor-support/cocostudio/CCComRender.h +++ b/cocos/editor-support/cocostudio/CCComRender.h @@ -57,6 +57,16 @@ public: * @lua NA */ virtual void onExit() override; + /** + * @js NA + * @lua NA + */ + virtual void onAdd() override; + /** + * @js NA + * @lua NA + */ + virtual void onRemove() override; virtual bool serialize(void* r) override; virtual cocos2d::Node* getNode(); virtual void setNode(cocos2d::Node *node); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/EnemyController.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/EnemyController.cpp index f109da7e5e..0f72d1331a 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/EnemyController.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/EnemyController.cpp @@ -18,9 +18,9 @@ bool EnemyController::init() return true; } -void EnemyController::onEnter() +void EnemyController::onAdd() { - ComController::onEnter(); + ComController::onAdd(); // Determine where to spawn the target along the Y axis Size winSize = Director::getInstance()->getVisibleSize(); float minY = getOwner()->getContentSize().height/2; @@ -52,7 +52,7 @@ void EnemyController::onEnter() _owner->runAction( Sequence::create(actionMove, actionMoveDone, nullptr) ); } -void EnemyController::onExit() +void EnemyController::onRemove() { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/EnemyController.h b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/EnemyController.h index 790f9da45d..542d673cf0 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/EnemyController.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/EnemyController.h @@ -14,8 +14,8 @@ protected: public: virtual bool init() override; - virtual void onEnter() override; - virtual void onExit() override; + virtual void onAdd() override; + virtual void onRemove() override; virtual void update(float delta) override; static EnemyController* create(void); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/PlayerController.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/PlayerController.cpp index bd926530d1..d697052ac7 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/PlayerController.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/PlayerController.cpp @@ -20,13 +20,13 @@ bool PlayerController::init() return true; } -void PlayerController::onEnter() +void PlayerController::onAdd() { - ComController::onEnter(); + ComController::onAdd(); setTouchEnabled(true); } -void PlayerController::onExit() +void PlayerController::onRemove() { setTouchEnabled(false); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/PlayerController.h b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/PlayerController.h index 7848ff1e08..c24e388b7a 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/PlayerController.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/PlayerController.h @@ -17,8 +17,8 @@ public: public: virtual bool init() override; - virtual void onEnter() override; - virtual void onExit() override; + virtual void onAdd() override; + virtual void onRemove() override; virtual void update(float delta) override; static PlayerController* create(void); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.cpp index 29b11b5df7..fd24115998 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.cpp @@ -19,9 +19,9 @@ bool ProjectileController::init() return true; } -void ProjectileController::onEnter() +void ProjectileController::onAdd() { - ComController::onEnter(); + ComController::onAdd(); auto winSize = Director::getInstance()->getVisibleSize(); auto origin = Director::getInstance()->getVisibleOrigin(); _owner->setPosition( Vec2(origin.x+20, origin.y+winSize.height/2) ); @@ -30,7 +30,7 @@ void ProjectileController::onEnter() static_cast(com)->getProjectiles().pushBack(_owner); } -void ProjectileController::onExit() +void ProjectileController::onRemove() { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.h b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.h index 55cd5cba78..3d3b76db73 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.h @@ -13,8 +13,8 @@ protected: public: virtual bool init() override; - virtual void onEnter() override; - virtual void onExit() override; + virtual void onAdd() override; + virtual void onRemove() override; virtual void update(float delta) override; static ProjectileController* create(void); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/SceneController.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/SceneController.cpp index e7a677109d..835cb99c87 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/SceneController.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/SceneController.cpp @@ -24,16 +24,16 @@ bool SceneController::init() return true; } -void SceneController::onEnter() +void SceneController::onAdd() { - ComController::onEnter(); + ComController::onAdd(); _fAddTargetTime = 1.0f; static_cast(_owner->getComponent("Audio"))->playBackgroundMusic("background.wav", true); static_cast(_owner->getComponent("CCComAttribute"))->setInt("KillCount", 0); } -void SceneController::onExit() +void SceneController::onRemove() { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/SceneController.h b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/SceneController.h index a4eda36e4f..770f73ee27 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/SceneController.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/SceneController.h @@ -13,8 +13,8 @@ protected: public: virtual bool init() override; - virtual void onEnter() override; - virtual void onExit() override; + virtual void onAdd() override; + virtual void onRemove() override; virtual void update(float delta) override; static SceneController* create(); From 6a53cfdc764e509a7f517ad736e24ffa0ba6f196 Mon Sep 17 00:00:00 2001 From: zhangcheng Date: Thu, 4 Jun 2015 14:08:47 +0800 Subject: [PATCH 10/30] 1, modify space format. --- cocos/2d/CCComponent.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/2d/CCComponent.h b/cocos/2d/CCComponent.h index 226d410ef1..a6151f337a 100644 --- a/cocos/2d/CCComponent.h +++ b/cocos/2d/CCComponent.h @@ -38,8 +38,8 @@ class Node; enum { kComponentOnEnter, kComponentOnExit, - kComponentOnAdd, - kComponentOnRemove, + kComponentOnAdd, + kComponentOnRemove, kComponentOnUpdate }; From 83f7f30c1c83256f64e9d4bc3913a01183fc85d1 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 4 Jun 2015 15:03:20 +0800 Subject: [PATCH 11/30] Fix issue that __JSDownloaderDelegator::onError get called twice --- .../jsb_cocos2dx_extension_manual.cpp | 6 +----- extensions/assets-manager/Downloader.cpp | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp b/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp index bb3cd6c8e4..597701d0ba 100644 --- a/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp +++ b/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp @@ -951,11 +951,7 @@ void __JSDownloaderDelegator::startDownload() cocos2d::extension::Downloader::HeaderInfo info = _downloader->getHeader(_url); long contentSize = info.contentSize; - if (contentSize == -1 || info.responseCode >= 400) { - cocos2d::extension::Downloader::Error err; - onError(err); - } - else { + if (contentSize > 0 && info.responseCode < 400) { _size = contentSize / sizeof(unsigned char); _buffer = (unsigned char*)malloc(contentSize); _downloader->downloadToBufferSync(_url, _buffer, _size); diff --git a/extensions/assets-manager/Downloader.cpp b/extensions/assets-manager/Downloader.cpp index afa483440d..c5c260f7c4 100644 --- a/extensions/assets-manager/Downloader.cpp +++ b/extensions/assets-manager/Downloader.cpp @@ -296,16 +296,24 @@ Downloader::HeaderInfo Downloader::prepareHeader(const std::string &srcUrl, void curl_easy_getinfo(header, CURLINFO_CONTENT_TYPE, &contentType); curl_easy_getinfo(header, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &info.contentSize); curl_easy_getinfo(header, CURLINFO_RESPONSE_CODE, &info.responseCode); - info.url = url; - info.contentType = contentType; - info.valid = true; - if (_onHeader) + if (contentType == nullptr || info.contentSize == -1 || info.responseCode >= 400) { - _onHeader(srcUrl, info); + info.valid = false; + } + else + { + info.url = url; + info.contentType = contentType; + info.valid = true; } } - else + + if (info.valid && _onHeader) + { + _onHeader(srcUrl, info); + } + else if (!info.valid) { info.contentSize = -1; std::string msg = StringUtils::format("Can not get content size of file (%s) : Request header failed", srcUrl.c_str()); From 825c89299a29ddf49e47f683970834e148de800f Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Thu, 4 Jun 2015 15:30:45 +0800 Subject: [PATCH 12/30] Update the reference of submodule cocos2d-console. --- tools/cocos2d-console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cocos2d-console b/tools/cocos2d-console index 3c9958a1d2..4f0fd0a30f 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit 3c9958a1d2fc1ce1cea582c6bde0efc5a9537654 +Subproject commit 4f0fd0a30f010756e01a0e1b9c341873e981c10a From 2c168130ed8545edb947e4b13f7708dce09bff05 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 4 Jun 2015 15:59:05 +0800 Subject: [PATCH 13/30] Fix jsbinding calls for CCComponent --- cocos/2d/CCComponent.cpp | 15 +++++---------- .../js-bindings/manual/ScriptingCore.cpp | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/cocos/2d/CCComponent.cpp b/cocos/2d/CCComponent.cpp index 5b7049e6f7..6bb111830b 100644 --- a/cocos/2d/CCComponent.cpp +++ b/cocos/2d/CCComponent.cpp @@ -74,8 +74,7 @@ void Component::onEnter() #if CC_ENABLE_SCRIPT_BINDING if (_scriptType == kScriptTypeJavascript) { - if (sendComponentEventToJS(this, kComponentOnEnter)) - return; + sendComponentEventToJS(this, kComponentOnEnter); } #endif } @@ -85,8 +84,7 @@ void Component::onExit() #if CC_ENABLE_SCRIPT_BINDING if (_scriptType == kScriptTypeJavascript) { - if (sendComponentEventToJS(this, kComponentOnExit)) - return; + sendComponentEventToJS(this, kComponentOnExit); } #endif } @@ -96,8 +94,7 @@ void Component::onAdd() #if CC_ENABLE_SCRIPT_BINDING if (_scriptType == kScriptTypeJavascript) { - if (sendComponentEventToJS(this, kComponentOnAdd)) - return; + sendComponentEventToJS(this, kComponentOnAdd); } #endif } @@ -107,8 +104,7 @@ void Component::onRemove() #if CC_ENABLE_SCRIPT_BINDING if (_scriptType == kScriptTypeJavascript) { - if (sendComponentEventToJS(this, kComponentOnRemove)) - return; + sendComponentEventToJS(this, kComponentOnRemove); } #endif } @@ -118,8 +114,7 @@ void Component::update(float delta) #if CC_ENABLE_SCRIPT_BINDING if (_scriptType == kScriptTypeJavascript) { - if (sendComponentEventToJS(this, kComponentOnUpdate)) - return; + sendComponentEventToJS(this, kComponentOnUpdate); } #endif } diff --git a/cocos/scripting/js-bindings/manual/ScriptingCore.cpp b/cocos/scripting/js-bindings/manual/ScriptingCore.cpp index 05e1fe2528..5f12532efc 100644 --- a/cocos/scripting/js-bindings/manual/ScriptingCore.cpp +++ b/cocos/scripting/js-bindings/manual/ScriptingCore.cpp @@ -1058,7 +1058,21 @@ int ScriptingCore::handleComponentEvent(void* data) JS::RootedValue retval(_cx); jsval dataVal = INT_TO_JSVAL(1); - if (action == kComponentOnEnter) + if (action == kComponentOnAdd) + { + if (isFunctionOverridedInJS(JS::RootedObject(_cx, p->obj.get()), "onAdd", js_cocos2dx_Component_onEnter)) + { + ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), "onAdd", 1, &dataVal, &retval); + } + } + else if (action == kComponentOnRemove) + { + if (isFunctionOverridedInJS(JS::RootedObject(_cx, p->obj.get()), "onRemove", js_cocos2dx_Component_onExit)) + { + ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), "onRemove", 1, &dataVal, &retval); + } + } + else if (action == kComponentOnEnter) { if (isFunctionOverridedInJS(JS::RootedObject(_cx, p->obj.get()), "onEnter", js_cocos2dx_Component_onEnter)) { From 19f95c5542c7bd7fbfd2942ece6fb33da0e451ab Mon Sep 17 00:00:00 2001 From: Namezero Date: Thu, 4 Jun 2015 10:13:34 +0200 Subject: [PATCH 14/30] TintBy::clone() incorrect cast TintBy::clone() incorrectly casts the GLshort members to GLubyte, resulting in an object that isn't a clone and an incorrect tint. --- cocos/2d/CCActionInterval.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/2d/CCActionInterval.cpp b/cocos/2d/CCActionInterval.cpp index 69835dc9d0..b27b0567a9 100644 --- a/cocos/2d/CCActionInterval.cpp +++ b/cocos/2d/CCActionInterval.cpp @@ -2106,7 +2106,7 @@ TintBy* TintBy::clone() const { // no copy constructor auto a = new (std::nothrow) TintBy(); - a->initWithDuration(_duration, (GLubyte)_deltaR, (GLubyte)_deltaG, (GLubyte)_deltaB); + a->initWithDuration(_duration, _deltaR, _deltaG, _deltaB); a->autorelease(); return a; } From ed6d6521acf7f49c58a341d9e266736edcea5bf8 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 4 Jun 2015 17:59:56 +0800 Subject: [PATCH 15/30] Add CURLOPT_NOSIGNAL to avoid multithread issue on timeout --- extensions/assets-manager/Downloader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/assets-manager/Downloader.cpp b/extensions/assets-manager/Downloader.cpp index c5c260f7c4..3187b19762 100644 --- a/extensions/assets-manager/Downloader.cpp +++ b/extensions/assets-manager/Downloader.cpp @@ -288,6 +288,7 @@ Downloader::HeaderInfo Downloader::prepareHeader(const std::string &srcUrl, void curl_easy_setopt(header, CURLOPT_URL, srcUrl.c_str()); curl_easy_setopt(header, CURLOPT_HEADER, 1); curl_easy_setopt(header, CURLOPT_NOBODY, 1); + curl_easy_setopt(header, CURLOPT_NOSIGNAL, 1); if (curl_easy_perform(header) == CURLE_OK) { char *url; From 77826b453dccab30e5ade1a122346dbd36b86df6 Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 4 Jun 2015 18:27:03 +0800 Subject: [PATCH 16/30] update 3rd party libs to 60 --- external/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/config.json b/external/config.json index 54f8f5d4f8..6355bc2b9d 100644 --- a/external/config.json +++ b/external/config.json @@ -1,5 +1,5 @@ { - "version":"v3-deps-57", + "version":"v3-deps-60", "zip_file_size":"138162176", "repo_name":"cocos2d-x-3rd-party-libs-bin", "repo_parent":"https://github.com/cocos2d/", From c722dd76d6793d39927535e35c1235bf15490384 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 4 Jun 2015 10:49:25 +0000 Subject: [PATCH 17/30] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 41 ++++++----------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 8b77d68bbf..ad1a640300 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -2252,26 +2252,6 @@ "external/chipmunk/prebuilt/wp_8.1/arm/chipmunk.lib", "external/chipmunk/prebuilt/wp_8.1/win32/chipmunk.lib", "external/config.json", - "external/curl/include/android/curl/curl.h", - "external/curl/include/android/curl/curlbuild.h", - "external/curl/include/android/curl/curlrules.h", - "external/curl/include/android/curl/curlver.h", - "external/curl/include/android/curl/easy.h", - "external/curl/include/android/curl/mprintf.h", - "external/curl/include/android/curl/multi.h", - "external/curl/include/android/curl/stdcheaders.h", - "external/curl/include/android/curl/typecheck-gcc.h", - "external/curl/include/ios/curl/curl.h", - "external/curl/include/ios/curl/curlbuild-32.h", - "external/curl/include/ios/curl/curlbuild-64.h", - "external/curl/include/ios/curl/curlbuild.h", - "external/curl/include/ios/curl/curlrules.h", - "external/curl/include/ios/curl/curlver.h", - "external/curl/include/ios/curl/easy.h", - "external/curl/include/ios/curl/mprintf.h", - "external/curl/include/ios/curl/multi.h", - "external/curl/include/ios/curl/stdcheaders.h", - "external/curl/include/ios/curl/typecheck-gcc.h", "external/curl/include/mac/curl/curl.h", "external/curl/include/mac/curl/curlbuild.h", "external/curl/include/mac/curl/curlrules.h", @@ -2308,24 +2288,11 @@ "external/curl/include/wp_8.1/curl/multi.h", "external/curl/include/wp_8.1/curl/stdcheaders.h", "external/curl/include/wp_8.1/curl/typecheck-gcc.h", - "external/curl/prebuilt/android/Android.mk", - "external/curl/prebuilt/android/armeabi-v7a/libcrypto.a", - "external/curl/prebuilt/android/armeabi-v7a/libcurl.a", - "external/curl/prebuilt/android/armeabi-v7a/libssl.a", - "external/curl/prebuilt/android/armeabi/libcrypto.a", - "external/curl/prebuilt/android/armeabi/libcurl.a", - "external/curl/prebuilt/android/armeabi/libssl.a", - "external/curl/prebuilt/android/x86/libcrypto.a", - "external/curl/prebuilt/android/x86/libcurl.a", - "external/curl/prebuilt/android/x86/libssl.a", - "external/curl/prebuilt/ios/libcrypto.a", - "external/curl/prebuilt/ios/libcurl.a", - "external/curl/prebuilt/ios/libssl.a", "external/curl/prebuilt/mac/libcrypto.a", "external/curl/prebuilt/mac/libcurl.a", "external/curl/prebuilt/mac/libssl.a", "external/curl/prebuilt/win32/libcurl.dll", - "external/curl/prebuilt/win32/libcurl_imp.lib", + "external/curl/prebuilt/win32/libcurl.lib", "external/curl/prebuilt/win32/libeay32.lib", "external/curl/prebuilt/win32/ssleay32.lib", "external/curl/prebuilt/winrt_8.1/arm/libcurl.dll", @@ -2999,6 +2966,12 @@ "external/recast/fastlz/fastlz.h", "external/recast/proj.win32/librecast.vcxproj", "external/recast/proj.win32/librecast.vcxproj.filters", + "external/recast/proj.win8.1-universal/librecast.Shared/librecast.Shared.vcxitems", + "external/recast/proj.win8.1-universal/librecast.Shared/librecast.Shared.vcxitems.filters", + "external/recast/proj.win8.1-universal/librecast.Windows/librecast.Windows.vcxproj", + "external/recast/proj.win8.1-universal/librecast.Windows/librecast.Windows.vcxproj.filters", + "external/recast/proj.win8.1-universal/librecast.WindowsPhone/librecast.WindowsPhone.vcxproj", + "external/recast/proj.win8.1-universal/librecast.WindowsPhone/librecast.WindowsPhone.vcxproj.filters", "external/sqlite3/Android.mk", "external/sqlite3/include/sqlite3.h", "external/sqlite3/include/sqlite3ext.h", From cf431121c9633f7b43491a8bc29c6c738e2cee07 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 4 Jun 2015 19:38:52 +0800 Subject: [PATCH 18/30] Revert "update 3rd party libs to 60" --- external/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/config.json b/external/config.json index 6355bc2b9d..54f8f5d4f8 100644 --- a/external/config.json +++ b/external/config.json @@ -1,5 +1,5 @@ { - "version":"v3-deps-60", + "version":"v3-deps-57", "zip_file_size":"138162176", "repo_name":"cocos2d-x-3rd-party-libs-bin", "repo_parent":"https://github.com/cocos2d/", From 2a9984da8611d90a1e83c3d543bf1a4e55956ea7 Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 4 Jun 2015 19:53:53 +0800 Subject: [PATCH 19/30] upgrade external version to 61 Conflicts: external/config.json --- external/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/config.json b/external/config.json index 54f8f5d4f8..4f0f2e4cf1 100644 --- a/external/config.json +++ b/external/config.json @@ -1,5 +1,5 @@ { - "version":"v3-deps-57", + "version":"v3-deps-61", "zip_file_size":"138162176", "repo_name":"cocos2d-x-3rd-party-libs-bin", "repo_parent":"https://github.com/cocos2d/", From e473da38cbaa8681c2f03e1131d8f797eeba0e53 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 4 Jun 2015 20:05:30 +0800 Subject: [PATCH 20/30] Skip C++ invocation functions of Component --- tools/tojs/cocos2dx.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index 5f054a9171..569e0c24ac 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -118,7 +118,7 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat Device::[getTextureDataForText], EventDispatcher::[dispatchCustomEvent], EventCustom::[getUserData setUserData], - Component::[serialize], + Component::[serialize onAdd onRemove update], EventListenerCustom::[init], EventListener::[init], Scene::[getCameras getLights initWithPhysics createWithPhysics getPhysicsWorld getPhysics3DWorld setPhysics3DDebugCamera], From e75dee6e7c0a1dd794d65001efaf897113986762 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 4 Jun 2015 20:10:10 +0800 Subject: [PATCH 21/30] Remove C++ invocation functions of Component --- .../js-bindings/manual/cocos2d_specifics.cpp | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp index 392d8bf0db..6b3b584b62 100644 --- a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp +++ b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp @@ -2693,36 +2693,6 @@ bool js_cocos2dx_CCNode_convertToWorldSpaceAR(JSContext *cx, uint32_t argc, jsva return true; } -bool js_cocos2dx_Component_onEnter(JSContext *cx, uint32_t argc, jsval *vp) -{ - JSObject *thisObj = JS_THIS_OBJECT(cx, vp); - if (thisObj) { - js_proxy_t *proxy = jsb_get_js_proxy(thisObj); - if (proxy) { - ScriptingCore::getInstance()->setCalledFromScript(true); - static_cast(proxy->ptr)->onEnter(); - return true; - } - } - JS_ReportError(cx, "Invalid Native Object."); - return false; -} - -bool js_cocos2dx_Component_onExit(JSContext *cx, uint32_t argc, jsval *vp) -{ - JSObject *thisObj = JS_THIS_OBJECT(cx, vp); - if (thisObj) { - js_proxy_t *proxy = jsb_get_js_proxy(thisObj); - if (proxy) { - ScriptingCore::getInstance()->setCalledFromScript(true); - static_cast(proxy->ptr)->onExit(); - return true; - } - } - JS_ReportError(cx, "Invalid Native Object."); - return false; -} - bool js_cocos2dx_CCTMXLayer_tileFlagsAt(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -5490,10 +5460,6 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global) tmpObj.set(jsb_cocos2d_GLProgramState_prototype); JS_DefineFunction(cx, tmpObj, "setVertexAttribPointer", js_cocos2dx_GLProgramState_setVertexAttribPointer, 6, JSPROP_ENUMERATE | JSPROP_PERMANENT); JS_DefineFunction(cx, tmpObj, "setUniformVec4", js_cocos2dx_GLProgramState_setUniformVec4, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT); - - tmpObj.set(jsb_cocos2d_Component_prototype); - JS_DefineFunction(cx, tmpObj, "onEnter", js_cocos2dx_Component_onEnter, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT); - JS_DefineFunction(cx, tmpObj, "onExit", js_cocos2dx_Component_onExit, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT); tmpObj.set(jsb_cocos2d_Scheduler_prototype); JS_DefineFunction(cx, tmpObj, "retain", js_cocos2dx_retain, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT); From 8865bd488e227f5b1219904aa791a778bc92a050 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 4 Jun 2015 12:52:41 +0000 Subject: [PATCH 22/30] [ci skip][AUTO]: updating luabinding & jsbinding automatically --- .../auto/api/jsb_cocos2dx_auto_api.js | 24 +++- .../js-bindings/auto/jsb_cocos2dx_auto.cpp | 72 ++++++++--- .../js-bindings/auto/jsb_cocos2dx_auto.hpp | 4 +- .../lua-bindings/auto/api/ComAudio.lua | 26 +++- .../lua-bindings/auto/api/ComController.lua | 14 +++ .../lua-bindings/auto/api/ComRender.lua | 14 +++ .../lua-bindings/auto/api/Component.lua | 16 ++- .../lua-bindings/auto/lua_cocos2dx_auto.cpp | 118 ++++++++++++++++-- .../lua-bindings/auto/lua_cocos2dx_auto.hpp | 2 + 9 files changed, 247 insertions(+), 43 deletions(-) diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js index 95ab779589..34f28019da 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js @@ -22213,6 +22213,14 @@ isEnabled : function ( return false; }, +/** + * @method onRemove + */ +onRemove : function ( +) +{ +}, + /** * @method update * @param {float} arg0 @@ -22244,11 +22252,9 @@ init : function ( }, /** - * @method setOwner - * @param {cc.Node} arg0 + * @method onAdd */ -setOwner : function ( -node +onAdd : function ( ) { }, @@ -22263,6 +22269,16 @@ getName : function ( return ; }, +/** + * @method setOwner + * @param {cc.Node} arg0 + */ +setOwner : function ( +node +) +{ +}, + /** * @method create * @return {cc.Component} diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp index 545aa3cd07..00bd28b7f8 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp @@ -67823,6 +67823,22 @@ bool js_cocos2dx_Component_isEnabled(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Component_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_Component_onRemove(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_onRemove : Invalid Native Object"); + if (argc == 0) { + cobj->onRemove(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_onRemove : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Component_update(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -67886,6 +67902,40 @@ bool js_cocos2dx_Component_init(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Component_init : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_Component_onAdd(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_onAdd : Invalid Native Object"); + if (argc == 0) { + cobj->onAdd(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_onAdd : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_Component_getName(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_getName : Invalid Native Object"); + if (argc == 0) { + const std::string& ret = cobj->getName(); + jsval jsret = JSVAL_NULL; + jsret = std_string_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Component_getName : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Component_setOwner(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -67914,24 +67964,6 @@ bool js_cocos2dx_Component_setOwner(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Component_setOwner : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_Component_getName(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_getName : Invalid Native Object"); - if (argc == 0) { - const std::string& ret = cobj->getName(); - jsval jsret = JSVAL_NULL; - jsret = std_string_to_jsval(cx, ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_getName : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_Component_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -68026,11 +68058,13 @@ void js_register_cocos2dx_Component(JSContext *cx, JS::HandleObject global) { JS_FN("setEnabled", js_cocos2dx_Component_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setName", js_cocos2dx_Component_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isEnabled", js_cocos2dx_Component_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("onRemove", js_cocos2dx_Component_onRemove, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("update", js_cocos2dx_Component_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getOwner", js_cocos2dx_Component_getOwner, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("init", js_cocos2dx_Component_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setOwner", js_cocos2dx_Component_setOwner, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("onAdd", js_cocos2dx_Component_onAdd, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getName", js_cocos2dx_Component_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setOwner", js_cocos2dx_Component_setOwner, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2d_Component_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp index 1a0c5560e6..752f1198d2 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp @@ -3922,11 +3922,13 @@ void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_Component_setEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_setName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_isEnabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_onRemove(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_update(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_getOwner(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_init(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_setOwner(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_onAdd(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_getName(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Component_setOwner(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_Component(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/lua-bindings/auto/api/ComAudio.lua b/cocos/scripting/lua-bindings/auto/api/ComAudio.lua index ad1daa9948..ae10d04a67 100644 --- a/cocos/scripting/lua-bindings/auto/api/ComAudio.lua +++ b/cocos/scripting/lua-bindings/auto/api/ComAudio.lua @@ -199,12 +199,6 @@ -- @param #bool b -- @return ComAudio#ComAudio self (return value: ccs.ComAudio) --------------------------------- --- --- @function [parent=#ComAudio] isEnabled --- @param self --- @return bool#bool ret (return value: bool) - -------------------------------- -- -- @function [parent=#ComAudio] serialize @@ -212,10 +206,30 @@ -- @param #void r -- @return bool#bool ret (return value: bool) +-------------------------------- +-- +-- @function [parent=#ComAudio] isEnabled +-- @param self +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- js NA
+-- lua NA +-- @function [parent=#ComAudio] onRemove +-- @param self +-- @return ComAudio#ComAudio self (return value: ccs.ComAudio) + -------------------------------- -- -- @function [parent=#ComAudio] init -- @param self -- @return bool#bool ret (return value: bool) +-------------------------------- +-- js NA
+-- lua NA +-- @function [parent=#ComAudio] onAdd +-- @param self +-- @return ComAudio#ComAudio self (return value: ccs.ComAudio) + return nil diff --git a/cocos/scripting/lua-bindings/auto/api/ComController.lua b/cocos/scripting/lua-bindings/auto/api/ComController.lua index 87c582e32c..df4fbe5c16 100644 --- a/cocos/scripting/lua-bindings/auto/api/ComController.lua +++ b/cocos/scripting/lua-bindings/auto/api/ComController.lua @@ -29,6 +29,13 @@ -- @param self -- @return bool#bool ret (return value: bool) +-------------------------------- +-- js NA
+-- lua NA +-- @function [parent=#ComController] onRemove +-- @param self +-- @return ComController#ComController self (return value: ccs.ComController) + -------------------------------- -- -- @function [parent=#ComController] update @@ -42,6 +49,13 @@ -- @param self -- @return bool#bool ret (return value: bool) +-------------------------------- +-- js NA
+-- lua NA +-- @function [parent=#ComController] onAdd +-- @param self +-- @return ComController#ComController self (return value: ccs.ComController) + -------------------------------- -- js ctor -- @function [parent=#ComController] ComController diff --git a/cocos/scripting/lua-bindings/auto/api/ComRender.lua b/cocos/scripting/lua-bindings/auto/api/ComRender.lua index 42200e3a28..0d9f436c6e 100644 --- a/cocos/scripting/lua-bindings/auto/api/ComRender.lua +++ b/cocos/scripting/lua-bindings/auto/api/ComRender.lua @@ -39,4 +39,18 @@ -- @param #void r -- @return bool#bool ret (return value: bool) +-------------------------------- +-- js NA
+-- lua NA +-- @function [parent=#ComRender] onRemove +-- @param self +-- @return ComRender#ComRender self (return value: ccs.ComRender) + +-------------------------------- +-- js NA
+-- lua NA +-- @function [parent=#ComRender] onAdd +-- @param self +-- @return ComRender#ComRender self (return value: ccs.ComRender) + return nil diff --git a/cocos/scripting/lua-bindings/auto/api/Component.lua b/cocos/scripting/lua-bindings/auto/api/Component.lua index 5e157151d1..372d8e1cf0 100644 --- a/cocos/scripting/lua-bindings/auto/api/Component.lua +++ b/cocos/scripting/lua-bindings/auto/api/Component.lua @@ -24,6 +24,12 @@ -- @param self -- @return bool#bool ret (return value: bool) +-------------------------------- +-- +-- @function [parent=#Component] onRemove +-- @param self +-- @return Component#Component self (return value: cc.Component) + -------------------------------- -- -- @function [parent=#Component] update @@ -45,9 +51,8 @@ -------------------------------- -- --- @function [parent=#Component] setOwner +-- @function [parent=#Component] onAdd -- @param self --- @param #cc.Node pOwner -- @return Component#Component self (return value: cc.Component) -------------------------------- @@ -56,6 +61,13 @@ -- @param self -- @return string#string ret (return value: string) +-------------------------------- +-- +-- @function [parent=#Component] setOwner +-- @param self +-- @param #cc.Node pOwner +-- @return Component#Component self (return value: cc.Component) + -------------------------------- -- -- @function [parent=#Component] create diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index 84ff90b5f7..8064da4c86 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -91234,6 +91234,53 @@ int lua_cocos2dx_Component_isEnabled(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Component_onRemove(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_onRemove'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_onRemove'", nullptr); + return 0; + } + cobj->onRemove(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:onRemove",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_onRemove'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Component_update(lua_State* tolua_S) { int argc = 0; @@ -91378,7 +91425,7 @@ int lua_cocos2dx_Component_init(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Component_setOwner(lua_State* tolua_S) +int lua_cocos2dx_Component_onAdd(lua_State* tolua_S) { int argc = 0; cocos2d::Component* cobj = nullptr; @@ -91398,32 +91445,29 @@ int lua_cocos2dx_Component_setOwner(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setOwner'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_onAdd'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 1) + if (argc == 0) { - cocos2d::Node* arg0; - - ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "cc.Component:setOwner"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setOwner'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_onAdd'", nullptr); return 0; } - cobj->setOwner(arg0); + cobj->onAdd(); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setOwner",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:onAdd",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setOwner'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_onAdd'.",&tolua_err); #endif return 0; @@ -91475,6 +91519,56 @@ int lua_cocos2dx_Component_getName(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Component_setOwner(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Component* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Component",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Component*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Component_setOwner'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Node* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "cc.Component:setOwner"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Component_setOwner'", nullptr); + return 0; + } + cobj->setOwner(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Component:setOwner",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Component_setOwner'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Component_create(lua_State* tolua_S) { int argc = 0; @@ -91524,11 +91618,13 @@ int lua_register_cocos2dx_Component(lua_State* tolua_S) tolua_function(tolua_S,"setEnabled",lua_cocos2dx_Component_setEnabled); tolua_function(tolua_S,"setName",lua_cocos2dx_Component_setName); tolua_function(tolua_S,"isEnabled",lua_cocos2dx_Component_isEnabled); + tolua_function(tolua_S,"onRemove",lua_cocos2dx_Component_onRemove); tolua_function(tolua_S,"update",lua_cocos2dx_Component_update); tolua_function(tolua_S,"getOwner",lua_cocos2dx_Component_getOwner); tolua_function(tolua_S,"init",lua_cocos2dx_Component_init); - tolua_function(tolua_S,"setOwner",lua_cocos2dx_Component_setOwner); + tolua_function(tolua_S,"onAdd",lua_cocos2dx_Component_onAdd); tolua_function(tolua_S,"getName",lua_cocos2dx_Component_getName); + tolua_function(tolua_S,"setOwner",lua_cocos2dx_Component_setOwner); tolua_function(tolua_S,"create", lua_cocos2dx_Component_create); tolua_endmodule(tolua_S); std::string typeName = typeid(cocos2d::Component).name(); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index b0e49095a4..59981d3917 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -2049,6 +2049,8 @@ int register_all_cocos2dx(lua_State* tolua_S); + + From 1b8ff0e5957c98b2661b6909a9c6389aaf786f7b Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 4 Jun 2015 14:05:38 +0000 Subject: [PATCH 23/30] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 41 +++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index ad1a640300..8b77d68bbf 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -2252,6 +2252,26 @@ "external/chipmunk/prebuilt/wp_8.1/arm/chipmunk.lib", "external/chipmunk/prebuilt/wp_8.1/win32/chipmunk.lib", "external/config.json", + "external/curl/include/android/curl/curl.h", + "external/curl/include/android/curl/curlbuild.h", + "external/curl/include/android/curl/curlrules.h", + "external/curl/include/android/curl/curlver.h", + "external/curl/include/android/curl/easy.h", + "external/curl/include/android/curl/mprintf.h", + "external/curl/include/android/curl/multi.h", + "external/curl/include/android/curl/stdcheaders.h", + "external/curl/include/android/curl/typecheck-gcc.h", + "external/curl/include/ios/curl/curl.h", + "external/curl/include/ios/curl/curlbuild-32.h", + "external/curl/include/ios/curl/curlbuild-64.h", + "external/curl/include/ios/curl/curlbuild.h", + "external/curl/include/ios/curl/curlrules.h", + "external/curl/include/ios/curl/curlver.h", + "external/curl/include/ios/curl/easy.h", + "external/curl/include/ios/curl/mprintf.h", + "external/curl/include/ios/curl/multi.h", + "external/curl/include/ios/curl/stdcheaders.h", + "external/curl/include/ios/curl/typecheck-gcc.h", "external/curl/include/mac/curl/curl.h", "external/curl/include/mac/curl/curlbuild.h", "external/curl/include/mac/curl/curlrules.h", @@ -2288,11 +2308,24 @@ "external/curl/include/wp_8.1/curl/multi.h", "external/curl/include/wp_8.1/curl/stdcheaders.h", "external/curl/include/wp_8.1/curl/typecheck-gcc.h", + "external/curl/prebuilt/android/Android.mk", + "external/curl/prebuilt/android/armeabi-v7a/libcrypto.a", + "external/curl/prebuilt/android/armeabi-v7a/libcurl.a", + "external/curl/prebuilt/android/armeabi-v7a/libssl.a", + "external/curl/prebuilt/android/armeabi/libcrypto.a", + "external/curl/prebuilt/android/armeabi/libcurl.a", + "external/curl/prebuilt/android/armeabi/libssl.a", + "external/curl/prebuilt/android/x86/libcrypto.a", + "external/curl/prebuilt/android/x86/libcurl.a", + "external/curl/prebuilt/android/x86/libssl.a", + "external/curl/prebuilt/ios/libcrypto.a", + "external/curl/prebuilt/ios/libcurl.a", + "external/curl/prebuilt/ios/libssl.a", "external/curl/prebuilt/mac/libcrypto.a", "external/curl/prebuilt/mac/libcurl.a", "external/curl/prebuilt/mac/libssl.a", "external/curl/prebuilt/win32/libcurl.dll", - "external/curl/prebuilt/win32/libcurl.lib", + "external/curl/prebuilt/win32/libcurl_imp.lib", "external/curl/prebuilt/win32/libeay32.lib", "external/curl/prebuilt/win32/ssleay32.lib", "external/curl/prebuilt/winrt_8.1/arm/libcurl.dll", @@ -2966,12 +2999,6 @@ "external/recast/fastlz/fastlz.h", "external/recast/proj.win32/librecast.vcxproj", "external/recast/proj.win32/librecast.vcxproj.filters", - "external/recast/proj.win8.1-universal/librecast.Shared/librecast.Shared.vcxitems", - "external/recast/proj.win8.1-universal/librecast.Shared/librecast.Shared.vcxitems.filters", - "external/recast/proj.win8.1-universal/librecast.Windows/librecast.Windows.vcxproj", - "external/recast/proj.win8.1-universal/librecast.Windows/librecast.Windows.vcxproj.filters", - "external/recast/proj.win8.1-universal/librecast.WindowsPhone/librecast.WindowsPhone.vcxproj", - "external/recast/proj.win8.1-universal/librecast.WindowsPhone/librecast.WindowsPhone.vcxproj.filters", "external/sqlite3/Android.mk", "external/sqlite3/include/sqlite3.h", "external/sqlite3/include/sqlite3ext.h", From e0eff2667491cebc66ae6bbf734508e327c429bb Mon Sep 17 00:00:00 2001 From: pandamicro Date: Fri, 5 Jun 2015 00:03:21 +0800 Subject: [PATCH 24/30] Fix component function execution issue in JSB --- .../js-bindings/manual/ScriptingCore.cpp | 27 +++++-------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/cocos/scripting/js-bindings/manual/ScriptingCore.cpp b/cocos/scripting/js-bindings/manual/ScriptingCore.cpp index 5f12532efc..6125f8551d 100644 --- a/cocos/scripting/js-bindings/manual/ScriptingCore.cpp +++ b/cocos/scripting/js-bindings/manual/ScriptingCore.cpp @@ -1058,42 +1058,29 @@ int ScriptingCore::handleComponentEvent(void* data) JS::RootedValue retval(_cx); jsval dataVal = INT_TO_JSVAL(1); + JS::RootedValue nodeValue(_cx, OBJECT_TO_JSVAL(p->obj.get())); + if (action == kComponentOnAdd) { - if (isFunctionOverridedInJS(JS::RootedObject(_cx, p->obj.get()), "onAdd", js_cocos2dx_Component_onEnter)) - { - ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), "onAdd", 1, &dataVal, &retval); - } + ret = executeFunctionWithOwner(nodeValue, "onAdd", 1, &dataVal, &retval); } else if (action == kComponentOnRemove) { - if (isFunctionOverridedInJS(JS::RootedObject(_cx, p->obj.get()), "onRemove", js_cocos2dx_Component_onExit)) - { - ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), "onRemove", 1, &dataVal, &retval); - } + ret = executeFunctionWithOwner(nodeValue, "onRemove", 1, &dataVal, &retval); } else if (action == kComponentOnEnter) { - if (isFunctionOverridedInJS(JS::RootedObject(_cx, p->obj.get()), "onEnter", js_cocos2dx_Component_onEnter)) - { - ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), "onEnter", 1, &dataVal, &retval); - } + ret = executeFunctionWithOwner(nodeValue, "onEnter", 1, &dataVal, &retval); resumeSchedulesAndActions(p); } else if (action == kComponentOnExit) { - if (isFunctionOverridedInJS(JS::RootedObject(_cx, p->obj.get()), "onExit", js_cocos2dx_Component_onExit)) - { - ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), "onExit", 1, &dataVal, &retval); - } + ret = executeFunctionWithOwner(nodeValue, "onExit", 1, &dataVal, &retval); pauseSchedulesAndActions(p); } else if (action == kComponentOnUpdate) { - if (isFunctionOverridedInJS(JS::RootedObject(_cx, p->obj.get()), "update", js_cocos2dx_Component_update)) - { - ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), "update", 1, &dataVal, &retval); - } + ret = executeFunctionWithOwner(nodeValue, "update", 1, &dataVal, &retval); } return ret; From 230899ae32635c44511aa51306a0440396bf6750 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Fri, 5 Jun 2015 09:39:15 +0800 Subject: [PATCH 25/30] issue #10257:Fix the error that Draw object display differently on the different platform. --- .../Classes/AppDelegate.cpp | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/templates/cpp-template-default/Classes/AppDelegate.cpp b/templates/cpp-template-default/Classes/AppDelegate.cpp index aa547b34aa..3aa4f443df 100644 --- a/templates/cpp-template-default/Classes/AppDelegate.cpp +++ b/templates/cpp-template-default/Classes/AppDelegate.cpp @@ -3,6 +3,11 @@ USING_NS_CC; +static cocos2d::Size designResolutionSize = cocos2d::Size(480, 320); +static cocos2d::Size smallResolutionSize = cocos2d::Size(480, 320); +static cocos2d::Size mediumResolutionSize = cocos2d::Size(1024, 768); +static cocos2d::Size largeResolutionSize = cocos2d::Size(2048, 1536); + AppDelegate::AppDelegate() { } @@ -44,6 +49,25 @@ bool AppDelegate::applicationDidFinishLaunching() { // set FPS. the default value is 1.0/60 if you don't call this director->setAnimationInterval(1.0 / 60); + // Set the design resolution + glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER); + Size frameSize = glview->getFrameSize(); + // if the frame's height is larger than the height of medium size. + if (frameSize.height > mediumResolutionSize.height) + { + director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width)); + } + // if the frame's height is larger than the height of small size. + else if (frameSize.height > smallResolutionSize.height) + { + director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width)); + } + // if the frame's height is smaller than the height of medium size. + else + { + director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width)); + } + register_all_packages(); // create a scene. it's an autorelease object From 9e3fa92803b1046d3db6a4f2e6e3d882bdc23bfe Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Fri, 5 Jun 2015 01:51:34 +0000 Subject: [PATCH 26/30] [ci skip][AUTO]: updating luabinding & jsbinding automatically --- .../auto/api/jsb_cocos2dx_auto_api.js | 26 --------- .../js-bindings/auto/jsb_cocos2dx_auto.cpp | 55 ------------------- .../js-bindings/auto/jsb_cocos2dx_auto.hpp | 3 - 3 files changed, 84 deletions(-) diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js index 34f28019da..21a8f84eaf 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js @@ -22213,24 +22213,6 @@ isEnabled : function ( return false; }, -/** - * @method onRemove - */ -onRemove : function ( -) -{ -}, - -/** - * @method update - * @param {float} arg0 - */ -update : function ( -float -) -{ -}, - /** * @method getOwner * @return {cc.Node} @@ -22251,14 +22233,6 @@ init : function ( return false; }, -/** - * @method onAdd - */ -onAdd : function ( -) -{ -}, - /** * @method getName * @return {String} diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp index 00bd28b7f8..aa5b597b38 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp @@ -67823,42 +67823,6 @@ bool js_cocos2dx_Component_isEnabled(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Component_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_Component_onRemove(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_onRemove : Invalid Native Object"); - if (argc == 0) { - cobj->onRemove(); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_onRemove : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_Component_update(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_update : Invalid Native Object"); - if (argc == 1) { - double arg0; - ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_update : Error processing arguments"); - cobj->update(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_update : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_Component_getOwner(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -67902,22 +67866,6 @@ bool js_cocos2dx_Component_init(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Component_init : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_Component_onAdd(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_onAdd : Invalid Native Object"); - if (argc == 0) { - cobj->onAdd(); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Component_onAdd : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_Component_getName(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -68058,11 +68006,8 @@ void js_register_cocos2dx_Component(JSContext *cx, JS::HandleObject global) { JS_FN("setEnabled", js_cocos2dx_Component_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setName", js_cocos2dx_Component_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isEnabled", js_cocos2dx_Component_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("onRemove", js_cocos2dx_Component_onRemove, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("update", js_cocos2dx_Component_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getOwner", js_cocos2dx_Component_getOwner, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("init", js_cocos2dx_Component_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("onAdd", js_cocos2dx_Component_onAdd, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getName", js_cocos2dx_Component_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setOwner", js_cocos2dx_Component_setOwner, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2d_Component_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp index 752f1198d2..260cb822c0 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp @@ -3922,11 +3922,8 @@ void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_Component_setEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_setName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_isEnabled(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_onRemove(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_update(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_getOwner(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_init(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Component_onAdd(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_getName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_setOwner(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Component_create(JSContext *cx, uint32_t argc, jsval *vp); From 297945cca5632c36443e47c31b2414b37ece1b54 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Fri, 5 Jun 2015 02:13:10 +0000 Subject: [PATCH 27/30] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 8b77d68bbf..360e1f1552 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -2999,6 +2999,12 @@ "external/recast/fastlz/fastlz.h", "external/recast/proj.win32/librecast.vcxproj", "external/recast/proj.win32/librecast.vcxproj.filters", + "external/recast/proj.win8.1-universal/librecast.Shared/librecast.Shared.vcxitems", + "external/recast/proj.win8.1-universal/librecast.Shared/librecast.Shared.vcxitems.filters", + "external/recast/proj.win8.1-universal/librecast.Windows/librecast.Windows.vcxproj", + "external/recast/proj.win8.1-universal/librecast.Windows/librecast.Windows.vcxproj.filters", + "external/recast/proj.win8.1-universal/librecast.WindowsPhone/librecast.WindowsPhone.vcxproj", + "external/recast/proj.win8.1-universal/librecast.WindowsPhone/librecast.WindowsPhone.vcxproj.filters", "external/sqlite3/Android.mk", "external/sqlite3/include/sqlite3.h", "external/sqlite3/include/sqlite3ext.h", From 33beab2d81623a906b6bb08d03ac7ba3a675f1f4 Mon Sep 17 00:00:00 2001 From: jianglong0156 Date: Fri, 5 Jun 2015 11:40:29 +0800 Subject: [PATCH 28/30] add gzip test --- tests/js-tests/src/XHRTest/XHRTest.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/js-tests/src/XHRTest/XHRTest.js b/tests/js-tests/src/XHRTest/XHRTest.js index 21c1bf5427..eee0ef2bb9 100644 --- a/tests/js-tests/src/XHRTest/XHRTest.js +++ b/tests/js-tests/src/XHRTest/XHRTest.js @@ -103,9 +103,12 @@ var XHRTestLayer = cc.Layer.extend({ streamXHREventsToLabel(xhr, statusGetLabel, responseLabel, "GET"); // 5 seconds for timeout xhr.timeout = 5000; - + + xhr.setRequestHeader("Accept-Encoding","gzip,deflate"); + //set arguments with ?xxx=xxx&yyy=yyy - xhr.open("GET", "http://httpbin.org/get?show_env=1", true); + xhr.open("GET", "http://geek.csdn.net/news/detail/33683", true); + xhr.send(); }, @@ -127,8 +130,8 @@ var XHRTestLayer = cc.Layer.extend({ var xhr = cc.loader.getXMLHttpRequest(); streamXHREventsToLabel(xhr, statusPostLabel, responseLabel, "POST"); - xhr.setRequestHeader("Accept-Encoding","gzip,deflate"); - xhr.open("POST", "http://httpbin.org/post", true); + + xhr.open("POST", "http://httpbin.org/post"); //set Content-type "text/plain;charset=UTF-8" to post plain text xhr.setRequestHeader("Content-Type","text/plain;charset=UTF-8"); From 8d011fd45767e4617b6187b96f24bf3248900d8b Mon Sep 17 00:00:00 2001 From: jianglong0156 Date: Fri, 5 Jun 2015 11:45:05 +0800 Subject: [PATCH 29/30] formate the space --- cocos/network/HttpClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/network/HttpClient.cpp b/cocos/network/HttpClient.cpp index 7f4773671c..8d800bb2ef 100644 --- a/cocos/network/HttpClient.cpp +++ b/cocos/network/HttpClient.cpp @@ -202,7 +202,7 @@ static bool configureCURL(HttpClient* client, CURL* handle, char* errorBuffer) // Document is here: http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTNOSIGNAL curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1L); - curl_easy_setopt(handle, CURLOPT_ACCEPT_ENCODING, ""); + curl_easy_setopt(handle, CURLOPT_ACCEPT_ENCODING, ""); return true; } From 9178eeca738a472b5a4e68a7bdab8abd2e0f6e7b Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Fri, 5 Jun 2015 08:11:21 +0000 Subject: [PATCH 30/30] [ci skip][AUTO]: updating luabinding & jsbinding automatically --- .../api/jsb_cocos2dx_physics3d_auto_api.js | 28 ++-- .../auto/jsb_cocos2dx_physics3d_auto.cpp | 64 ++++---- .../auto/jsb_cocos2dx_physics3d_auto.hpp | 8 +- .../auto/api/Physics3DComponent.lua | 16 +- .../lua-bindings/auto/api/PhysicsSprite3D.lua | 8 +- .../auto/lua_cocos2dx_physics3d_auto.cpp | 138 +++++++++--------- 6 files changed, 131 insertions(+), 131 deletions(-) diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_physics3d_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_physics3d_auto_api.js index db5be29414..b347ba72e3 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_physics3d_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_physics3d_auto_api.js @@ -726,6 +726,14 @@ Physics3DRigidBody : function ( */ cc.Physics3DComponent = { +/** + * @method syncNodeToPhysics + */ +syncNodeToPhysics : function ( +) +{ +}, + /** * @method addToPhysicsWorld * @param {cc.Physics3DWorld} arg0 @@ -737,17 +745,9 @@ physics3dworld }, /** - * @method syncToPhysics + * @method syncPhysicsToNode */ -syncToPhysics : function ( -) -{ -}, - -/** - * @method syncToNode - */ -syncToNode : function ( +syncPhysicsToNode : function ( ) { }, @@ -837,17 +837,17 @@ Physics3DComponent : function ( cc.PhysicsSprite3D = { /** - * @method syncToPhysics + * @method syncNodeToPhysics */ -syncToPhysics : function ( +syncNodeToPhysics : function ( ) { }, /** - * @method syncToNode + * @method syncPhysicsToNode */ -syncToNode : function ( +syncPhysicsToNode : function ( ) { }, diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.cpp index 7fc7723760..34104d96da 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.cpp @@ -1722,6 +1722,22 @@ void js_register_cocos2dx_physics3d_Physics3DRigidBody(JSContext *cx, JS::Handle JSClass *jsb_cocos2d_Physics3DComponent_class; JSObject *jsb_cocos2d_Physics3DComponent_prototype; +bool js_cocos2dx_physics3d_Physics3DComponent_syncNodeToPhysics(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Physics3DComponent* cobj = (cocos2d::Physics3DComponent *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DComponent_syncNodeToPhysics : Invalid Native Object"); + if (argc == 0) { + cobj->syncNodeToPhysics(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_physics3d_Physics3DComponent_syncNodeToPhysics : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_physics3d_Physics3DComponent_addToPhysicsWorld(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1750,36 +1766,20 @@ bool js_cocos2dx_physics3d_Physics3DComponent_addToPhysicsWorld(JSContext *cx, u JS_ReportError(cx, "js_cocos2dx_physics3d_Physics3DComponent_addToPhysicsWorld : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_physics3d_Physics3DComponent_syncToPhysics(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_physics3d_Physics3DComponent_syncPhysicsToNode(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::Physics3DComponent* cobj = (cocos2d::Physics3DComponent *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DComponent_syncToPhysics : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DComponent_syncPhysicsToNode : Invalid Native Object"); if (argc == 0) { - cobj->syncToPhysics(); + cobj->syncPhysicsToNode(); args.rval().setUndefined(); return true; } - JS_ReportError(cx, "js_cocos2dx_physics3d_Physics3DComponent_syncToPhysics : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} -bool js_cocos2dx_physics3d_Physics3DComponent_syncToNode(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Physics3DComponent* cobj = (cocos2d::Physics3DComponent *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_Physics3DComponent_syncToNode : Invalid Native Object"); - if (argc == 0) { - cobj->syncToNode(); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_physics3d_Physics3DComponent_syncToNode : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_physics3d_Physics3DComponent_syncPhysicsToNode : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } bool js_cocos2dx_physics3d_Physics3DComponent_getPhysics3DObject(JSContext *cx, uint32_t argc, jsval *vp) @@ -2061,9 +2061,9 @@ void js_register_cocos2dx_physics3d_Physics3DComponent(JSContext *cx, JS::Handle }; static JSFunctionSpec funcs[] = { + JS_FN("syncNodeToPhysics", js_cocos2dx_physics3d_Physics3DComponent_syncNodeToPhysics, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("addToPhysicsWorld", js_cocos2dx_physics3d_Physics3DComponent_addToPhysicsWorld, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("syncToPhysics", js_cocos2dx_physics3d_Physics3DComponent_syncToPhysics, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("syncToNode", js_cocos2dx_physics3d_Physics3DComponent_syncToNode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("syncPhysicsToNode", js_cocos2dx_physics3d_Physics3DComponent_syncPhysicsToNode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getPhysics3DObject", js_cocos2dx_physics3d_Physics3DComponent_getPhysics3DObject, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setPhysics3DObject", js_cocos2dx_physics3d_Physics3DComponent_setPhysics3DObject, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setSyncFlag", js_cocos2dx_physics3d_Physics3DComponent_setSyncFlag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -2108,36 +2108,36 @@ void js_register_cocos2dx_physics3d_Physics3DComponent(JSContext *cx, JS::Handle JSClass *jsb_cocos2d_PhysicsSprite3D_class; JSObject *jsb_cocos2d_PhysicsSprite3D_prototype; -bool js_cocos2dx_physics3d_PhysicsSprite3D_syncToPhysics(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_physics3d_PhysicsSprite3D_syncNodeToPhysics(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::PhysicsSprite3D* cobj = (cocos2d::PhysicsSprite3D *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_PhysicsSprite3D_syncToPhysics : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_PhysicsSprite3D_syncNodeToPhysics : Invalid Native Object"); if (argc == 0) { - cobj->syncToPhysics(); + cobj->syncNodeToPhysics(); args.rval().setUndefined(); return true; } - JS_ReportError(cx, "js_cocos2dx_physics3d_PhysicsSprite3D_syncToPhysics : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_physics3d_PhysicsSprite3D_syncNodeToPhysics : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_physics3d_PhysicsSprite3D_syncToNode(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_physics3d_PhysicsSprite3D_syncPhysicsToNode(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::PhysicsSprite3D* cobj = (cocos2d::PhysicsSprite3D *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_PhysicsSprite3D_syncToNode : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_physics3d_PhysicsSprite3D_syncPhysicsToNode : Invalid Native Object"); if (argc == 0) { - cobj->syncToNode(); + cobj->syncPhysicsToNode(); args.rval().setUndefined(); return true; } - JS_ReportError(cx, "js_cocos2dx_physics3d_PhysicsSprite3D_syncToNode : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_physics3d_PhysicsSprite3D_syncPhysicsToNode : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } bool js_cocos2dx_physics3d_PhysicsSprite3D_getPhysicsObj(JSContext *cx, uint32_t argc, jsval *vp) @@ -2240,8 +2240,8 @@ void js_register_cocos2dx_physics3d_PhysicsSprite3D(JSContext *cx, JS::HandleObj }; static JSFunctionSpec funcs[] = { - JS_FN("syncToPhysics", js_cocos2dx_physics3d_PhysicsSprite3D_syncToPhysics, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("syncToNode", js_cocos2dx_physics3d_PhysicsSprite3D_syncToNode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("syncNodeToPhysics", js_cocos2dx_physics3d_PhysicsSprite3D_syncNodeToPhysics, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("syncPhysicsToNode", js_cocos2dx_physics3d_PhysicsSprite3D_syncPhysicsToNode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getPhysicsObj", js_cocos2dx_physics3d_PhysicsSprite3D_getPhysicsObj, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setSyncFlag", js_cocos2dx_physics3d_PhysicsSprite3D_setSyncFlag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.hpp index b1986537fc..3fac1aca43 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_physics3d_auto.hpp @@ -103,9 +103,9 @@ bool js_cocos2dx_physics3d_Physics3DComponent_constructor(JSContext *cx, uint32_ void js_cocos2dx_physics3d_Physics3DComponent_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_physics3d_Physics3DComponent(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx_physics3d(JSContext* cx, JS::HandleObject obj); +bool js_cocos2dx_physics3d_Physics3DComponent_syncNodeToPhysics(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_physics3d_Physics3DComponent_addToPhysicsWorld(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_physics3d_Physics3DComponent_syncToPhysics(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_physics3d_Physics3DComponent_syncToNode(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_physics3d_Physics3DComponent_syncPhysicsToNode(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_physics3d_Physics3DComponent_getPhysics3DObject(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_physics3d_Physics3DComponent_setPhysics3DObject(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_physics3d_Physics3DComponent_setSyncFlag(JSContext *cx, uint32_t argc, jsval *vp); @@ -121,8 +121,8 @@ bool js_cocos2dx_physics3d_PhysicsSprite3D_constructor(JSContext *cx, uint32_t a void js_cocos2dx_physics3d_PhysicsSprite3D_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_physics3d_PhysicsSprite3D(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx_physics3d(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_physics3d_PhysicsSprite3D_syncToPhysics(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_physics3d_PhysicsSprite3D_syncToNode(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_physics3d_PhysicsSprite3D_syncNodeToPhysics(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_physics3d_PhysicsSprite3D_syncPhysicsToNode(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_physics3d_PhysicsSprite3D_getPhysicsObj(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_physics3d_PhysicsSprite3D_setSyncFlag(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_physics3d_PhysicsSprite3D_PhysicsSprite3D(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/lua-bindings/auto/api/Physics3DComponent.lua b/cocos/scripting/lua-bindings/auto/api/Physics3DComponent.lua index 794d4e8d61..b1317a9c1e 100644 --- a/cocos/scripting/lua-bindings/auto/api/Physics3DComponent.lua +++ b/cocos/scripting/lua-bindings/auto/api/Physics3DComponent.lua @@ -4,6 +4,12 @@ -- @extend Component -- @parent_module cc +-------------------------------- +-- synchronize node transformation to physics +-- @function [parent=#Physics3DComponent] syncNodeToPhysics +-- @param self +-- @return Physics3DComponent#Physics3DComponent self (return value: cc.Physics3DComponent) + -------------------------------- -- add this component to physics world, called by scene -- @function [parent=#Physics3DComponent] addToPhysicsWorld @@ -12,14 +18,8 @@ -- @return Physics3DComponent#Physics3DComponent self (return value: cc.Physics3DComponent) -------------------------------- --- align node and physics according to physics object --- @function [parent=#Physics3DComponent] syncToPhysics --- @param self --- @return Physics3DComponent#Physics3DComponent self (return value: cc.Physics3DComponent) - --------------------------------- --- align node and physics according to node --- @function [parent=#Physics3DComponent] syncToNode +-- synchronize physics transformation to node +-- @function [parent=#Physics3DComponent] syncPhysicsToNode -- @param self -- @return Physics3DComponent#Physics3DComponent self (return value: cc.Physics3DComponent) diff --git a/cocos/scripting/lua-bindings/auto/api/PhysicsSprite3D.lua b/cocos/scripting/lua-bindings/auto/api/PhysicsSprite3D.lua index 5352649b57..7c049e512c 100644 --- a/cocos/scripting/lua-bindings/auto/api/PhysicsSprite3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/PhysicsSprite3D.lua @@ -5,14 +5,14 @@ -- @parent_module cc -------------------------------- --- Physics synchronize rendering. --- @function [parent=#PhysicsSprite3D] syncToPhysics +-- synchronize node transformation to physics. +-- @function [parent=#PhysicsSprite3D] syncNodeToPhysics -- @param self -- @return PhysicsSprite3D#PhysicsSprite3D self (return value: cc.PhysicsSprite3D) -------------------------------- --- Rendering synchronize physics. --- @function [parent=#PhysicsSprite3D] syncToNode +-- synchronize physics transformation to node. +-- @function [parent=#PhysicsSprite3D] syncPhysicsToNode -- @param self -- @return PhysicsSprite3D#PhysicsSprite3D self (return value: cc.PhysicsSprite3D) diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics3d_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics3d_auto.cpp index 150b475c9e..115ba9609f 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics3d_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics3d_auto.cpp @@ -3337,6 +3337,53 @@ int lua_register_cocos2dx_physics3d_Physics3DRigidBody(lua_State* tolua_S) return 1; } +int lua_cocos2dx_physics3d_Physics3DComponent_syncNodeToPhysics(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Physics3DComponent* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Physics3DComponent",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Physics3DComponent*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics3d_Physics3DComponent_syncNodeToPhysics'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics3d_Physics3DComponent_syncNodeToPhysics'", nullptr); + return 0; + } + cobj->syncNodeToPhysics(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Physics3DComponent:syncNodeToPhysics",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics3d_Physics3DComponent_syncNodeToPhysics'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_physics3d_Physics3DComponent_addToPhysicsWorld(lua_State* tolua_S) { int argc = 0; @@ -3387,7 +3434,7 @@ int lua_cocos2dx_physics3d_Physics3DComponent_addToPhysicsWorld(lua_State* tolua return 0; } -int lua_cocos2dx_physics3d_Physics3DComponent_syncToPhysics(lua_State* tolua_S) +int lua_cocos2dx_physics3d_Physics3DComponent_syncPhysicsToNode(lua_State* tolua_S) { int argc = 0; cocos2d::Physics3DComponent* cobj = nullptr; @@ -3407,7 +3454,7 @@ int lua_cocos2dx_physics3d_Physics3DComponent_syncToPhysics(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics3d_Physics3DComponent_syncToPhysics'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics3d_Physics3DComponent_syncPhysicsToNode'", nullptr); return 0; } #endif @@ -3417,66 +3464,19 @@ int lua_cocos2dx_physics3d_Physics3DComponent_syncToPhysics(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics3d_Physics3DComponent_syncToPhysics'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics3d_Physics3DComponent_syncPhysicsToNode'", nullptr); return 0; } - cobj->syncToPhysics(); + cobj->syncPhysicsToNode(); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Physics3DComponent:syncToPhysics",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Physics3DComponent:syncPhysicsToNode",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics3d_Physics3DComponent_syncToPhysics'.",&tolua_err); -#endif - - return 0; -} -int lua_cocos2dx_physics3d_Physics3DComponent_syncToNode(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Physics3DComponent* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.Physics3DComponent",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Physics3DComponent*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics3d_Physics3DComponent_syncToNode'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 0) - { - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics3d_Physics3DComponent_syncToNode'", nullptr); - return 0; - } - cobj->syncToNode(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Physics3DComponent:syncToNode",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics3d_Physics3DComponent_syncToNode'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics3d_Physics3DComponent_syncPhysicsToNode'.",&tolua_err); #endif return 0; @@ -3712,9 +3712,9 @@ int lua_register_cocos2dx_physics3d_Physics3DComponent(lua_State* tolua_S) tolua_beginmodule(tolua_S,"Physics3DComponent"); tolua_function(tolua_S,"new",lua_cocos2dx_physics3d_Physics3DComponent_constructor); + tolua_function(tolua_S,"syncNodeToPhysics",lua_cocos2dx_physics3d_Physics3DComponent_syncNodeToPhysics); tolua_function(tolua_S,"addToPhysicsWorld",lua_cocos2dx_physics3d_Physics3DComponent_addToPhysicsWorld); - tolua_function(tolua_S,"syncToPhysics",lua_cocos2dx_physics3d_Physics3DComponent_syncToPhysics); - tolua_function(tolua_S,"syncToNode",lua_cocos2dx_physics3d_Physics3DComponent_syncToNode); + tolua_function(tolua_S,"syncPhysicsToNode",lua_cocos2dx_physics3d_Physics3DComponent_syncPhysicsToNode); tolua_function(tolua_S,"getPhysics3DObject",lua_cocos2dx_physics3d_Physics3DComponent_getPhysics3DObject); tolua_function(tolua_S,"setPhysics3DObject",lua_cocos2dx_physics3d_Physics3DComponent_setPhysics3DObject); tolua_function(tolua_S,"setSyncFlag",lua_cocos2dx_physics3d_Physics3DComponent_setSyncFlag); @@ -3726,7 +3726,7 @@ int lua_register_cocos2dx_physics3d_Physics3DComponent(lua_State* tolua_S) return 1; } -int lua_cocos2dx_physics3d_PhysicsSprite3D_syncToPhysics(lua_State* tolua_S) +int lua_cocos2dx_physics3d_PhysicsSprite3D_syncNodeToPhysics(lua_State* tolua_S) { int argc = 0; cocos2d::PhysicsSprite3D* cobj = nullptr; @@ -3746,7 +3746,7 @@ int lua_cocos2dx_physics3d_PhysicsSprite3D_syncToPhysics(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics3d_PhysicsSprite3D_syncToPhysics'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics3d_PhysicsSprite3D_syncNodeToPhysics'", nullptr); return 0; } #endif @@ -3756,24 +3756,24 @@ int lua_cocos2dx_physics3d_PhysicsSprite3D_syncToPhysics(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics3d_PhysicsSprite3D_syncToPhysics'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics3d_PhysicsSprite3D_syncNodeToPhysics'", nullptr); return 0; } - cobj->syncToPhysics(); + cobj->syncNodeToPhysics(); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PhysicsSprite3D:syncToPhysics",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PhysicsSprite3D:syncNodeToPhysics",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics3d_PhysicsSprite3D_syncToPhysics'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics3d_PhysicsSprite3D_syncNodeToPhysics'.",&tolua_err); #endif return 0; } -int lua_cocos2dx_physics3d_PhysicsSprite3D_syncToNode(lua_State* tolua_S) +int lua_cocos2dx_physics3d_PhysicsSprite3D_syncPhysicsToNode(lua_State* tolua_S) { int argc = 0; cocos2d::PhysicsSprite3D* cobj = nullptr; @@ -3793,7 +3793,7 @@ int lua_cocos2dx_physics3d_PhysicsSprite3D_syncToNode(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics3d_PhysicsSprite3D_syncToNode'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics3d_PhysicsSprite3D_syncPhysicsToNode'", nullptr); return 0; } #endif @@ -3803,19 +3803,19 @@ int lua_cocos2dx_physics3d_PhysicsSprite3D_syncToNode(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics3d_PhysicsSprite3D_syncToNode'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics3d_PhysicsSprite3D_syncPhysicsToNode'", nullptr); return 0; } - cobj->syncToNode(); + cobj->syncPhysicsToNode(); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PhysicsSprite3D:syncToNode",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PhysicsSprite3D:syncPhysicsToNode",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics3d_PhysicsSprite3D_syncToNode'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics3d_PhysicsSprite3D_syncPhysicsToNode'.",&tolua_err); #endif return 0; @@ -3967,8 +3967,8 @@ int lua_register_cocos2dx_physics3d_PhysicsSprite3D(lua_State* tolua_S) tolua_beginmodule(tolua_S,"PhysicsSprite3D"); tolua_function(tolua_S,"new",lua_cocos2dx_physics3d_PhysicsSprite3D_constructor); - tolua_function(tolua_S,"syncToPhysics",lua_cocos2dx_physics3d_PhysicsSprite3D_syncToPhysics); - tolua_function(tolua_S,"syncToNode",lua_cocos2dx_physics3d_PhysicsSprite3D_syncToNode); + tolua_function(tolua_S,"syncNodeToPhysics",lua_cocos2dx_physics3d_PhysicsSprite3D_syncNodeToPhysics); + tolua_function(tolua_S,"syncPhysicsToNode",lua_cocos2dx_physics3d_PhysicsSprite3D_syncPhysicsToNode); tolua_function(tolua_S,"getPhysicsObj",lua_cocos2dx_physics3d_PhysicsSprite3D_getPhysicsObj); tolua_function(tolua_S,"setSyncFlag",lua_cocos2dx_physics3d_PhysicsSprite3D_setSyncFlag); tolua_endmodule(tolua_S);