diff --git a/.travis.yml b/.travis.yml index 1bccfbf9d6..c83427e85b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,4 +37,4 @@ before_install: # whitelist branches: only: - - v3 + - v3.10 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d4e896e89..ac89a870bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ endif() project (Cocos2d-X) # The version number -set(COCOS2D_X_VERSION 3.9) +set(COCOS2D_X_VERSION 3.10) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules/") include(CocosBuildHelpers) diff --git a/cocos/2d/CCClippingNode.cpp b/cocos/2d/CCClippingNode.cpp index 8557203765..2f7db66030 100644 --- a/cocos/2d/CCClippingNode.cpp +++ b/cocos/2d/CCClippingNode.cpp @@ -67,6 +67,7 @@ ClippingNode::~ClippingNode() _stencil->stopAllActions(); _stencil->release(); } + CC_SAFE_DELETE(_stencilStateManager); } ClippingNode* ClippingNode::create() diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index e69ca8bef4..aca0370997 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -606,9 +606,7 @@ bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& ima FontFNT *bmFont = (FontFNT*)newAtlas->getFont(); if (bmFont) { float originalFontSize = bmFont->getOriginalFontSize(); - if(fabs(_bmFontSize+1) < FLT_EPSILON){ - _bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR(); - } + _bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR(); } } @@ -1037,10 +1035,10 @@ void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = -1 */ _effectColorF.g = outlineColor.g / 255.f; _effectColorF.b = outlineColor.b / 255.f; _effectColorF.a = outlineColor.a / 255.f; - _outlineSize = outlineSize; _currLabelEffect = LabelEffect::OUTLINE; _contentDirty = true; } + _outlineSize = outlineSize; } } diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index 0b58ecf1c0..b2a9f7d1f4 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -349,6 +349,41 @@ public: */ virtual void disableEffect(LabelEffect effect); + /** + * Return whether the shadow effect is enabled. + */ + bool isShadowEnabled() const { return _shadowEnabled; } + + /** + * Return shadow effect offset value. + */ + Size getShadowOffset() const { return _shadowOffset; } + + /** + * Return the shadow effect blur radius. + */ + float getShadowBlurRadius() const { return _shadowBlurRadius; } + + /** + * Return the shadow effect color value. + */ + Color4F getShadowColor() const { return _shadowColor4F; } + + /** + * Return the outline effect size value. + */ + int getOutlineSize() const { return _outlineSize; } + + /** + * Return current effect type. + */ + LabelEffect getLabelEffectType() const { return _currLabelEffect; } + + /** + * Return current effect color vlaue. + */ + Color4F getEffectColor() const { return _effectColorF; } + /** Sets the Label's text horizontal alignment.*/ void setAlignment(TextHAlignment hAlignment) { setAlignment(hAlignment,_vAlignment);} diff --git a/cocos/2d/CCMenuItem.cpp b/cocos/2d/CCMenuItem.cpp index b4695d01d3..ef446b0e02 100644 --- a/cocos/2d/CCMenuItem.cpp +++ b/cocos/2d/CCMenuItem.cpp @@ -104,14 +104,6 @@ void MenuItem::activate() { _callback(this); } -#if CC_ENABLE_SCRIPT_BINDING - if (kScriptTypeNone != _scriptType) - { - BasicScriptData data(this); - ScriptEvent scriptEvent(kMenuClickedEvent,&data); - ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent); - } -#endif } } diff --git a/cocos/3d/CCMesh.cpp b/cocos/3d/CCMesh.cpp index 4a9a347abb..3ed8cae596 100644 --- a/cocos/3d/CCMesh.cpp +++ b/cocos/3d/CCMesh.cpp @@ -133,7 +133,6 @@ Mesh::Mesh() , _blendDirty(true) , _force2DQueue(false) , _texFile("") -, _enableCheckTexture(false) { } @@ -282,7 +281,7 @@ void Mesh::setTexture(Texture2D* tex) setTexture(tex, NTextureData::Usage::Diffuse); } -void Mesh::setTexture(Texture2D* tex, NTextureData::Usage usage) +void Mesh::setTexture(Texture2D* tex, NTextureData::Usage usage, bool cacheFileName) { // Texture must be saved for future use // it doesn't matter if the material is already set or not @@ -307,7 +306,8 @@ void Mesh::setTexture(Texture2D* tex, NTextureData::Usage usage) } bindMeshCommand(); - _texFile = tex->getPath(); + if (cacheFileName) + _texFile = tex->getPath(); } else if (usage == NTextureData::Usage::Normal) // currently only diffuse and normal are supported { @@ -382,9 +382,6 @@ void Mesh::draw(Renderer* renderer, float globalZOrder, const Mat4& transform, u if (isTransparent) flags |= Node::FLAGS_RENDER_AS_3D; - if (_enableCheckTexture) - this->checkTexture(); - _meshCommand.init(globalZ, _material, getVertexBuffer(), @@ -706,39 +703,4 @@ GLuint Mesh::getIndexBuffer() const { return _meshIndexData->getIndexBuffer()->getVBO(); } - -void Mesh::checkTexture() -{ - Texture2D* cacheTex = nullptr; - auto& texture = _textures[NTextureData::Usage::Diffuse]; - if (Director::getInstance()->getTextureCache()->isDirty()) - { - cacheTex = Director::getInstance()->getTextureCache()->getTextureForKey(_texFile); - if (cacheTex == nullptr) - { - cacheTex = getDummyTexture(); - } - } - else if (texture != nullptr && !texture->isValid()) - { - cacheTex = getDummyTexture(); - } - - if (cacheTex != nullptr && texture != cacheTex) - { - CC_SAFE_RETAIN(cacheTex); - CC_SAFE_RELEASE(texture); - texture = cacheTex; - - if (_material) { - auto technique = _material->_currentTechnique; - for (auto& pass : technique->_passes) - { - pass->setTexture(texture); - } - } - bindMeshCommand(); - } -} - NS_CC_END diff --git a/cocos/3d/CCMesh.h b/cocos/3d/CCMesh.h index c9ccd792b9..f8019011e6 100644 --- a/cocos/3d/CCMesh.h +++ b/cocos/3d/CCMesh.h @@ -109,8 +109,9 @@ public: * set texture * @param tex texture to be set * @param usage Usage of this texture + * @param whether refresh the cache file name */ - void setTexture(Texture2D* tex, NTextureData::Usage usage); + void setTexture(Texture2D* tex, NTextureData::Usage usage,bool cacheFileName = true); /** * set texture * @param texPath texture path @@ -224,19 +225,7 @@ public: */ void setForce2DQueue(bool force2D) { _force2DQueue = force2D; } - /** - * check texture - */ - void checkTexture(); - - /** - * set enable check texture, check texture each frame if enable is true. It is false by default - */ - void setEnableCheckTexture(bool enableCheckTexture) { _enableCheckTexture = enableCheckTexture; } - /** - * check texture each frame? - */ - bool enableCheckTexture() const { return _enableCheckTexture; } + std::string getTextureFileName(){ return _texFile; } CC_CONSTRUCTOR_ACCESS: @@ -280,7 +269,6 @@ protected: std::vector _spotLightUniformRangeInverseValues; std::string _texFile; - bool _enableCheckTexture; }; // end of 3d group diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp index 43e5aef68b..b7a3bb8635 100644 --- a/cocos/base/CCDirector.cpp +++ b/cocos/base/CCDirector.cpp @@ -328,9 +328,6 @@ void Director::drawScene() { calculateMPF(); } - - if (_textureCache != nullptr) - _textureCache->setDirty(false); } void Director::calculateDeltaTime() diff --git a/cocos/base/CCRef.cpp b/cocos/base/CCRef.cpp index 59215c5738..eed860e602 100644 --- a/cocos/base/CCRef.cpp +++ b/cocos/base/CCRef.cpp @@ -50,6 +50,7 @@ Ref::Ref() , _scriptObject(nullptr) , _rooted(false) , _scriptOwned(false) +,_referenceCountAtRootTime(0) #endif { #if CC_ENABLE_SCRIPT_BINDING @@ -64,7 +65,7 @@ Ref::Ref() Ref::~Ref() { -#if CC_ENABLE_SCRIPT_BINDING +#if CC_ENABLE_SCRIPT_BINDING && not CC_ENABLE_GC_FOR_NATIVE_OBJECTS // if the object is referenced by Lua engine, remove it if (_luaID) { @@ -93,13 +94,13 @@ void Ref::retain() ++_referenceCount; #if CC_ENABLE_SCRIPT_BINDING && CC_ENABLE_GC_FOR_NATIVE_OBJECTS - if (!_rooted && _scriptOwned) + if (_scriptOwned && !_rooted) { auto scriptMgr = ScriptEngineManager::getInstance()->getScriptEngine(); if (scriptMgr && scriptMgr->getScriptType() == kScriptTypeJavascript) { + _referenceCountAtRootTime = _referenceCount-1; scriptMgr->rootObject(this); - _rooted = true; } } #endif // CC_ENABLE_SCRIPT_BINDING @@ -111,13 +112,12 @@ void Ref::release() --_referenceCount; #if CC_ENABLE_SCRIPT_BINDING && CC_ENABLE_GC_FOR_NATIVE_OBJECTS - if (_scriptOwned && _referenceCount==1 && _rooted) + if (_scriptOwned && _rooted && _referenceCount==/*_referenceCountAtRootTime*/ 1) { auto scriptMgr = ScriptEngineManager::getInstance()->getScriptEngine(); if (scriptMgr && scriptMgr->getScriptType() == kScriptTypeJavascript) { scriptMgr->unrootObject(this); - _rooted = false; } } #endif // CC_ENABLE_SCRIPT_BINDING diff --git a/cocos/base/CCRef.h b/cocos/base/CCRef.h index 5ca40a0c9e..4451243ae1 100644 --- a/cocos/base/CCRef.h +++ b/cocos/base/CCRef.h @@ -161,6 +161,7 @@ public: When true, it means that the object was already rooted. */ bool _rooted; + unsigned int _referenceCountAtRootTime; /** * The life of the object is scrolled by the scripting engine. diff --git a/cocos/cocos2d.h b/cocos/cocos2d.h index 1f3a539d2c..d9e52296a0 100644 --- a/cocos/cocos2d.h +++ b/cocos/cocos2d.h @@ -30,7 +30,7 @@ THE SOFTWARE. // 0x00 HI ME LO // 00 03 08 00 -#define COCOS2D_VERSION 0x00030900 +#define COCOS2D_VERSION 0x00031000 // // all cocos2d include files diff --git a/cocos/network/Android.mk b/cocos/network/Android.mk index 835af9b73b..7278fda31a 100644 --- a/cocos/network/Android.mk +++ b/cocos/network/Android.mk @@ -11,7 +11,7 @@ WebSocket.cpp \ CCDownloader.cpp \ CCDownloader-android.cpp -LOCAL_EXPORT_C_INCLUDES := +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../external/curl/include/android \ $(LOCAL_PATH)/../../external/websockets/include/android diff --git a/cocos/network/CCDownloader-apple.mm b/cocos/network/CCDownloader-apple.mm index e759aa70b4..e1eeea6eed 100644 --- a/cocos/network/CCDownloader-apple.mm +++ b/cocos/network/CCDownloader-apple.mm @@ -25,6 +25,7 @@ #include "network/CCDownloader-apple.h" #include "network/CCDownloader.h" +#include "CCString.h" #include //////////////////////////////////////////////////////////////////////////////// @@ -388,7 +389,8 @@ namespace cocos2d { namespace network { if(_outer) { - if(error) { + if(error) + { std::vector buf; // just a placeholder _outer->onTaskFinish(*[wrapper get], cocos2d::network::DownloadTask::ERROR_IMPL_INTERNAL, @@ -396,24 +398,41 @@ namespace cocos2d { namespace network { [error.localizedDescription cStringUsingEncoding:NSUTF8StringEncoding], buf); } - else if(![wrapper get]->storagePath.length()) { + else if (![wrapper get]->storagePath.length()) + { // call onTaskFinish for a data task // (for a file download task, callback is called in didFinishDownloadingToURL) std::string errorString; - + const int64_t buflen = [wrapper totalBytesReceived]; char buf[buflen]; - [wrapper transferDataToBuffer:buf lengthOfBuffer:buflen]; - std::vector data(buf, buf + buflen); _outer->onTaskFinish(*[wrapper get], cocos2d::network::DownloadTask::ERROR_NO_ERROR, - 0, + 0, errorString, data); } + else + { + NSInteger statusCode = ((NSHTTPURLResponse*)task.response).statusCode; + + // Check for error status code + if (statusCode >= 400) + { + std::vector buf; // just a placeholder + const char *orignalURL = [task.originalRequest.URL.absoluteString cStringUsingEncoding:NSUTF8StringEncoding]; + std::string errorMessage = cocos2d::StringUtils::format("Downloader: Failed to download %s with status code (%d)", orignalURL, (int)statusCode); + + _outer->onTaskFinish(*[wrapper get], + cocos2d::network::DownloadTask::ERROR_IMPL_INTERNAL, + 0, + errorMessage, + buf); + } + } } [self.taskDict removeObjectForKey:task]; [wrapper release]; @@ -510,12 +529,21 @@ namespace cocos2d { namespace network { return; } + // On iOS 9 a response with status code 4xx(Client Error) or 5xx(Server Error) + // might end up calling this delegate method, saving the error message to the storage path + // and treating this download task as a successful one, so we need to check the status code here + NSInteger statusCode = ((NSHTTPURLResponse*)downloadTask.response).statusCode; + if (statusCode >= 400) + { + return; + } + DownloadTaskWrapper *wrapper = [self.taskDict objectForKey:downloadTask]; const char * storagePath = [wrapper get]->storagePath.c_str(); NSString *destPath = [NSString stringWithUTF8String:storagePath]; NSFileManager *fileManager = [NSFileManager defaultManager]; NSURL *destURL = nil; - + do { if ([destPath hasPrefix:@"file://"]) diff --git a/cocos/network/WebSocket.cpp b/cocos/network/WebSocket.cpp index fdac3e435a..9bb943d086 100644 --- a/cocos/network/WebSocket.cpp +++ b/cocos/network/WebSocket.cpp @@ -248,9 +248,12 @@ WebSocket::~WebSocket() close(); CC_SAFE_RELEASE_NULL(_wsHelper); - for (int i = 0; _wsProtocols[i].callback != nullptr; ++i) + if(_wsProtocols) { - CC_SAFE_DELETE_ARRAY(_wsProtocols[i].name); + for (int i = 0; _wsProtocols[i].callback != nullptr; ++i) + { + CC_SAFE_DELETE_ARRAY(_wsProtocols[i].name); + } } CC_SAFE_DELETE_ARRAY(_wsProtocols); } diff --git a/cocos/platform/ios/CCEAGLView-ios.mm b/cocos/platform/ios/CCEAGLView-ios.mm index eb4947bd5f..89894b21c9 100644 --- a/cocos/platform/ios/CCEAGLView-ios.mm +++ b/cocos/platform/ios/CCEAGLView-ios.mm @@ -427,8 +427,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. ids[i] = touch; xs[i] = [touch locationInView: [touch view]].x * self.contentScaleFactor;; ys[i] = [touch locationInView: [touch view]].y * self.contentScaleFactor;; - -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 // Use 9.0 or higher SDK to compile +#ifdef __IPHONE_9_0 && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0 // running on iOS 9.0 or higher version if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0f) { fs[i] = touch.force; diff --git a/cocos/renderer/CCTexture2D.h b/cocos/renderer/CCTexture2D.h index ced2f2e596..c88dbe7fe7 100644 --- a/cocos/renderer/CCTexture2D.h +++ b/cocos/renderer/CCTexture2D.h @@ -406,10 +406,6 @@ public: /** Get a shader program from the texture.*/ GLProgram* getGLProgram() const; - /** Set if the texture is valid, when it been set as false, it will display as default "file missing texture" */ - void setValid(bool valid) { _valid = valid; } - - bool isValid() const { return _valid; } std::string getPath()const { return _filePath; } public: diff --git a/cocos/renderer/CCTextureCache.cpp b/cocos/renderer/CCTextureCache.cpp index fc7f950f48..b50028f884 100644 --- a/cocos/renderer/CCTextureCache.cpp +++ b/cocos/renderer/CCTextureCache.cpp @@ -59,7 +59,6 @@ TextureCache::TextureCache() : _loadingThread(nullptr) , _needQuit(false) , _asyncRefCount(0) -, _dirty(false) { } @@ -496,8 +495,7 @@ void TextureCache::removeTexture(Texture2D* texture) for( auto it=_textures.cbegin(); it!=_textures.cend(); /* nothing */ ) { if( it->second == texture ) { - texture->setValid(false); - texture->autorelease(); + it->second->release(); _textures.erase(it++); break; } else @@ -516,8 +514,7 @@ void TextureCache::removeTextureForKey(const std::string &textureKeyName) } if( it != _textures.end() ) { - it->second->setValid(false); - (it->second)->autorelease(); + it->second->release(); _textures.erase(it); } } @@ -626,7 +623,6 @@ void TextureCache::renameTextureWithKey(const std::string srcName, const std::st tex->initWithImage(image); _textures.insert(std::make_pair(fullpath, tex)); _textures.erase(it); - this->setDirty(true); } CC_SAFE_DELETE(image); } diff --git a/cocos/renderer/CCTextureCache.h b/cocos/renderer/CCTextureCache.h index d592a632de..0a5ee7586d 100644 --- a/cocos/renderer/CCTextureCache.h +++ b/cocos/renderer/CCTextureCache.h @@ -204,9 +204,6 @@ public: */ const std::string getTextureFilePath(Texture2D* texture)const; - void setDirty(bool dirty) { _dirty = dirty; } - bool isDirty() const { return _dirty; } - /** Reload texture from a new file. * This function is mainly for editor, won't suggest use it in game for performance reason. * @@ -242,8 +239,6 @@ protected: int _asyncRefCount; std::unordered_map _textures; - - bool _dirty; }; #if CC_ENABLE_CACHE_TEXTURE_DATA diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_auto_api.js index 319d1a4b8e..25ae6f026b 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_auto_api.js @@ -448,16 +448,6 @@ getVertexSizeInBytes : function ( return 0; }, -/** - * @method enableCheckTexture - * @return {bool} - */ -enableCheckTexture : function ( -) -{ - return false; -}, - /** * @method setMaterial * @param {cc.Material} arg0 @@ -558,14 +548,6 @@ str { }, -/** - * @method checkTexture - */ -checkTexture : function ( -) -{ -}, - /** * @method getIndexCount * @return {long} @@ -636,16 +618,6 @@ meshskin { }, -/** - * @method setEnableCheckTexture - * @param {bool} arg0 - */ -setEnableCheckTexture : function ( -bool -) -{ -}, - /** * @method isVisible * @return {bool} diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_extension_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_extension_auto_api.js index a8e7c2e3d9..214bb30c4e 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_extension_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_3d_extension_auto_api.js @@ -34,6 +34,16 @@ isEnabled : function ( return false; }, +/** + * @method getRender + * @return {cc.Particle3DRender} + */ +getRender : function ( +) +{ + return cc.Particle3DRender; +}, + /** * @method isKeepLocal * @return {bool} 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 626f1990b7..cbb9e82ad3 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 @@ -120,16 +120,6 @@ getPixelsHigh : function ( return 0; }, -/** - * @method setValid - * @param {bool} arg0 - */ -setValid : function ( -bool -) -{ -}, - /** * @method getBitsPerPixelForFormat * @param {cc.Texture2D::PixelFormat} pixelformat @@ -214,16 +204,6 @@ getContentSize : function ( return cc.Size; }, -/** - * @method isValid - * @return {bool} - */ -isValid : function ( -) -{ - return false; -}, - /** * @method setAliasTexParameters */ @@ -12011,6 +11991,16 @@ float { }, +/** + * @method getWidth + * @return {float} + */ +getWidth : function ( +) +{ + return 0; +}, + /** * @method getString * @return {String} @@ -12081,6 +12071,16 @@ float { }, +/** + * @method getAdditionalKerning + * @return {float} + */ +getAdditionalKerning : function ( +) +{ + return 0; +}, + /** * @method getBMFontSize * @return {float} @@ -12111,6 +12111,16 @@ getHorizontalAlignment : function ( return 0; }, +/** + * @method getShadowOffset + * @return {size_object} + */ +getShadowOffset : function ( +) +{ + return cc.Size; +}, + /** * @method setClipMarginEnabled * @param {bool} arg0 @@ -12141,6 +12151,16 @@ str { }, +/** + * @method getOutlineSize + * @return {int} + */ +getOutlineSize : function ( +) +{ + return 0; +}, + /** * @method setBMFontFilePath * @param {String} arg0 @@ -12270,15 +12290,25 @@ int }, /** - * @method getAdditionalKerning + * @method getShadowBlurRadius * @return {float} */ -getAdditionalKerning : function ( +getShadowBlurRadius : function ( ) { return 0; }, +/** + * @method getEffectColor + * @return {color4f_object} + */ +getEffectColor : function ( +) +{ + return cc.Color4F; +}, + /** * @method removeAllChildrenWithCleanup * @param {bool} arg0 @@ -12367,6 +12397,16 @@ getLineHeight : function ( return 0; }, +/** + * @method getShadowColor + * @return {color4f_object} + */ +getShadowColor : function ( +) +{ + return cc.Color4F; +}, + /** * @method getTTFConfig * @return {cc._ttfConfig} @@ -12420,13 +12460,13 @@ float }, /** - * @method getWidth - * @return {float} + * @method isShadowEnabled + * @return {bool} */ -getWidth : function ( +isShadowEnabled : function ( ) { - return 0; + return false; }, /** @@ -12519,6 +12559,16 @@ isWrapEnabled : function ( return false; }, +/** + * @method getLabelEffectType + * @return {cc.LabelEffect} + */ +getLabelEffectType : function ( +) +{ + return 0; +}, + /** * @method setAlignment * @param {cc.TextHAlignment|cc.TextHAlignment} texthalignment @@ -21102,16 +21152,6 @@ texture2d return ; }, -/** - * @method setDirty - * @param {bool} arg0 - */ -setDirty : function ( -bool -) -{ -}, - /** * @method renameTextureWithKey * @param {String} arg0 @@ -21132,16 +21172,6 @@ removeUnusedTextures : function ( { }, -/** - * @method isDirty - * @return {bool} - */ -isDirty : function ( -) -{ - return false; -}, - /** * @method removeTexture * @param {cc.Texture2D} arg0 @@ -23463,27 +23493,4 @@ getInstance : function ( */ cc.ComponentJS = { -/** - * @method create - * @param {String} arg0 - * @return {cc.ComponentJS} - */ -create : function ( -str -) -{ - return cc.ComponentJS; -}, - -/** - * @method ComponentJS - * @constructor - * @param {String} arg0 - */ -ComponentJS : function ( -str -) -{ -}, - }; diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_extension_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_extension_auto_api.js index 89a1e3796d..1f7b45a4a4 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_extension_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_extension_auto_api.js @@ -548,11 +548,13 @@ getCurrentTitle : function( * @method initWithLabelAndBackgroundSprite * @param {cc.Node} arg0 * @param {ccui.Scale9Sprite} arg1 + * @param {bool} arg2 * @return {bool} */ initWithLabelAndBackgroundSprite : function ( node, -scale9sprite +scale9sprite, +bool ) { return false; @@ -582,15 +584,15 @@ state /** * @method create -* @param {ccui.Scale9Sprite|cc.Node|String} scale9sprite -* @param {ccui.Scale9Sprite|String} scale9sprite -* @param {float} float -* @return {cc.ControlButton|cc.ControlButton|cc.ControlButton|cc.ControlButton} +* @param {ccui.Scale9Sprite|cc.Node|String|cc.Node} scale9sprite +* @param {ccui.Scale9Sprite|String|ccui.Scale9Sprite} scale9sprite +* @param {float|bool} float +* @return {cc.ControlButton|cc.ControlButton|cc.ControlButton|cc.ControlButton|cc.ControlButton} */ create : function( -str, -str, -float +node, +scale9sprite, +bool ) { return cc.ControlButton; diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js index 52354effc2..8c363ebb3e 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js @@ -2383,6 +2383,16 @@ labeleffect { }, +/** + * @method getLabelEffectType + * @return {cc.LabelEffect} + */ +getLabelEffectType : function ( +) +{ + return 0; +}, + /** * @method getTextColor * @return {color4b_object} @@ -2423,6 +2433,16 @@ bool { }, +/** + * @method getShadowOffset + * @return {size_object} + */ +getShadowOffset : function ( +) +{ + return cc.Size; +}, + /** * @method setString * @param {String} arg0 @@ -2433,6 +2453,16 @@ str { }, +/** + * @method getOutlineSize + * @return {int} + */ +getOutlineSize : function ( +) +{ + return 0; +}, + /** * @method init * @param {String} arg0 @@ -2449,6 +2479,16 @@ float return false; }, +/** + * @method getShadowBlurRadius + * @return {float} + */ +getShadowBlurRadius : function ( +) +{ + return 0; +}, + /** * @method isTouchScaleChangeEnabled * @return {bool} @@ -2511,6 +2551,16 @@ int { }, +/** + * @method getEffectColor + * @return {color4b_object} + */ +getEffectColor : function ( +) +{ + return cc.Color4B; +}, + /** * @method getType * @return {ccui.Text::Type} @@ -2531,6 +2581,16 @@ getTextHorizontalAlignment : function ( return 0; }, +/** + * @method isShadowEnabled + * @return {bool} + */ +isShadowEnabled : function ( +) +{ + return false; +}, + /** * @method setFontSize * @param {float} arg0 @@ -2541,6 +2601,16 @@ float { }, +/** + * @method getShadowColor + * @return {color4b_object} + */ +getShadowColor : function ( +) +{ + return cc.Color4B; +}, + /** * @method setTextColor * @param {color4b_object} arg0 @@ -3803,16 +3873,6 @@ getBallNormalFile : function ( return cc.ResourceData; }, -/** - * @method getCapInsetsProgressBarRebderer - * @return {rect_object} - */ -getCapInsetsProgressBarRebderer : function ( -) -{ - return cc.Rect; -}, - /** * @method setScale9Enabled * @param {bool} arg0 @@ -3843,6 +3903,16 @@ getZoomScale : function ( return 0; }, +/** + * @method setCapInsetProgressBarRenderer + * @param {rect_object} arg0 + */ +setCapInsetProgressBarRenderer : function ( +rect +) +{ +}, + /** * @method loadSlidBallTextures * @param {String} arg0 @@ -3911,6 +3981,16 @@ getCapInsetsBarRenderer : function ( return cc.Rect; }, +/** + * @method getCapInsetsProgressBarRenderer + * @return {rect_object} + */ +getCapInsetsProgressBarRenderer : function ( +) +{ + return cc.Rect; +}, + /** * @method loadSlidBallTexturePressed * @param {String} arg0 @@ -3953,16 +4033,6 @@ getBallDisabledFile : function ( return cc.ResourceData; }, -/** - * @method setCapInsetProgressBarRebderer - * @param {rect_object} arg0 - */ -setCapInsetProgressBarRebderer : function ( -rect -) -{ -}, - /** * @method setCapInsetsBarRenderer * @param {rect_object} arg0 diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.cpp index e429e644be..a3bd9eff57 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.cpp @@ -1232,24 +1232,6 @@ bool js_cocos2dx_3d_Mesh_getVertexSizeInBytes(JSContext *cx, uint32_t argc, jsva JS_ReportError(cx, "js_cocos2dx_3d_Mesh_getVertexSizeInBytes : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_3d_Mesh_enableCheckTexture(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_enableCheckTexture : Invalid Native Object"); - if (argc == 0) { - bool ret = cobj->enableCheckTexture(); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_3d_Mesh_enableCheckTexture : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_3d_Mesh_setMaterial(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1452,22 +1434,6 @@ bool js_cocos2dx_3d_Mesh_setName(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setName : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_3d_Mesh_checkTexture(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_checkTexture : Invalid Native Object"); - if (argc == 0) { - cobj->checkTexture(); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_3d_Mesh_checkTexture : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_3d_Mesh_getIndexCount(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1618,26 +1584,6 @@ bool js_cocos2dx_3d_Mesh_setSkin(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setSkin : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_3d_Mesh_setEnableCheckTexture(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setEnableCheckTexture : Invalid Native Object"); - if (argc == 1) { - bool arg0; - arg0 = JS::ToBoolean(args.get(0)); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Mesh_setEnableCheckTexture : Error processing arguments"); - cobj->setEnableCheckTexture(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setEnableCheckTexture : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_3d_Mesh_isVisible(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -1761,7 +1707,6 @@ void js_register_cocos2dx_3d_Mesh(JSContext *cx, JS::HandleObject global) { JS_FN("getSkin", js_cocos2dx_3d_Mesh_getSkin, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getMaterial", js_cocos2dx_3d_Mesh_getMaterial, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getVertexSizeInBytes", js_cocos2dx_3d_Mesh_getVertexSizeInBytes, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("enableCheckTexture", js_cocos2dx_3d_Mesh_enableCheckTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setMaterial", js_cocos2dx_3d_Mesh_setMaterial, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getName", js_cocos2dx_3d_Mesh_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getIndexFormat", js_cocos2dx_3d_Mesh_getIndexFormat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -1772,7 +1717,6 @@ void js_register_cocos2dx_3d_Mesh(JSContext *cx, JS::HandleObject global) { JS_FN("getBlendFunc", js_cocos2dx_3d_Mesh_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getMeshIndexData", js_cocos2dx_3d_Mesh_getMeshIndexData, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setName", js_cocos2dx_3d_Mesh_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("checkTexture", js_cocos2dx_3d_Mesh_checkTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getIndexCount", js_cocos2dx_3d_Mesh_getIndexCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setMeshIndexData", js_cocos2dx_3d_Mesh_setMeshIndexData, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getMeshVertexAttribCount", js_cocos2dx_3d_Mesh_getMeshVertexAttribCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -1780,7 +1724,6 @@ void js_register_cocos2dx_3d_Mesh(JSContext *cx, JS::HandleObject global) { JS_FN("setForce2DQueue", js_cocos2dx_3d_Mesh_setForce2DQueue, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getPrimitiveType", js_cocos2dx_3d_Mesh_getPrimitiveType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setSkin", js_cocos2dx_3d_Mesh_setSkin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setEnableCheckTexture", js_cocos2dx_3d_Mesh_setEnableCheckTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isVisible", js_cocos2dx_3d_Mesh_isVisible, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getIndexBuffer", js_cocos2dx_3d_Mesh_getIndexBuffer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setGLProgramState", js_cocos2dx_3d_Mesh_setGLProgramState, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.hpp index 07ee9c6107..99a2b3babe 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_auto.hpp @@ -87,7 +87,6 @@ void register_all_cocos2dx_3d(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_3d_Mesh_getSkin(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_getMaterial(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_getVertexSizeInBytes(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_3d_Mesh_enableCheckTexture(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_setMaterial(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_getName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_getIndexFormat(JSContext *cx, uint32_t argc, jsval *vp); @@ -98,7 +97,6 @@ bool js_cocos2dx_3d_Mesh_hasVertexAttrib(JSContext *cx, uint32_t argc, jsval *vp bool js_cocos2dx_3d_Mesh_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_getMeshIndexData(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_setName(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_3d_Mesh_checkTexture(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_getIndexCount(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_setMeshIndexData(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_getMeshVertexAttribCount(JSContext *cx, uint32_t argc, jsval *vp); @@ -106,7 +104,6 @@ bool js_cocos2dx_3d_Mesh_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_setForce2DQueue(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_getPrimitiveType(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_setSkin(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_3d_Mesh_setEnableCheckTexture(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_isVisible(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_getIndexBuffer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_Mesh_setGLProgramState(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp index 579fff1384..91304331d2 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.cpp @@ -72,6 +72,28 @@ bool js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled(JSContext *cx, uint32_t JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_3d_extension_ParticleSystem3D_getRender(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::ParticleSystem3D* cobj = (cocos2d::ParticleSystem3D *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_extension_ParticleSystem3D_getRender : Invalid Native Object"); + if (argc == 0) { + cocos2d::Particle3DRender* ret = cobj->getRender(); + jsval jsret = JSVAL_NULL; + if (ret) { + jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject(cx, (cocos2d::Particle3DRender*)ret)); + } else { + jsret = JSVAL_NULL; + }; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_3d_extension_ParticleSystem3D_getRender : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_3d_extension_ParticleSystem3D_isKeepLocal(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -315,6 +337,7 @@ void js_register_cocos2dx_3d_extension_ParticleSystem3D(JSContext *cx, JS::Handl JS_FN("resumeParticleSystem", js_cocos2dx_3d_extension_ParticleSystem3D_resumeParticleSystem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("startParticleSystem", js_cocos2dx_3d_extension_ParticleSystem3D_startParticleSystem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isEnabled", js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getRender", js_cocos2dx_3d_extension_ParticleSystem3D_getRender, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isKeepLocal", js_cocos2dx_3d_extension_ParticleSystem3D_isKeepLocal, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setEnabled", js_cocos2dx_3d_extension_ParticleSystem3D_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getParticleQuota", js_cocos2dx_3d_extension_ParticleSystem3D_getParticleQuota, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp index a10e2073e3..12b0ec79d1 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_3d_extension_auto.hpp @@ -15,6 +15,7 @@ void register_all_cocos2dx_3d_extension(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_3d_extension_ParticleSystem3D_resumeParticleSystem(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_extension_ParticleSystem3D_startParticleSystem(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_extension_ParticleSystem3D_isEnabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_3d_extension_ParticleSystem3D_getRender(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_extension_ParticleSystem3D_isKeepLocal(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_extension_ParticleSystem3D_setEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_3d_extension_ParticleSystem3D_getParticleQuota(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp index 12771ed9b7..4d21ee392d 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp @@ -272,26 +272,6 @@ bool js_cocos2dx_Texture2D_getPixelsHigh(JSContext *cx, uint32_t argc, jsval *vp JS_ReportError(cx, "js_cocos2dx_Texture2D_getPixelsHigh : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_Texture2D_setValid(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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setValid : Invalid Native Object"); - if (argc == 1) { - bool arg0; - arg0 = JS::ToBoolean(args.get(0)); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setValid : Error processing arguments"); - cobj->setValid(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Texture2D_setValid : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_Texture2D_getBitsPerPixelForFormat(JSContext *cx, uint32_t argc, jsval *vp) { bool ok = true; @@ -547,24 +527,6 @@ bool js_cocos2dx_Texture2D_getContentSize(JSContext *cx, uint32_t argc, jsval *v JS_ReportError(cx, "js_cocos2dx_Texture2D_getContentSize : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_Texture2D_isValid(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::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_isValid : Invalid Native Object"); - if (argc == 0) { - bool ret = cobj->isValid(); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_Texture2D_isValid : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_Texture2D_setAliasTexParameters(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -820,7 +782,6 @@ void js_register_cocos2dx_Texture2D(JSContext *cx, JS::HandleObject global) { JS_FN("hasPremultipliedAlpha", js_cocos2dx_Texture2D_hasPremultipliedAlpha, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithMipmaps", js_cocos2dx_Texture2D_initWithMipmaps, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getPixelsHigh", js_cocos2dx_Texture2D_getPixelsHigh, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setValid", js_cocos2dx_Texture2D_setValid, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getBitsPerPixelForFormat", js_cocos2dx_Texture2D_getBitsPerPixelForFormat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getName", js_cocos2dx_Texture2D_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithString", js_cocos2dx_Texture2D_initWithString, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -828,7 +789,6 @@ void js_register_cocos2dx_Texture2D(JSContext *cx, JS::HandleObject global) { JS_FN("getPath", js_cocos2dx_Texture2D_getPath, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("drawInRect", js_cocos2dx_Texture2D_drawInRect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getContentSize", js_cocos2dx_Texture2D_getContentSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("isValid", js_cocos2dx_Texture2D_isValid, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setAliasTexParameters", js_cocos2dx_Texture2D_setAliasTexParameters, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setAntiAliasTexParameters", js_cocos2dx_Texture2D_setAntiAliasTexParameters, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("generateMipmap", js_cocos2dx_Texture2D_generateMipmap, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -32872,6 +32832,24 @@ bool js_cocos2dx_Label_setDimensions(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Label_setDimensions : wrong number of arguments: %d, was expecting %d", argc, 2); return false; } +bool js_cocos2dx_Label_getWidth(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getWidth : Invalid Native Object"); + if (argc == 0) { + double ret = cobj->getWidth(); + jsval jsret = JSVAL_NULL; + jsret = DOUBLE_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Label_getWidth : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Label_getString(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -33017,6 +32995,24 @@ bool js_cocos2dx_Label_setWidth(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Label_setWidth : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_Label_getAdditionalKerning(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getAdditionalKerning : Invalid Native Object"); + if (argc == 0) { + double ret = cobj->getAdditionalKerning(); + jsval jsret = JSVAL_NULL; + jsret = DOUBLE_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Label_getAdditionalKerning : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Label_getBMFontSize(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -33071,6 +33067,24 @@ bool js_cocos2dx_Label_getHorizontalAlignment(JSContext *cx, uint32_t argc, jsva JS_ReportError(cx, "js_cocos2dx_Label_getHorizontalAlignment : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_Label_getShadowOffset(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getShadowOffset : Invalid Native Object"); + if (argc == 0) { + cocos2d::Size ret = cobj->getShadowOffset(); + jsval jsret = JSVAL_NULL; + jsret = ccsize_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Label_getShadowOffset : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Label_setClipMarginEnabled(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -33131,6 +33145,24 @@ bool js_cocos2dx_Label_setSystemFontName(JSContext *cx, uint32_t argc, jsval *vp JS_ReportError(cx, "js_cocos2dx_Label_setSystemFontName : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_Label_getOutlineSize(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getOutlineSize : Invalid Native Object"); + if (argc == 0) { + int ret = cobj->getOutlineSize(); + jsval jsret = JSVAL_NULL; + jsret = int32_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Label_getOutlineSize : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Label_setBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -33527,22 +33559,40 @@ bool js_cocos2dx_Label_enableOutline(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Label_enableOutline : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_Label_getAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_Label_getShadowBlurRadius(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getAdditionalKerning : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getShadowBlurRadius : Invalid Native Object"); if (argc == 0) { - double ret = cobj->getAdditionalKerning(); + double ret = cobj->getShadowBlurRadius(); jsval jsret = JSVAL_NULL; jsret = DOUBLE_TO_JSVAL(ret); args.rval().set(jsret); return true; } - JS_ReportError(cx, "js_cocos2dx_Label_getAdditionalKerning : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_Label_getShadowBlurRadius : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_Label_getEffectColor(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getEffectColor : Invalid Native Object"); + if (argc == 0) { + cocos2d::Color4F ret = cobj->getEffectColor(); + jsval jsret = JSVAL_NULL; + jsret = cccolor4f_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Label_getEffectColor : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } bool js_cocos2dx_Label_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp) @@ -33758,6 +33808,24 @@ bool js_cocos2dx_Label_getLineHeight(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Label_getLineHeight : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_Label_getShadowColor(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getShadowColor : Invalid Native Object"); + if (argc == 0) { + cocos2d::Color4F ret = cobj->getShadowColor(); + jsval jsret = JSVAL_NULL; + jsret = cccolor4f_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Label_getShadowColor : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Label_getTTFConfig(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -33860,22 +33928,22 @@ bool js_cocos2dx_Label_setHeight(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Label_setHeight : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_Label_getWidth(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_Label_isShadowEnabled(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getWidth : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_isShadowEnabled : Invalid Native Object"); if (argc == 0) { - double ret = cobj->getWidth(); + bool ret = cobj->isShadowEnabled(); jsval jsret = JSVAL_NULL; - jsret = DOUBLE_TO_JSVAL(ret); + jsret = BOOLEAN_TO_JSVAL(ret); args.rval().set(jsret); return true; } - JS_ReportError(cx, "js_cocos2dx_Label_getWidth : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_Label_isShadowEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } bool js_cocos2dx_Label_enableGlow(JSContext *cx, uint32_t argc, jsval *vp) @@ -34048,6 +34116,24 @@ bool js_cocos2dx_Label_isWrapEnabled(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Label_isWrapEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_Label_getLabelEffectType(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::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getLabelEffectType : Invalid Native Object"); + if (argc == 0) { + int ret = (int)cobj->getLabelEffectType(); + jsval jsret = JSVAL_NULL; + jsret = int32_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Label_getLabelEffectType : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Label_setAlignment(JSContext *cx, uint32_t argc, jsval *vp) { bool ok = true; @@ -34429,6 +34515,7 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) { JS_FN("isClipMarginEnabled", js_cocos2dx_Label_isClipMarginEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("enableShadow", js_cocos2dx_Label_enableShadow, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setDimensions", js_cocos2dx_Label_setDimensions, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getWidth", js_cocos2dx_Label_getWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getString", js_cocos2dx_Label_getString, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getHeight", js_cocos2dx_Label_getHeight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("disableEffect", js_cocos2dx_Label_disableEffect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -34436,12 +34523,15 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) { JS_FN("getBlendFunc", js_cocos2dx_Label_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("enableWrap", js_cocos2dx_Label_enableWrap, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setWidth", js_cocos2dx_Label_setWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getAdditionalKerning", js_cocos2dx_Label_getAdditionalKerning, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getBMFontSize", js_cocos2dx_Label_getBMFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getMaxLineWidth", js_cocos2dx_Label_getMaxLineWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getHorizontalAlignment", js_cocos2dx_Label_getHorizontalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getShadowOffset", js_cocos2dx_Label_getShadowOffset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setClipMarginEnabled", js_cocos2dx_Label_setClipMarginEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setString", js_cocos2dx_Label_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setSystemFontName", js_cocos2dx_Label_setSystemFontName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getOutlineSize", js_cocos2dx_Label_getOutlineSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setBMFontFilePath", js_cocos2dx_Label_setBMFontFilePath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithTTF", js_cocos2dx_Label_initWithTTF, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setLineHeight", js_cocos2dx_Label_setLineHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -34453,7 +34543,8 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) { JS_FN("setLineBreakWithoutSpace", js_cocos2dx_Label_setLineBreakWithoutSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getStringNumLines", js_cocos2dx_Label_getStringNumLines, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("enableOutline", js_cocos2dx_Label_enableOutline, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getAdditionalKerning", js_cocos2dx_Label_getAdditionalKerning, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getShadowBlurRadius", js_cocos2dx_Label_getShadowBlurRadius, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getEffectColor", js_cocos2dx_Label_getEffectColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeAllChildrenWithCleanup", js_cocos2dx_Label_removeAllChildrenWithCleanup, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCharMap", js_cocos2dx_Label_setCharMap, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getDimensions", js_cocos2dx_Label_getDimensions, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -34462,12 +34553,13 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) { JS_FN("setVerticalAlignment", js_cocos2dx_Label_setVerticalAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setLineSpacing", js_cocos2dx_Label_setLineSpacing, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getLineHeight", js_cocos2dx_Label_getLineHeight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getShadowColor", js_cocos2dx_Label_getShadowColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTTFConfig", js_cocos2dx_Label_getTTFConfig, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getVerticalAlignment", js_cocos2dx_Label_getVerticalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setTextColor", js_cocos2dx_Label_setTextColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getLetter", js_cocos2dx_Label_getLetter, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setHeight", js_cocos2dx_Label_setHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getWidth", js_cocos2dx_Label_getWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("isShadowEnabled", js_cocos2dx_Label_isShadowEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("enableGlow", js_cocos2dx_Label_enableGlow, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getOverflow", js_cocos2dx_Label_getOverflow, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setAdditionalKerning", js_cocos2dx_Label_setAdditionalKerning, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -34477,6 +34569,7 @@ void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) { JS_FN("getBMFontFilePath", js_cocos2dx_Label_getBMFontFilePath, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setHorizontalAlignment", js_cocos2dx_Label_setHorizontalAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isWrapEnabled", js_cocos2dx_Label_isWrapEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getLabelEffectType", js_cocos2dx_Label_getLabelEffectType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setAlignment", js_cocos2dx_Label_setAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("requestSystemFontRefresh", js_cocos2dx_Label_requestSystemFontRefresh, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setBMFontSize", js_cocos2dx_Label_setBMFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -57594,26 +57687,6 @@ bool js_cocos2dx_TextureCache_getTextureFilePath(JSContext *cx, uint32_t argc, j JS_ReportError(cx, "js_cocos2dx_TextureCache_getTextureFilePath : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_TextureCache_setDirty(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::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_setDirty : Invalid Native Object"); - if (argc == 1) { - bool arg0; - arg0 = JS::ToBoolean(args.get(0)); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextureCache_setDirty : Error processing arguments"); - cobj->setDirty(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_TextureCache_setDirty : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_TextureCache_renameTextureWithKey(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -57652,24 +57725,6 @@ bool js_cocos2dx_TextureCache_removeUnusedTextures(JSContext *cx, uint32_t argc, JS_ReportError(cx, "js_cocos2dx_TextureCache_removeUnusedTextures : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_TextureCache_isDirty(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::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_isDirty : Invalid Native Object"); - if (argc == 0) { - bool ret = cobj->isDirty(); - jsval jsret = JSVAL_NULL; - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_TextureCache_isDirty : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_TextureCache_removeTexture(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -57761,10 +57816,8 @@ void js_register_cocos2dx_TextureCache(JSContext *cx, JS::HandleObject global) { JS_FN("unbindImageAsync", js_cocos2dx_TextureCache_unbindImageAsync, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTextureForKey", js_cocos2dx_TextureCache_getTextureForKey, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTextureFilePath", js_cocos2dx_TextureCache_getTextureFilePath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setDirty", js_cocos2dx_TextureCache_setDirty, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("renameTextureWithKey", js_cocos2dx_TextureCache_renameTextureWithKey, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeUnusedTextures", js_cocos2dx_TextureCache_removeUnusedTextures, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("isDirty", js_cocos2dx_TextureCache_isDirty, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("removeTexture", js_cocos2dx_TextureCache_removeTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("waitForQuit", js_cocos2dx_TextureCache_waitForQuit, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END @@ -63472,65 +63525,9 @@ void js_register_cocos2dx_SimpleAudioEngine(JSContext *cx, JS::HandleObject glob JSClass *jsb_cocos2d_ComponentJS_class; JSObject *jsb_cocos2d_ComponentJS_prototype; -bool js_cocos2dx_ComponentJS_create(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - if (argc == 1) { - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentJS_create : Error processing arguments"); - - auto ret = cocos2d::ComponentJS::create(arg0); - js_type_class_t *typeClass = js_get_type_from_native(ret); - JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ComponentJS")); - args.rval().set(OBJECT_TO_JSVAL(jsret)); - return true; - } - JS_ReportError(cx, "js_cocos2dx_ComponentJS_create : wrong number of arguments"); - return false; -} - -bool js_cocos2dx_ComponentJS_constructor(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentJS_constructor : Error processing arguments"); - cocos2d::ComponentJS* cobj = new (std::nothrow) cocos2d::ComponentJS(arg0); - - js_type_class_t *typeClass = js_get_type_from_native(cobj); - - // link the native object with the javascript object - JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ComponentJS")); - args.rval().set(OBJECT_TO_JSVAL(jsobj)); - if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok) - ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args); - return true; -} -static bool js_cocos2dx_ComponentJS_ctor(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - bool ok = true; - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2d_ComponentJS_ctor : Error processing arguments"); - cocos2d::ComponentJS *nobj = new (std::nothrow) cocos2d::ComponentJS(arg0); - auto newproxy = jsb_new_proxy(nobj, obj); - jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ComponentJS"); - bool isFound = false; - if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) - ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); - args.rval().setUndefined(); - return true; -} - extern JSObject *jsb_cocos2d_Component_prototype; - void js_register_cocos2dx_ComponentJS(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_ComponentJS_class = (JSClass *)calloc(1, sizeof(JSClass)); jsb_cocos2d_ComponentJS_class->name = "ComponentJS"; @@ -63550,21 +63547,17 @@ void js_register_cocos2dx_ComponentJS(JSContext *cx, JS::HandleObject global) { }; static JSFunctionSpec funcs[] = { - JS_FN("ctor", js_cocos2dx_ComponentJS_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; - static JSFunctionSpec st_funcs[] = { - JS_FN("create", js_cocos2dx_ComponentJS_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FS_END - }; + JSFunctionSpec *st_funcs = NULL; JS::RootedObject parent_proto(cx, jsb_cocos2d_Component_prototype); jsb_cocos2d_ComponentJS_prototype = JS_InitClass( cx, global, parent_proto, jsb_cocos2d_ComponentJS_class, - js_cocos2dx_ComponentJS_constructor, 0, // constructor + empty_constructor, 0, properties, funcs, NULL, // no static properties @@ -63573,7 +63566,6 @@ void js_register_cocos2dx_ComponentJS(JSContext *cx, JS::HandleObject global) { // add the proto and JSClass to the type->js info hash table JS::RootedObject proto(cx, jsb_cocos2d_ComponentJS_prototype); jsb_register_class(cx, jsb_cocos2d_ComponentJS_class, proto, parent_proto); - anonEvaluate(cx, global, "(function () { cc.ComponentJS.extend = cc.Class.extend; })()"); } void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj) { diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp index fb22303582..d4b96eb820 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp @@ -22,7 +22,6 @@ bool js_cocos2dx_Texture2D_releaseGLTexture(JSContext *cx, uint32_t argc, jsval bool js_cocos2dx_Texture2D_hasPremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_initWithMipmaps(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_getPixelsHigh(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Texture2D_setValid(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_getBitsPerPixelForFormat(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_getName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *vp); @@ -30,7 +29,6 @@ bool js_cocos2dx_Texture2D_setMaxT(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_getPath(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_drawInRect(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_getContentSize(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Texture2D_isValid(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_setAliasTexParameters(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_setAntiAliasTexParameters(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Texture2D_generateMipmap(JSContext *cx, uint32_t argc, jsval *vp); @@ -2225,6 +2223,7 @@ void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_Label_isClipMarginEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_enableShadow(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setDimensions(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Label_getWidth(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getString(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getHeight(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_disableEffect(JSContext *cx, uint32_t argc, jsval *vp); @@ -2232,12 +2231,15 @@ bool js_cocos2dx_Label_getTextColor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_enableWrap(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setWidth(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Label_getAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getBMFontSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getMaxLineWidth(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Label_getShadowOffset(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setClipMarginEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setString(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setSystemFontName(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Label_getOutlineSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_initWithTTF(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setLineHeight(JSContext *cx, uint32_t argc, jsval *vp); @@ -2249,7 +2251,8 @@ bool js_cocos2dx_Label_getStringLength(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setLineBreakWithoutSpace(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getStringNumLines(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_enableOutline(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Label_getAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Label_getShadowBlurRadius(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Label_getEffectColor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setCharMap(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getDimensions(JSContext *cx, uint32_t argc, jsval *vp); @@ -2258,12 +2261,13 @@ bool js_cocos2dx_Label_getSystemFontName(JSContext *cx, uint32_t argc, jsval *vp bool js_cocos2dx_Label_setVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setLineSpacing(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getLineHeight(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Label_getShadowColor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getTTFConfig(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setTextColor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getLetter(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setHeight(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_Label_getWidth(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Label_isShadowEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_enableGlow(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_getOverflow(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp); @@ -2273,6 +2277,7 @@ bool js_cocos2dx_Label_getTextAlignment(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_Label_getBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_isWrapEnabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Label_getLabelEffectType(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setAlignment(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_requestSystemFontRefresh(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Label_setBMFontSize(JSContext *cx, uint32_t argc, jsval *vp); @@ -3754,10 +3759,8 @@ bool js_cocos2dx_TextureCache_addImage(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TextureCache_unbindImageAsync(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TextureCache_getTextureForKey(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TextureCache_getTextureFilePath(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_TextureCache_setDirty(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TextureCache_renameTextureWithKey(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TextureCache_removeUnusedTextures(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_TextureCache_isDirty(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TextureCache_removeTexture(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TextureCache_waitForQuit(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TextureCache_TextureCache(JSContext *cx, uint32_t argc, jsval *vp); @@ -4100,7 +4103,5 @@ bool js_cocos2dx_ComponentJS_constructor(JSContext *cx, uint32_t argc, jsval *vp void js_cocos2dx_ComponentJS_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_ComponentJS(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); -bool js_cocos2dx_ComponentJS_create(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ComponentJS_ComponentJS(JSContext *cx, uint32_t argc, jsval *vp); #endif // __cocos2dx_h__ diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp index 33d47b4825..4ebbd486b9 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp @@ -1164,9 +1164,10 @@ bool js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite(JSCont js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::extension::ControlButton* cobj = (cocos2d::extension::ControlButton *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite : Invalid Native Object"); - if (argc == 2) { + if (argc == 3) { cocos2d::Node* arg0 = nullptr; cocos2d::ui::Scale9Sprite* arg1 = nullptr; + bool arg2; do { if (args.get(0).isNull()) { arg0 = nullptr; break; } if (!args.get(0).isObject()) { ok = false; break; } @@ -1185,15 +1186,16 @@ bool js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite(JSCont arg1 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL); JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); } while (0); + arg2 = JS::ToBoolean(args.get(2)); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite : Error processing arguments"); - bool ret = cobj->initWithLabelAndBackgroundSprite(arg0, arg1); + bool ret = cobj->initWithLabelAndBackgroundSprite(arg0, arg1, arg2); jsval jsret = JSVAL_NULL; jsret = BOOLEAN_TO_JSVAL(ret); args.rval().set(jsret); return true; } - JS_ReportError(cx, "js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite : wrong number of arguments: %d, was expecting %d", argc, 2); + JS_ReportError(cx, "js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite : wrong number of arguments: %d, was expecting %d", argc, 3); return false; } bool js_cocos2dx_extension_ControlButton_getZoomOnTouchDown(JSContext *cx, uint32_t argc, jsval *vp) @@ -1338,6 +1340,45 @@ bool js_cocos2dx_extension_ControlButton_create(JSContext *cx, uint32_t argc, js return true; } } while (0); + + do { + if (argc == 3) { + cocos2d::Node* arg0 = nullptr; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull()); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + if (!ok) { ok = true; break; } + cocos2d::ui::Scale9Sprite* arg1 = nullptr; + do { + if (args.get(1).isNull()) { arg1 = nullptr; break; } + if (!args.get(1).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull()); + jsProxy = jsb_get_js_proxy(tmpObj); + arg1 = (cocos2d::ui::Scale9Sprite*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object"); + } while (0); + if (!ok) { ok = true; break; } + bool arg2; + arg2 = JS::ToBoolean(args.get(2)); + if (!ok) { ok = true; break; } + cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0, arg1, arg2); + jsval jsret = JSVAL_NULL; + if (ret) { + jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject(cx, (cocos2d::extension::ControlButton*)ret)); + } else { + jsret = JSVAL_NULL; + }; + args.rval().set(jsret); + return true; + } + } while (0); JS_ReportError(cx, "js_cocos2dx_extension_ControlButton_create : wrong number of arguments"); return false; } @@ -1428,7 +1469,7 @@ void js_register_cocos2dx_extension_ControlButton(JSContext *cx, JS::HandleObjec JS_FN("getTitleLabelForState", js_cocos2dx_extension_ControlButton_getTitleLabelForState, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setMargins", js_cocos2dx_extension_ControlButton_setMargins, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getCurrentTitle", js_cocos2dx_extension_ControlButton_getCurrentTitle, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("initWithLabelAndBackgroundSprite", js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("initWithLabelAndBackgroundSprite", js_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getZoomOnTouchDown", js_cocos2dx_extension_ControlButton_getZoomOnTouchDown, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTitleForState", js_cocos2dx_extension_ControlButton_getTitleForState, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_extension_ControlButton_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp index 66846bc243..c0dd458c62 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp @@ -6045,6 +6045,24 @@ bool js_cocos2dx_ui_Text_disableEffect(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_ui_Text_disableEffect : wrong number of arguments"); return false; } +bool js_cocos2dx_ui_Text_getLabelEffectType(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_getLabelEffectType : Invalid Native Object"); + if (argc == 0) { + int ret = (int)cobj->getLabelEffectType(); + jsval jsret = JSVAL_NULL; + jsret = int32_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Text_getLabelEffectType : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Text_getTextColor(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6123,6 +6141,24 @@ bool js_cocos2dx_ui_Text_setTouchScaleChangeEnabled(JSContext *cx, uint32_t argc JS_ReportError(cx, "js_cocos2dx_ui_Text_setTouchScaleChangeEnabled : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_Text_getShadowOffset(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_getShadowOffset : Invalid Native Object"); + if (argc == 0) { + cocos2d::Size ret = cobj->getShadowOffset(); + jsval jsret = JSVAL_NULL; + jsret = ccsize_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Text_getShadowOffset : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Text_setString(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6143,6 +6179,24 @@ bool js_cocos2dx_ui_Text_setString(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_ui_Text_setString : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_Text_getOutlineSize(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_getOutlineSize : Invalid Native Object"); + if (argc == 0) { + int ret = cobj->getOutlineSize(); + jsval jsret = JSVAL_NULL; + jsret = int32_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Text_getOutlineSize : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Text_init(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6169,6 +6223,24 @@ bool js_cocos2dx_ui_Text_init(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_ui_Text_init : wrong number of arguments: %d, was expecting %d", argc, 3); return false; } +bool js_cocos2dx_ui_Text_getShadowBlurRadius(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_getShadowBlurRadius : Invalid Native Object"); + if (argc == 0) { + double ret = cobj->getShadowBlurRadius(); + jsval jsret = JSVAL_NULL; + jsret = DOUBLE_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Text_getShadowBlurRadius : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Text_isTouchScaleChangeEnabled(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6291,6 +6363,24 @@ bool js_cocos2dx_ui_Text_enableOutline(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_ui_Text_enableOutline : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_Text_getEffectColor(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_getEffectColor : Invalid Native Object"); + if (argc == 0) { + cocos2d::Color4B ret = cobj->getEffectColor(); + jsval jsret = JSVAL_NULL; + jsret = cccolor4b_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Text_getEffectColor : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Text_getType(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6327,6 +6417,24 @@ bool js_cocos2dx_ui_Text_getTextHorizontalAlignment(JSContext *cx, uint32_t argc JS_ReportError(cx, "js_cocos2dx_ui_Text_getTextHorizontalAlignment : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_ui_Text_isShadowEnabled(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_isShadowEnabled : Invalid Native Object"); + if (argc == 0) { + bool ret = cobj->isShadowEnabled(); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Text_isShadowEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Text_setFontSize(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6347,6 +6455,24 @@ bool js_cocos2dx_ui_Text_setFontSize(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_ui_Text_setFontSize : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_Text_getShadowColor(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::ui::Text* cobj = (cocos2d::ui::Text *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Text_getShadowColor : Invalid Native Object"); + if (argc == 0) { + cocos2d::Color4B ret = cobj->getShadowColor(); + jsval jsret = JSVAL_NULL; + jsret = cccolor4b_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Text_getShadowColor : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Text_setTextColor(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6543,21 +6669,28 @@ void js_register_cocos2dx_ui_Text(JSContext *cx, JS::HandleObject global) { JS_FN("getFontSize", js_cocos2dx_ui_Text_getFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getString", js_cocos2dx_ui_Text_getString, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("disableEffect", js_cocos2dx_ui_Text_disableEffect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getLabelEffectType", js_cocos2dx_ui_Text_getLabelEffectType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTextColor", js_cocos2dx_ui_Text_getTextColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setTextVerticalAlignment", js_cocos2dx_ui_Text_setTextVerticalAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setFontName", js_cocos2dx_ui_Text_setFontName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setTouchScaleChangeEnabled", js_cocos2dx_ui_Text_setTouchScaleChangeEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getShadowOffset", js_cocos2dx_ui_Text_getShadowOffset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setString", js_cocos2dx_ui_Text_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getOutlineSize", js_cocos2dx_ui_Text_getOutlineSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("init", js_cocos2dx_ui_Text_init, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getShadowBlurRadius", js_cocos2dx_ui_Text_getShadowBlurRadius, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isTouchScaleChangeEnabled", js_cocos2dx_ui_Text_isTouchScaleChangeEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getFontName", js_cocos2dx_ui_Text_getFontName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setTextAreaSize", js_cocos2dx_ui_Text_setTextAreaSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getStringLength", js_cocos2dx_ui_Text_getStringLength, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getAutoRenderSize", js_cocos2dx_ui_Text_getAutoRenderSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("enableOutline", js_cocos2dx_ui_Text_enableOutline, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getEffectColor", js_cocos2dx_ui_Text_getEffectColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getType", js_cocos2dx_ui_Text_getType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTextHorizontalAlignment", js_cocos2dx_ui_Text_getTextHorizontalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("isShadowEnabled", js_cocos2dx_ui_Text_isShadowEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setFontSize", js_cocos2dx_ui_Text_setFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getShadowColor", js_cocos2dx_ui_Text_getShadowColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setTextColor", js_cocos2dx_ui_Text_setTextColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("enableGlow", js_cocos2dx_ui_Text_enableGlow, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTextVerticalAlignment", js_cocos2dx_ui_Text_getTextVerticalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -9349,24 +9482,6 @@ bool js_cocos2dx_ui_Slider_getBallNormalFile(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_ui_Slider_getBallNormalFile : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(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::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer : Invalid Native Object"); - if (argc == 0) { - const cocos2d::Rect& ret = cobj->getCapInsetsProgressBarRebderer(); - jsval jsret = JSVAL_NULL; - jsret = ccrect_to_jsval(cx, ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_ui_Slider_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9423,6 +9538,26 @@ bool js_cocos2dx_ui_Slider_getZoomScale(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_ui_Slider_getZoomScale : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer(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::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer : Invalid Native Object"); + if (argc == 1) { + cocos2d::Rect arg0; + ok &= jsval_to_ccrect(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer : Error processing arguments"); + cobj->setCapInsetProgressBarRenderer(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} bool js_cocos2dx_ui_Slider_loadSlidBallTextures(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9612,6 +9747,24 @@ bool js_cocos2dx_ui_Slider_getCapInsetsBarRenderer(JSContext *cx, uint32_t argc, JS_ReportError(cx, "js_cocos2dx_ui_Slider_getCapInsetsBarRenderer : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer(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::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer : Invalid Native Object"); + if (argc == 0) { + const cocos2d::Rect& ret = cobj->getCapInsetsProgressBarRenderer(); + jsval jsret = JSVAL_NULL; + jsret = ccrect_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Slider_loadSlidBallTexturePressed(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9696,26 +9849,6 @@ bool js_cocos2dx_ui_Slider_getBallDisabledFile(JSContext *cx, uint32_t argc, jsv JS_ReportError(cx, "js_cocos2dx_ui_Slider_getBallDisabledFile : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer(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::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer : Invalid Native Object"); - if (argc == 1) { - cocos2d::Rect arg0; - ok &= jsval_to_ccrect(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer : Error processing arguments"); - cobj->setCapInsetProgressBarRebderer(arg0); - args.rval().setUndefined(); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer : wrong number of arguments: %d, was expecting %d", argc, 1); - return false; -} bool js_cocos2dx_ui_Slider_setCapInsetsBarRenderer(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9944,21 +10077,21 @@ void js_register_cocos2dx_ui_Slider(JSContext *cx, JS::HandleObject global) { JS_FN("loadSlidBallTextureNormal", js_cocos2dx_ui_Slider_loadSlidBallTextureNormal, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadProgressBarTexture", js_cocos2dx_ui_Slider_loadProgressBarTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getBallNormalFile", js_cocos2dx_ui_Slider_getBallNormalFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getCapInsetsProgressBarRebderer", js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setScale9Enabled", js_cocos2dx_ui_Slider_setScale9Enabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getBallPressedFile", js_cocos2dx_ui_Slider_getBallPressedFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getZoomScale", js_cocos2dx_ui_Slider_getZoomScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setCapInsetProgressBarRenderer", js_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadSlidBallTextures", js_cocos2dx_ui_Slider_loadSlidBallTextures, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("addEventListener", js_cocos2dx_ui_Slider_addEventListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setMaxPercent", js_cocos2dx_ui_Slider_setMaxPercent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadBarTexture", js_cocos2dx_ui_Slider_loadBarTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getProgressBarFile", js_cocos2dx_ui_Slider_getProgressBarFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getCapInsetsBarRenderer", js_cocos2dx_ui_Slider_getCapInsetsBarRenderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getCapInsetsProgressBarRenderer", js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadSlidBallTexturePressed", js_cocos2dx_ui_Slider_loadSlidBallTexturePressed, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getBackFile", js_cocos2dx_ui_Slider_getBackFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isScale9Enabled", js_cocos2dx_ui_Slider_isScale9Enabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getBallDisabledFile", js_cocos2dx_ui_Slider_getBallDisabledFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setCapInsetProgressBarRebderer", js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCapInsetsBarRenderer", js_cocos2dx_ui_Slider_setCapInsetsBarRenderer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getPercent", js_cocos2dx_ui_Slider_getPercent, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setCapInsets", js_cocos2dx_ui_Slider_setCapInsets, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp index 1b9400398c..ac298496b4 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp @@ -320,21 +320,28 @@ bool js_cocos2dx_ui_Text_enableShadow(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_getFontSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_getString(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_disableEffect(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Text_getLabelEffectType(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_getTextColor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_setTextVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_setFontName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_setTouchScaleChangeEnabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Text_getShadowOffset(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_setString(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Text_getOutlineSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_init(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Text_getShadowBlurRadius(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_isTouchScaleChangeEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_getFontName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_setTextAreaSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_getStringLength(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_getAutoRenderSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_enableOutline(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Text_getEffectColor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_getType(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_getTextHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Text_isShadowEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_setFontSize(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Text_getShadowColor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_setTextColor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_enableGlow(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Text_getTextVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp); @@ -492,21 +499,21 @@ bool js_cocos2dx_ui_Slider_getMaxPercent(JSContext *cx, uint32_t argc, jsval *vp bool js_cocos2dx_ui_Slider_loadSlidBallTextureNormal(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_loadProgressBarTexture(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getBallNormalFile(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_setScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getBallPressedFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getZoomScale(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_loadSlidBallTextures(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_addEventListener(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_setMaxPercent(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_loadBarTexture(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getProgressBarFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getCapInsetsBarRenderer(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_loadSlidBallTexturePressed(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getBackFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_isScale9Enabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getBallDisabledFile(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_setCapInsetsBarRenderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getPercent(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_setCapInsets(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/js-bindings/manual/ScriptingCore.cpp b/cocos/scripting/js-bindings/manual/ScriptingCore.cpp index 9748a6815d..04a29dd4af 100644 --- a/cocos/scripting/js-bindings/manual/ScriptingCore.cpp +++ b/cocos/scripting/js-bindings/manual/ScriptingCore.cpp @@ -93,9 +93,12 @@ static uint32_t s_nestedLoopLevel = 0; // server entry point for the bg thread static void serverEntryPoint(unsigned int port); -js_proxy_t *_native_js_global_ht = NULL; -js_proxy_t *_js_native_global_ht = NULL; +//js_proxy_t *_native_js_global_ht = NULL; +//js_proxy_t *_js_native_global_ht = NULL; std::unordered_map _js_global_type_map; +static std::unordered_map _native_js_global_map; +static std::unordered_map _js_native_global_map; + static char *_js_log_buf = NULL; @@ -212,18 +215,24 @@ static std::string getMouseFuncName(EventMouse::MouseEventType eventType) return funcName; } -void removeJSObject(JSContext* cx, void* nativeObj) +static void removeJSObject(JSContext* cx, cocos2d::Ref* nativeObj) { - js_proxy_t* nproxy; - js_proxy_t* jsproxy; - - nproxy = jsb_get_native_proxy(nativeObj); - if (nproxy) { - JS::RootedObject jsobj(cx, nproxy->obj); - jsproxy = jsb_get_js_proxy(jsobj); - RemoveObjectRoot(cx, &jsproxy->obj); - jsb_remove_proxy(nproxy, jsproxy); + auto proxy = jsb_get_native_proxy(nativeObj); + if (proxy) + { +#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS + // remove the proxy here, since this was a "stack" object, not heap + // when js_finalize will be called, it will fail, but + // the correct solution is to have a new finalize for event + jsb_remove_proxy(proxy); +#else + // only remove when not using GC, + // otherwise finalize won't be able to find the proxy + JS::RemoveObjectRoot(cx, &proxy->obj); + jsb_remove_proxy(proxy); +#endif } + else CCLOG("removeJSObject: BUG: cannot find native object = %p", nativeObj); } void ScriptingCore::executeJSFunctionWithThisObj(JS::HandleValue thisObj, JS::HandleValue callback) @@ -500,16 +509,21 @@ void ScriptingCore::string_report(JS::HandleValue val) { } } -bool ScriptingCore::evalString(const char *string, jsval *outVal, const char *filename, JSContext* cx, JSObject* global) +bool ScriptingCore::evalString(const char *string, JS::MutableHandleValue outVal, const char *filename, JSContext* cx, JS::HandleObject global) { - if (cx == NULL) - cx = _cx; - if (global == NULL) - global = _global.ref().get(); - JSAutoCompartment ac(cx, global); - JS::RootedObject jsglobal(cx, global); - return JS_EvaluateScript(cx, jsglobal, string, (unsigned)strlen(string), "ScriptingCore::evalString", 1); + return JS_EvaluateScript(cx, global, string, (unsigned)strlen(string), "ScriptingCore::evalString", 1, outVal); +} + +bool ScriptingCore::evalString(const char *string, JS::MutableHandleValue outVal) +{ + return evalString(string, outVal, nullptr, _cx, _global.ref()); +} + +bool ScriptingCore::evalString(const char *string) +{ + JS::RootedValue retVal(_cx); + return evalString(string, &retVal); } void ScriptingCore::start() @@ -522,19 +536,20 @@ void ScriptingCore::addRegisterCallback(sc_register_sth callback) { registrationList.push_back(callback); } -void ScriptingCore::removeAllRoots(JSContext *cx) { - js_proxy_t *current, *tmp; - HASH_ITER(hh, _js_native_global_ht, current, tmp) { - RemoveObjectRoot(cx, ¤t->obj); - HASH_DEL(_js_native_global_ht, current); - free(current); +void ScriptingCore::removeAllRoots(JSContext *cx) +{ + // Native -> JS. No need to free "second" + _native_js_global_map.clear(); + + // JS -> Native: free "second" and "unroot" it. + auto it_js = _js_native_global_map.begin(); + while (it_js != _js_native_global_map.end()) + { + JS::RemoveObjectRoot(cx, &it_js->second->obj); + free(it_js->second); + it_js = _js_native_global_map.erase(it_js); } - HASH_ITER(hh, _native_js_global_ht, current, tmp) { - HASH_DEL(_native_js_global_ht, current); - free(current); - } - HASH_CLEAR(hh, _js_native_global_ht); - HASH_CLEAR(hh, _native_js_global_ht); + _js_native_global_map.clear(); } // Just a wrapper around JSPrincipals that allows static construction. @@ -861,23 +876,16 @@ bool ScriptingCore::log(JSContext* cx, uint32_t argc, jsval *vp) } -void ScriptingCore::removeScriptObjectByObject(Ref* pObj) +void ScriptingCore::removeScriptObjectByObject(cocos2d::Ref* nativeObj) { - js_proxy_t* nproxy; - js_proxy_t* jsproxy; - void *ptr = (void*)pObj; - nproxy = jsb_get_native_proxy(ptr); - if (nproxy) + auto proxy = jsb_get_native_proxy(nativeObj); + if (proxy) { - JSContext *cx = ScriptingCore::getInstance()->getGlobalContext(); - JS::RootedObject jsobj(cx, nproxy->obj); - jsproxy = jsb_get_js_proxy(jsobj); - if (jsproxy) - { - RemoveObjectRoot(cx, &jsproxy->obj); - jsb_remove_proxy(nproxy, jsproxy); - } + JSContext *cx = getGlobalContext(); + JS::RemoveObjectRoot(cx, &proxy->obj); + jsb_remove_proxy(proxy); } +// else CCLOG("removeScriptObjectByObject. BUG: nproxy not found = %p", nproxy); } @@ -917,8 +925,10 @@ bool ScriptingCore::executeScript(JSContext *cx, uint32_t argc, jsval *vp) bool ScriptingCore::forceGC(JSContext *cx, uint32_t argc, jsval *vp) { +#if CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 JSRuntime *rt = JS_GetRuntime(cx); JS_GC(rt); +#endif return true; } @@ -960,7 +970,7 @@ bool ScriptingCore::removeRootJS(JSContext *cx, uint32_t argc, jsval *vp) JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::Heap o(args.get(0).toObjectOrNull()); if (o != nullptr) { - RemoveObjectRoot(cx, &o); + JS::RemoveObjectRoot(cx, &o); } return true; } @@ -1039,6 +1049,8 @@ int ScriptingCore::handleActionEvent(void* data) js_proxy_t * p = jsb_get_native_proxy(actionObject); if (!p) return 0; + JSAutoCompartment ac(_cx, _global.ref()); + int ret = 0; JS::RootedValue retval(_cx); @@ -1068,7 +1080,9 @@ int ScriptingCore::handleNodeEvent(void* data) js_proxy_t * p = jsb_get_native_proxy(node); if (!p) return 0; - + + JSAutoCompartment ac(_cx, _global.ref()); + int ret = 0; JS::RootedValue retval(_cx); jsval dataVal = INT_TO_JSVAL(1); @@ -1132,11 +1146,13 @@ int ScriptingCore::handleComponentEvent(void* data) js_proxy_t * p = jsb_get_native_proxy(node); if (!p) return 0; + JSAutoCompartment ac(_cx, _global.ref()); + int ret = 0; JS::RootedValue retval(_cx); jsval dataVal = INT_TO_JSVAL(1); - JS::RootedValue nodeValue(_cx, OBJECT_TO_JSVAL(p->obj.get())); + JS::RootedValue nodeValue(_cx, OBJECT_TO_JSVAL(p->obj)); if (action == kComponentOnAdd) { @@ -1172,7 +1188,7 @@ bool ScriptingCore::handleTouchesEvent(void* nativeObj, cocos2d::EventTouch::Eve bool ScriptingCore::handleTouchesEvent(void* nativeObj, cocos2d::EventTouch::EventCode eventCode, const std::vector& touches, cocos2d::Event* event, JS::MutableHandleValue jsvalRet) { - JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET + JSAutoCompartment ac(_cx, _global.ref()); bool ret = false; @@ -1180,7 +1196,6 @@ bool ScriptingCore::handleTouchesEvent(void* nativeObj, cocos2d::EventTouch::Eve JS::RootedObject jsretArr(_cx, JS_NewArrayObject(this->_cx, 0)); -// AddNamedObjectRoot(this->_cx, &jsretArr, "touchArray"); int count = 0; js_type_class_t *typeClassEvent = nullptr; @@ -1209,8 +1224,6 @@ bool ScriptingCore::handleTouchesEvent(void* nativeObj, cocos2d::EventTouch::Eve ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), funcName.c_str(), 2, dataVal, jsvalRet); } -// JS_RemoveObjectRoot(this->_cx, &jsretArr); - for (auto& touch : touches) { removeJSObject(this->_cx, touch); @@ -1229,7 +1242,7 @@ bool ScriptingCore::handleTouchEvent(void* nativeObj, cocos2d::EventTouch::Event bool ScriptingCore::handleTouchEvent(void* nativeObj, cocos2d::EventTouch::EventCode eventCode, cocos2d::Touch* touch, cocos2d::Event* event, JS::MutableHandleValue jsvalRet) { - JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET + JSAutoCompartment ac(_cx, _global.ref()); std::string funcName = getTouchFuncName(eventCode); bool ret = false; @@ -1269,13 +1282,13 @@ bool ScriptingCore::handleMouseEvent(void* nativeObj, cocos2d::EventMouse::Mouse js_proxy_t * p = jsb_get_native_proxy(nativeObj); if (p) { - jsval dataVal[1]; js_type_class_t *typeClass = js_get_type_from_native(event); - dataVal[0] = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(_cx, event, typeClass, "cocos2d::Event")); - ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), funcName.c_str(), 1, dataVal, jsvalRet); - } + jsval dataVal = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(_cx, event, typeClass, "cocos2d::Event")); + ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), funcName.c_str(), 1, &dataVal, jsvalRet); - removeJSObject(_cx, event); + removeJSObject(_cx, event); + } + else CCLOG("ScriptingCore::handleMouseEvent native proxy NOT found"); return ret; } @@ -1486,7 +1499,7 @@ int ScriptingCore::sendEvent(ScriptEvent* evt) return 0; } - JSAutoCompartment ac(_cx, _global.ref().get()); + JSAutoCompartment ac(_cx, _global.ref()); switch (evt->type) { @@ -1557,41 +1570,24 @@ bool ScriptingCore::isObjectValid(JSContext *cx, uint32_t argc, jsval *vp) void ScriptingCore::rootObject(Ref* ref) { - js_proxy_t* nproxy; - js_proxy_t* jsproxy; - void *ptr = (void*)ref; - nproxy = jsb_get_native_proxy(ptr); - if (nproxy) { + auto proxy = jsb_get_native_proxy(ref); + if (proxy) { JSContext *cx = getGlobalContext(); - // FIXME: Creating a RootedObject here is not needed. - // it is being created only because jsb_get_js_proxy() requires one - // but only the raw pointer is used in jsb_get_js_proxy() - JS::RootedObject handle(cx, nproxy->obj.get()); - jsproxy = jsb_get_js_proxy(handle); - AddObjectRoot(cx, &jsproxy->obj); - - CCLOG("Rooting %p - %p: %s", ref, &jsproxy->obj, typeid(*ref).name()); + JS::AddNamedObjectRoot(cx, &proxy->obj, typeid(*ref).name()); + ref->_rooted = true; } + else CCLOG("rootObject: BUG. native not found: %p", ref); } void ScriptingCore::unrootObject(Ref* ref) { - js_proxy_t* nproxy; - js_proxy_t* jsproxy; - void *ptr = (void*)ref; - - nproxy = jsb_get_native_proxy(ptr); - if (nproxy) { + auto proxy = jsb_get_native_proxy(ref); + if (proxy) { JSContext *cx = getGlobalContext(); - // FIXME: Creating a RootedObject here is not needed. - // it is being created only because jsb_get_js_proxy() requires one - // but only the raw pointer is used in jsb_get_js_proxy() - JS::RootedObject handle(cx, nproxy->obj.get()); - jsproxy = jsb_get_js_proxy(handle); - RemoveObjectRoot(cx, &jsproxy->obj); - - CCLOG("Unrooting #2 %p - %p: %s", ref, &jsproxy->obj, typeid(*ref).name()); + JS::RemoveObjectRoot(cx, &proxy->obj); + ref->_rooted = false; } + else CCLOG("unrootObject: BUG. native not found: %p", ref); } #pragma mark - Debug @@ -1869,14 +1865,14 @@ void ScriptingCore::enableDebugger(unsigned int port) } } -JS::HandleObject NewGlobalObject(JSContext* cx, bool debug) +JSObject* NewGlobalObject(JSContext* cx, bool debug) { JS::CompartmentOptions options; options.setVersion(JSVERSION_LATEST); JS::RootedObject glob(cx, JS_NewGlobalObject(cx, &global_class, &shellTrustedPrincipals, JS::DontFireOnNewGlobalHook, options)); if (!glob) { - return JS::NullPtr(); + return nullptr; } JSAutoCompartment ac(cx, glob); bool ok = true; @@ -1886,7 +1882,7 @@ JS::HandleObject NewGlobalObject(JSContext* cx, bool debug) if (ok && debug) ok = JS_DefineDebuggerObject(cx, glob); if (!ok) - return JS::NullPtr(); + return nullptr; JS_FireOnNewGlobalObject(cx, glob); @@ -1917,49 +1913,94 @@ bool jsb_get_reserved_slot(JSObject *obj, uint32_t idx, jsval& ret) return true; } -js_proxy_t* jsb_new_proxy(void* nativeObj, JS::HandleObject jsObj) +js_proxy_t* jsb_new_proxy(void* nativeObj, JS::HandleObject jsHandle) { - js_proxy_t* p = nullptr; - JSObject* ptr = jsObj.get(); - do { - p = (js_proxy_t *)malloc(sizeof(js_proxy_t)); - assert(p); - js_proxy_t* nativeObjJsObjtmp = NULL; - HASH_FIND_PTR(_native_js_global_ht, &nativeObj, nativeObjJsObjtmp); - assert(!nativeObjJsObjtmp); - p->ptr = nativeObj; - p->obj = ptr; - HASH_ADD_PTR(_native_js_global_ht, ptr, p); - p = (js_proxy_t *)malloc(sizeof(js_proxy_t)); - assert(p); - nativeObjJsObjtmp = NULL; - HASH_FIND_PTR(_js_native_global_ht, &ptr, nativeObjJsObjtmp); - assert(!nativeObjJsObjtmp); - p->ptr = nativeObj; - p->obj = ptr; - HASH_ADD_PTR(_js_native_global_ht, obj, p); - } while(0); - return p; + js_proxy_t* proxy = nullptr; + JSObject* jsObj = jsHandle.get(); + + if (nativeObj && jsObj) + { + // native to JS index + proxy = (js_proxy_t *)malloc(sizeof(js_proxy_t)); + CC_ASSERT(proxy && "not enough memory"); + +#if 0 + if (_js_native_global_map.find(jsObj) != _js_native_global_map.end()) + { + CCLOG("BUG: old:%s new:%s", JS_GetClass(_js_native_global_map.at(jsObj)->_jsobj)->name, JS_GetClass(jsObj)->name); + } +#endif + + CC_ASSERT(_native_js_global_map.find(nativeObj) == _native_js_global_map.end() && "Native Key should not be present"); + CC_ASSERT(_js_native_global_map.find(jsObj) == _js_native_global_map.end() && "JS Key should not be present"); + + proxy->ptr = nativeObj; + proxy->obj = jsObj; + proxy->_jsobj = jsObj; + + // One Proxy in two entries + _native_js_global_map[nativeObj] = proxy; + _js_native_global_map[jsObj] = proxy; + } + else CCLOG("jsb_new_proxy: Invalid keys"); + + return proxy; } js_proxy_t* jsb_get_native_proxy(void* nativeObj) { - js_proxy_t* p = nullptr; - JS_GET_PROXY(p, nativeObj); - return p; + auto search = _native_js_global_map.find(nativeObj); + if(search != _native_js_global_map.end()) + return search->second; + return nullptr; } -js_proxy_t* jsb_get_js_proxy(JS::HandleObject jsObj) +js_proxy_t* jsb_get_js_proxy(JSObject* jsObj) { - js_proxy_t* p = nullptr; - JSObject* ptr = jsObj.get(); - JS_GET_NATIVE_PROXY(p, ptr); - return p; + auto search = _js_native_global_map.find(jsObj); + if(search != _js_native_global_map.end()) + return search->second; + return nullptr; } void jsb_remove_proxy(js_proxy_t* nativeProxy, js_proxy_t* jsProxy) { - JS_REMOVE_PROXY(nativeProxy, jsProxy); + js_proxy_t* proxy = nativeProxy ? nativeProxy : jsProxy; + jsb_remove_proxy(proxy); +} + +void jsb_remove_proxy(js_proxy_t* proxy) +{ + void* nativeKey = proxy->ptr; + JSObject* jsKey = proxy->_jsobj; + + CC_ASSERT(nativeKey && "Invalid nativeKey"); + CC_ASSERT(jsKey && "Invalid JSKey"); + + auto it_nat = _native_js_global_map.find(nativeKey); + auto it_js = _js_native_global_map.find(jsKey); + +#if 0 + // XXX FIXME: sanity check. Remove me once it is tested that it works Ok + if (it_nat != _native_js_global_map.end() && it_js != _js_native_global_map.end()) + { + CC_ASSERT(it_nat->second == it_js->second && "BUG. Different enties"); + } +#endif + + if (it_nat != _native_js_global_map.end()) + { + _native_js_global_map.erase(it_nat); + } + else CCLOG("jsb_remove_proxy: failed. Native key not found"); + + if (it_js != _js_native_global_map.end()) + { + // Free it once, since we only have one proxy alloced entry + free(it_js->second); + _js_native_global_map.erase(it_js); + } + else CCLOG("jsb_remove_proxy: failed. JS key not found"); } // @@ -2001,7 +2042,10 @@ JSObject* jsb_ref_get_or_create_jsobject(JSContext *cx, cocos2d::Ref *ref, js_ty js_proxy_t* newproxy = jsb_new_proxy(ref, js_obj); #if CC_ENABLE_GC_FOR_NATIVE_OBJECTS CC_UNUSED_PARAM(newproxy); - // don't retain it. + + // retain first copy, and before "owning" to prevent it + // from calling "rootObject" + ref->retain(); ref->_scriptOwned = true; #else // don't autorelease it @@ -2029,7 +2073,7 @@ void jsb_ref_init(JSContext* cx, JS::Heap *obj, Ref* ref, const char* (void)cx; (void)obj; ref->_scriptOwned = true; - // don't retain it. + // don't retain it, already retained #else // autorelease it ref->autorelease(); @@ -2043,9 +2087,10 @@ void jsb_ref_autoreleased_init(JSContext* cx, JS::Heap *obj, Ref* ref #if CC_ENABLE_GC_FOR_NATIVE_OBJECTS (void)cx; (void)obj; - ref->_scriptOwned = true; - // retain it, since the object is autoreleased + // retain first copy, and before "owning" to prevent it + // from calling "rootObject" ref->retain(); + ref->_scriptOwned = true; #else // don't autorelease it, since it is already autoreleased JS::AddNamedObjectRoot(cx, obj, debug); @@ -2056,27 +2101,17 @@ void jsb_ref_autoreleased_init(JSContext* cx, JS::Heap *obj, Ref* ref void jsb_ref_finalize(JSFreeOp* fop, JSObject* obj) { #if CC_ENABLE_GC_FOR_NATIVE_OBJECTS - js_proxy_t* nproxy; - js_proxy_t* jsproxy; - - CCLOG("jsb_ref_finalize #1: JSObject address = %p", obj); - - JS::RootedObject jsobj(fop->runtime(), obj); - jsproxy = jsb_get_js_proxy(jsobj); - if (jsproxy) + auto proxy = jsb_get_js_proxy(obj); + if (proxy) { - auto ref = static_cast(jsproxy->ptr); - nproxy = jsb_get_native_proxy(jsproxy->ptr); - + auto ref = static_cast(proxy->ptr); + jsb_remove_proxy(proxy); if (ref) - { - CCLOG("jsb_ref_finalize #2: JSObject address = %p (%s)", obj, typeid(*ref).name()); - - jsb_remove_proxy(nproxy, jsproxy); ref->release(); - } - else - jsb_remove_proxy(nullptr, jsproxy); + } + else + { + CCLOG("jsb_ref_finalize: BUG: proxy not found for %p (%s)", obj, JS_GetClass(obj)->name); } #else // CCLOG("jsb_ref_finalize: JSObject address = %p", obj); @@ -2084,12 +2119,12 @@ void jsb_ref_finalize(JSFreeOp* fop, JSObject* obj) } // rebind -void jsb_ref_rebind(JSContext* cx, JS::HandleObject jsobj, js_proxy_t *js2native_proxy, cocos2d::Ref* oldRef, cocos2d::Ref* newRef, const char* debug) +void jsb_ref_rebind(JSContext* cx, JS::HandleObject jsobj, js_proxy_t *proxy, cocos2d::Ref* oldRef, cocos2d::Ref* newRef, const char* debug) { #if not CC_ENABLE_GC_FOR_NATIVE_OBJECTS - JS::RemoveObjectRoot(cx, &js2native_proxy->obj); + JS::RemoveObjectRoot(cx, &proxy->obj); #endif - jsb_remove_proxy(jsb_get_native_proxy(oldRef), js2native_proxy); + jsb_remove_proxy(proxy); // Rebind js obj with new action js_proxy_t* newProxy = jsb_new_proxy(newRef, jsobj); diff --git a/cocos/scripting/js-bindings/manual/ScriptingCore.h b/cocos/scripting/js-bindings/manual/ScriptingCore.h index b9ac8b295c..bb03a5fac8 100644 --- a/cocos/scripting/js-bindings/manual/ScriptingCore.h +++ b/cocos/scripting/js-bindings/manual/ScriptingCore.h @@ -40,7 +40,7 @@ #include #include -#define ENGINE_VERSION "Cocos2d-JS v3.9" +#define ENGINE_VERSION "Cocos2d-JS v3.10" void js_log(const char *format, ...); @@ -234,7 +234,22 @@ public: * @param global @~english The js global object * @return @~english Return true if successfully invoked, otherwise return false. */ - bool evalString(const char *string, jsval *outVal, const char *filename = NULL, JSContext* cx = NULL, JSObject* global = NULL); + bool evalString(const char *string, JS::MutableHandleValue outVal, const char *filename, JSContext* cx, JS::HandleObject global); + + /**@~english + * Evaluate the specified js code string + * @param string @~english The string with the javascript code to be evaluated + * @param outVal @~english The jsval that will hold the return value of the evaluation. + * @return @~english Return true if successfully invoked, otherwise return false. + */ + bool evalString(const char *string, JS::MutableHandleValue outVal); + + /**@~english + * Evaluate the specified js code string + * @param string @~english The string with the javascript code to be evaluated + * @return @~english Return true if successfully invoked, otherwise return false. + */ + bool evalString(const char *string); /** @brief @~english Get script object for the given path @@ -517,7 +532,7 @@ public: void restartVM(); }; -JS::HandleObject NewGlobalObject(JSContext* cx, bool debug = false); +JSObject* NewGlobalObject(JSContext* cx, bool debug = false); bool jsb_set_reserved_slot(JSObject *obj, uint32_t idx, jsval value); bool jsb_get_reserved_slot(JSObject *obj, uint32_t idx, jsval& ret); @@ -547,10 +562,17 @@ js_type_class_t *jsb_register_class(JSContext *cx, JSClass *jsClass, JS::HandleO return p; } +/** creates two new proxies: one associaged with the nativeObj, + and another one associated with the JsObj */ js_proxy_t* jsb_new_proxy(void* nativeObj, JS::HandleObject jsObj); +/** returns the proxy associated with the Native* */ js_proxy_t* jsb_get_native_proxy(void* nativeObj); -js_proxy_t* jsb_get_js_proxy(JS::HandleObject jsObj); +/** returns the proxy associated with the JSObject* */ +js_proxy_t* jsb_get_js_proxy(JSObject* jsObj); +/** deprecated: use jsb_remove_proxy(js_proxy_t* proxy) instead */ void jsb_remove_proxy(js_proxy_t* nativeProxy, js_proxy_t* jsProxy); +/** removes both the native and js proxies */ +void jsb_remove_proxy(js_proxy_t* proxy); /** * Generic initialization function for subclasses of Ref @@ -603,7 +625,4 @@ JSObject* jsb_ref_get_or_create_jsobject(JSContext *cx, cocos2d::Ref *ref, js_ty */ JSObject* jsb_ref_autoreleased_get_or_create_jsobject(JSContext *cx, cocos2d::Ref *ref, js_type_class_t *typeClass, const char* debug); - -void removeJSObject(JSContext* cx, void* nativeObj); - #endif /* __SCRIPTING_CORE_H__ */ diff --git a/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp b/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp index 2bf73aada1..fc873e3317 100644 --- a/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp +++ b/cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp @@ -70,12 +70,6 @@ JSClass* JSPROXY_CCPhysicsSprite_class = NULL; JSObject* JSPROXY_CCPhysicsSprite_object = NULL; // Constructor -// Destructor -void JSPROXY_CCPhysicsSprite_finalize(JSFreeOp *fop, JSObject *obj) -{ - CCLOGINFO("jsbindings: finalizing JS object %p (PhysicsSprite)", obj); -} - // Arguments: // Ret value: BOOL (b) bool JSPROXY_CCPhysicsSprite_isDirty(JSContext *cx, uint32_t argc, jsval *vp) { @@ -173,12 +167,6 @@ extern JSObject *js_cocos2dx_CCDrawNode_prototype; // Constructor -// Destructor -void JSB_CCPhysicsDebugNode_finalize(JSFreeOp *fop, JSObject *obj) -{ - CCLOGINFO("jsbindings: finalizing JS object %p (PhysicsDebugNode)", obj); -} - // Arguments: cpSpace* // Ret value: PhysicsDebugNode* (o) bool JSB_CCPhysicsDebugNode_debugNodeForCPSpace__static(JSContext *cx, uint32_t argc, jsval *vp) { @@ -295,7 +283,7 @@ void JSB_CCPhysicsDebugNode_createClass(JSContext *cx, JS::HandleObject globalOb JSB_CCPhysicsDebugNode_class->enumerate = JS_EnumerateStub; JSB_CCPhysicsDebugNode_class->resolve = JS_ResolveStub; JSB_CCPhysicsDebugNode_class->convert = JS_ConvertStub; - JSB_CCPhysicsDebugNode_class->finalize = JSB_CCPhysicsDebugNode_finalize; + JSB_CCPhysicsDebugNode_class->finalize = jsb_ref_finalize; JSB_CCPhysicsDebugNode_class->flags = 0; static JSPropertySpec properties[] = { @@ -442,7 +430,8 @@ bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrame__static(JSContext *cx, uint32 // Arguments: NSString* // Ret value: PhysicsSprite* (o) -bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrameName__static(JSContext *cx, uint32_t argc, jsval *vp) { +bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrameName__static(JSContext *cx, uint32_t argc, jsval *vp) +{ JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; const char* arg0 = nullptr; @@ -452,27 +441,9 @@ bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrameName__static(JSContext *cx, ui PhysicsSprite* ret = PhysicsSprite::createWithSpriteFrameName(arg0); - jsval jsret; - do { - if (ret) { - TypeTest t; - js_type_class_t *typeClass = nullptr; - std::string typeName = t.s_name(); - auto typeMapIter = _js_global_type_map.find(typeName); - CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!"); - typeClass = typeMapIter->second; - CCASSERT(typeClass, "The value is null."); - JS::RootedObject proto(cx, typeClass->proto.ref()); - JS::RootedObject parentProto(cx, typeClass->parentProto.ref()); - JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parentProto)); - jsret = OBJECT_TO_JSVAL(obj); - js_proxy_t *p = jsb_new_proxy(ret, obj); - JS::AddNamedObjectRoot(cx, &p->obj, "CCPhysicsSprite"); - } else { - jsret = JSVAL_NULL; - } - } while (0); - args.rval().set(jsret); + js_type_class_t *typeClass = js_get_type_from_native(ret); + JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::extension::PhysicsSprite")); + args.rval().set(OBJECT_TO_JSVAL(jsret)); return true; } @@ -483,27 +454,14 @@ bool JSPROXY_CCPhysicsSprite_spriteWithSpriteFrameName__static(JSContext *cx, ui bool JSPROXY_CCPhysicsSprite_constructor(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - PhysicsSprite* cobj = new (std::nothrow) PhysicsSprite(); - cocos2d::Ref *_ccobj = dynamic_cast(cobj); - if (_ccobj) { - _ccobj->autorelease(); - } - TypeTest t; - js_type_class_t *typeClass = nullptr; - std::string typeName = t.s_name(); - auto typeMapIter = _js_global_type_map.find(typeName); - CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!"); - typeClass = typeMapIter->second; - CCASSERT(typeClass, "The value is null."); - JS::RootedObject proto(cx, typeClass->proto.ref()); - JS::RootedObject parentProto(cx, typeClass->parentProto.ref()); - JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parentProto)); - args.rval().set(OBJECT_TO_JSVAL(obj)); + auto cobj = new (std::nothrow) cocos2d::extension::PhysicsSprite; + js_type_class_t *typeClass = js_get_type_from_native(cobj); + // link the native object with the javascript object - js_proxy_t* p = jsb_new_proxy(cobj, obj); - JS::AddNamedObjectRoot(cx, &p->obj, "cocos2d::extension::PhysicsSprite"); - if (JS_HasProperty(cx, obj, "_ctor", &ok)) - ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::extension::PhysicsSprite")); + args.rval().set(OBJECT_TO_JSVAL(jsobj)); + if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args); return true; } @@ -511,14 +469,11 @@ static bool JSPROXY_CCPhysicsSprite_ctor(JSContext *cx, uint32_t argc, jsval *vp { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - PhysicsSprite *nobj = new (std::nothrow) PhysicsSprite(); - if (nobj) { - nobj->autorelease(); - } - js_proxy_t* p = jsb_new_proxy(nobj, obj); - JS::AddNamedObjectRoot(cx, &p->obj, "cocos2d::extension::SpriteFrame"); + auto nobj = new (std::nothrow) cocos2d::extension::PhysicsSprite; + auto newproxy = jsb_new_proxy(nobj, obj); + jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::extension::PhysicsSprite"); bool isFound = false; - if (JS_HasProperty(cx, obj, "_ctor", &isFound)) + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); args.rval().setUndefined(); return true; @@ -535,7 +490,7 @@ void JSPROXY_CCPhysicsSprite_createClass(JSContext *cx, JS::HandleObject globalO JSPROXY_CCPhysicsSprite_class->enumerate = JS_EnumerateStub; JSPROXY_CCPhysicsSprite_class->resolve = JS_ResolveStub; JSPROXY_CCPhysicsSprite_class->convert = JS_ConvertStub; - JSPROXY_CCPhysicsSprite_class->finalize = JSPROXY_CCPhysicsSprite_finalize; + JSPROXY_CCPhysicsSprite_class->finalize = jsb_ref_finalize; JSPROXY_CCPhysicsSprite_class->flags = 0; static JSPropertySpec properties[] = { diff --git a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp index 3822df0696..626e7a5a82 100644 --- a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp +++ b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp @@ -5142,35 +5142,16 @@ bool js_cocos2dx_EventKeyboard_constructor(JSContext *cx, uint32_t argc, jsval * JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventKeyboard_constructor : Error processing arguments"); cocos2d::EventKeyboard* cobj = new (std::nothrow) cocos2d::EventKeyboard(arg0, arg1); - cocos2d::Ref *_ccobj = dynamic_cast(cobj); - if (_ccobj) { - _ccobj->autorelease(); - } - TypeTest t; - js_type_class_t *typeClass = nullptr; - std::string typeName = t.s_name(); - auto typeMapIter = _js_global_type_map.find(typeName); - CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!"); - typeClass = typeMapIter->second; - CCASSERT(typeClass, "The value is null."); - JS::RootedObject proto(cx, typeClass->proto.ref()); - JS::RootedObject parentProto(cx, typeClass->parentProto.ref()); - JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parentProto)); - JS::RootedValue objVal(cx, OBJECT_TO_JSVAL(obj)); - args.rval().set(objVal); - // link the native object with the javascript object - js_proxy_t* p = jsb_new_proxy(cobj, obj); - JS::AddNamedObjectRoot(cx, &p->obj, "cocos2d::EventKeyboard"); + js_type_class_t *typeClass = js_get_type_from_native(cobj); + auto jsobj = jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventKeyboard"); + + args.rval().set(OBJECT_TO_JSVAL(jsobj)); return true; } extern JSObject *jsb_cocos2d_Event_prototype; -void js_cocos2d_EventKeyboard_finalize(JSFreeOp *fop, JSObject *obj) { - CCLOGINFO("jsbindings: finalizing JS object %p (EventKeyboard)", obj); -} - static bool js_is_native_obj(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -5188,7 +5169,7 @@ void js_register_cocos2dx_EventKeyboard(JSContext *cx, JS::HandleObject global) jsb_cocos2d_EventKeyboard_class->enumerate = JS_EnumerateStub; jsb_cocos2d_EventKeyboard_class->resolve = JS_ResolveStub; jsb_cocos2d_EventKeyboard_class->convert = JS_ConvertStub; - jsb_cocos2d_EventKeyboard_class->finalize = js_cocos2d_EventKeyboard_finalize; + jsb_cocos2d_EventKeyboard_class->finalize = jsb_ref_finalize; jsb_cocos2d_EventKeyboard_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2); static JSPropertySpec properties[] = { @@ -5568,20 +5549,15 @@ bool js_cocos2dx_PolygonInfo_constructor(JSContext *cx, uint32_t argc, jsval *vp void js_cocos2d_PolygonInfo_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (PolygonInfo)", obj); - js_proxy_t* nproxy; - js_proxy_t* jsproxy; JSContext *cx = ScriptingCore::getInstance()->getGlobalContext(); JS::RootedObject jsobj(cx, obj); - jsproxy = jsb_get_js_proxy(jsobj); - if (jsproxy) + auto proxy = jsb_get_js_proxy(jsobj); + if (proxy) { - nproxy = jsb_get_native_proxy(jsproxy->ptr); - - cocos2d::PolygonInfo *nobj = static_cast(nproxy->ptr); + cocos2d::PolygonInfo *nobj = static_cast(proxy->ptr); if (nobj) delete nobj; - - jsb_remove_proxy(nproxy, jsproxy); + jsb_remove_proxy(proxy); } } @@ -5731,19 +5707,14 @@ bool js_cocos2dx_AutoPolygon_constructor(JSContext *cx, uint32_t argc, jsval *vp void js_cocos2d_AutoPolygon_finalize(JSFreeOp *fop, JSObject *obj) { CCLOGINFO("jsbindings: finalizing JS object %p (AutoPolygon)", obj); - js_proxy_t* nproxy; - js_proxy_t* jsproxy; JSContext *cx = ScriptingCore::getInstance()->getGlobalContext(); JS::RootedObject jsobj(cx, obj); - jsproxy = jsb_get_js_proxy(jsobj); - if (jsproxy) { - nproxy = jsb_get_native_proxy(jsproxy->ptr); - - cocos2d::AutoPolygon *nobj = static_cast(nproxy->ptr); + auto proxy = jsb_get_js_proxy(jsobj); + if (proxy) { + cocos2d::AutoPolygon *nobj = static_cast(proxy->ptr); if (nobj) delete nobj; - - jsb_remove_proxy(nproxy, jsproxy); + jsb_remove_proxy(proxy); } } @@ -5789,6 +5760,41 @@ void js_register_cocos2dx_AutoPolygon(JSContext *cx, JS::HandleObject global) { jsb_register_class(cx, jsb_cocos2d_AutoPolygon_class, proto, JS::NullPtr()); } +// ComponentJS controls the native js proxy itself, must be bound manually +bool js_cocos2dx_ComponentJS_create(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + if (argc == 1) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentJS_create : Error processing arguments"); + + auto ret = cocos2d::ComponentJS::create(arg0); + JS::RootedObject jsret(cx, static_cast(ret->getScriptObject())); + args.rval().set(OBJECT_TO_JSVAL(jsret)); + return true; + } + JS_ReportError(cx, "js_cocos2dx_ComponentJS_create : wrong number of arguments"); + return false; +} +static bool js_cocos2dx_ComponentJS_ctor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + bool ok = true; + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2d_ComponentJS_ctor : Error processing arguments"); + cocos2d::ComponentJS *nobj = new (std::nothrow) cocos2d::ComponentJS(arg0); + // autorelease it + nobj->autorelease(); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + args.rval().setUndefined(); + return true; +} bool js_cocos2dx_ComponentJS_getScriptObject(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6053,8 +6059,12 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global) tmpObj.set(jsb_cocos2d_ClippingNode_prototype); JS_DefineFunction(cx, tmpObj, "init", js_cocos2dx_ClippingNode_init, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT); + JS_GetProperty(cx, ccObj, "ComponentJS", &tmpVal); + tmpObj = tmpVal.toObjectOrNull(); + JS_DefineFunction(cx, tmpObj, "create", js_cocos2dx_ComponentJS_create, 1, JSPROP_READONLY | JSPROP_PERMANENT); tmpObj.set(jsb_cocos2d_ComponentJS_prototype); JS_DefineFunction(cx, tmpObj, "getScriptObject", js_cocos2dx_ComponentJS_getScriptObject, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT); + JS_DefineFunction(cx, tmpObj, "ctor", js_cocos2dx_ComponentJS_ctor, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT); JS_DefineFunction(cx, ccObj, "glEnableVertexAttribs", js_cocos2dx_ccGLEnableVertexAttribs, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, ccObj, "pAdd", js_cocos2dx_ccpAdd, 1, JSPROP_READONLY | JSPROP_PERMANENT); diff --git a/cocos/scripting/js-bindings/manual/cocos2d_specifics.hpp b/cocos/scripting/js-bindings/manual/cocos2d_specifics.hpp index e770ad9ea6..f15e6cb0b2 100644 --- a/cocos/scripting/js-bindings/manual/cocos2d_specifics.hpp +++ b/cocos/scripting/js-bindings/manual/cocos2d_specifics.hpp @@ -87,8 +87,7 @@ inline js_type_class_t *js_get_type_from_native(T* native_obj) { */ template inline js_proxy_t *js_get_or_create_proxy(JSContext *cx, T *native_obj) { - js_proxy_t *proxy; - HASH_FIND_PTR(_native_js_global_ht, &native_obj, proxy); + js_proxy_t *proxy = jsb_get_native_proxy(native_obj); if (!proxy) { js_type_class_t *typeProxy = js_get_type_from_native(native_obj); // Return NULL if can't find its type rather than making an assert. @@ -133,11 +132,8 @@ JSObject* js_get_or_create_jsobject(JSContext *cx, typename std::enable_ifparentProto.ref().get()); JS::RootedObject js_obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent)); proxy = jsb_new_proxy(native_obj, js_obj); -#ifdef DEBUG - AddNamedObjectRoot(cx, &proxy->obj, typeid(*native_obj).name()); -#else - AddObjectRoot(cx, &proxy->obj); -#endif + + JS::AddNamedObjectRoot(cx, &proxy->obj, typeid(*native_obj).name()); } return proxy->obj; } diff --git a/cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp b/cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp index 174a9100ae..f6dee2717f 100644 --- a/cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp +++ b/cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp @@ -66,25 +66,15 @@ ComponentJS::ComponentJS(const std::string& scriptFileName) JS::RootedValue protoValue(cx); JS_GetProperty(cx, classObj, "prototype", &protoValue); - TypeTest t; - js_type_class_t *typeClass = nullptr; - std::string typeName = t.s_name(); - auto typeMapIter = _js_global_type_map.find(typeName); - CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!"); - typeClass = typeMapIter->second; - mozilla::Maybe *jsObj = new (std::nothrow) mozilla::Maybe(); + js_type_class_t *typeClass = js_get_type_from_native(this); JS::RootedObject proto(cx, protoValue.toObjectOrNull()); JS::RootedObject parent(cx, typeClass->proto.ref()); jsObj->construct(cx); JS::RootedObject obj(cx, JS_NewObject(cx, theClass, proto, parent)); jsObj->ref() = obj; - // Unbind current proxy binding - js_proxy_t* jsproxy = js_get_or_create_proxy(cx, this); - JS::RemoveObjectRoot(cx, &jsproxy->obj); - jsb_remove_proxy(jsb_get_native_proxy(this), jsproxy); // link the native object with the javascript object jsb_new_proxy(this, jsObj->ref()); @@ -95,6 +85,14 @@ ComponentJS::ComponentJS(const std::string& scriptFileName) ComponentJS::~ComponentJS() { mozilla::Maybe* jsObj = static_cast*>(_jsObj); + if (jsObj && !jsObj->empty()) + { + // Remove proxy + js_proxy_t* proxy = jsb_get_js_proxy(jsObj->ref()); + if (proxy) + jsb_remove_proxy(proxy); + } + // Delete rooted object if (jsObj != nullptr) { delete jsObj; @@ -104,7 +102,14 @@ ComponentJS::~ComponentJS() void* ComponentJS::getScriptObject() const { mozilla::Maybe* jsObj = static_cast*>(_jsObj); - return jsObj->ref().get(); + if (jsObj && !jsObj->empty()) + { + return jsObj->ref().get(); + } + else + { + return nullptr; + } } void ComponentJS::update(float delta) 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 72ce50f4f3..1ba9a19b74 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 @@ -557,8 +557,7 @@ public: virtual void onEvent(Ref *controlButton, Control::EventType event) { - js_proxy_t * p; - JS_GET_PROXY(p, controlButton); + js_proxy_t* p = jsb_get_native_proxy(controlButton); if (!p) { log("Failed to get proxy for control button"); diff --git a/cocos/scripting/js-bindings/manual/js_bindings_opengl.cpp b/cocos/scripting/js-bindings/manual/js_bindings_opengl.cpp index 22c48e6a26..3459ef2f71 100644 --- a/cocos/scripting/js-bindings/manual/js_bindings_opengl.cpp +++ b/cocos/scripting/js-bindings/manual/js_bindings_opengl.cpp @@ -32,31 +32,29 @@ void GLNode::draw(Renderer *renderer, const Mat4& transform, uint32_t flags) { void GLNode::onDraw(Mat4 &transform, uint32_t flags) { - js_proxy_t* proxy = NULL; JSContext *cx = ScriptingCore::getInstance()->getGlobalContext(); - proxy = js_get_or_create_proxy(cx, this); - if( proxy ) { -// JSObject *jsObj = proxy->obj; - JS::RootedObject jsObj(cx, proxy->obj.get()); - if (jsObj) { - bool found = false; - JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET + js_type_class_t *typeClass = js_get_type_from_native(this); + JS::RootedObject jsObj(cx, jsb_ref_get_or_create_jsobject(cx, this, typeClass, "cocos2d::GLNode")); - JS_HasProperty(cx, jsObj, "draw", &found); - if (found == true) { - auto director = Director::getInstance(); - director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform); + if (jsObj.get()) + { + bool found = false; + JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET - JS::RootedValue rval(cx); - JS::RootedValue fval(cx); - JS_GetProperty(cx, jsObj, "draw", &fval); + JS_HasProperty(cx, jsObj, "draw", &found); + if (found) { + auto director = Director::getInstance(); + director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); + director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform); - JS_CallFunctionValue(cx, jsObj, fval, JS::HandleValueArray::empty(), &rval); + JS::RootedValue rval(cx); + JS::RootedValue fval(cx); + JS_GetProperty(cx, jsObj, "draw", &fval); - director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); - } + JS_CallFunctionValue(cx, jsObj, fval, JS::HandleValueArray::empty(), &rval); + + director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); } } } @@ -68,32 +66,18 @@ JSObject *js_cocos2dx_GLNode_prototype; bool js_cocos2dx_GLNode_constructor(JSContext *cx, uint32_t argc, jsval *vp) { - if (argc == 0) { - cocos2d::GLNode* cobj = new (std::nothrow) cocos2d::GLNode(); - cocos2d::Ref *_ccobj = dynamic_cast(cobj); - if (_ccobj) { - _ccobj->autorelease(); - } + cocos2d::GLNode* cobj = new (std::nothrow) cocos2d::GLNode; - TypeTest t; - js_type_class_t *typeClass = nullptr; - std::string typeName = t.s_name(); - auto typeMapIter = _js_global_type_map.find(typeName); + js_type_class_t *typeClass = js_get_type_from_native(cobj); + JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::GLNode")); - CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!"); - typeClass = typeMapIter->second; - CCASSERT(typeClass, "The value is null."); - - JS::RootedObject proto(cx, typeClass->proto.ref()); - JS::RootedObject parentProto(cx, typeClass->parentProto.ref()); - JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parentProto)); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - args.rval().set(OBJECT_TO_JSVAL(obj)); - // link the native object with the javascript object - js_proxy_t *p = jsb_new_proxy(cobj, obj); + args.rval().set(OBJECT_TO_JSVAL(jsobj)); - JS::AddNamedObjectRoot(cx, &p->obj, "cocos2d::GLNode"); + bool ok=false; + if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args); return true; } @@ -101,17 +85,16 @@ bool js_cocos2dx_GLNode_constructor(JSContext *cx, uint32_t argc, jsval *vp) return false; } -void js_cocos2dx_GLNode_finalize(JSFreeOp *fop, JSObject *obj) { -} - static bool js_cocos2dx_GLNode_ctor(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - cocos2d::GLNode *nobj = new (std::nothrow) cocos2d::GLNode(); - js_proxy_t* p = jsb_new_proxy(nobj, obj); - nobj->autorelease(); - JS::AddNamedObjectRoot(cx, &p->obj, "GLNode"); + cocos2d::GLNode *nobj = new (std::nothrow) cocos2d::GLNode; + auto newproxy = jsb_new_proxy(nobj, obj); + jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::GLNode"); + bool isFound = false; + if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); args.rval().setUndefined(); return true; } @@ -119,16 +102,16 @@ static bool js_cocos2dx_GLNode_ctor(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_GLNode_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - cocos2d::GLNode* ret = new (std::nothrow) cocos2d::GLNode(); - jsval jsret; - do { - if (ret) { - js_proxy_t *proxy = js_get_or_create_proxy(cx, ret); - jsret = OBJECT_TO_JSVAL(proxy->obj); - } else { - jsret = JSVAL_NULL; - } - } while (0); + cocos2d::GLNode* ret = new (std::nothrow) cocos2d::GLNode; + jsval jsret = JSVAL_NULL; + + if (ret) { + js_type_class_t *typeClass = js_get_type_from_native(ret); + + auto jsobj = jsb_ref_create_jsobject(cx, ret, typeClass, "cocos2d::GLNode"); + jsret = OBJECT_TO_JSVAL(jsobj); + } + args.rval().set(jsret); return true; } @@ -145,7 +128,7 @@ void js_register_cocos2dx_GLNode(JSContext *cx, JS::HandleObject global) { js_cocos2dx_GLNode_class->enumerate = JS_EnumerateStub; js_cocos2dx_GLNode_class->resolve = JS_ResolveStub; js_cocos2dx_GLNode_class->convert = JS_ConvertStub; - js_cocos2dx_GLNode_class->finalize = js_cocos2dx_GLNode_finalize; + js_cocos2dx_GLNode_class->finalize = jsb_ref_finalize; js_cocos2dx_GLNode_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2); static JSPropertySpec properties[] = { diff --git a/cocos/scripting/js-bindings/manual/js_manual_conversions.h b/cocos/scripting/js-bindings/manual/js_manual_conversions.h index ce64a45310..f11936a001 100644 --- a/cocos/scripting/js-bindings/manual/js_manual_conversions.h +++ b/cocos/scripting/js-bindings/manual/js_manual_conversions.h @@ -119,7 +119,7 @@ bool jsval_to_ray(JSContext *cx, JS::HandleValue vp, cocos2d::Ray* ret); bool jsval_to_resourcedata(JSContext *cx, JS::HandleValue v, cocos2d::ResourceData* ret); // forward declaration -CC_JS_DLL js_proxy_t* jsb_get_js_proxy(JS::HandleObject jsObj); +CC_JS_DLL js_proxy_t* jsb_get_js_proxy(JSObject* jsObj); template bool jsvals_variadic_to_ccvector( JSContext *cx, /*jsval *vp, int argc,*/const JS::CallArgs& args, cocos2d::Vector* ret) @@ -280,9 +280,12 @@ jsval meshVertexAttrib_to_jsval(JSContext* cx, const cocos2d::MeshVertexAttrib& jsval uniform_to_jsval(JSContext* cx, const cocos2d::Uniform* uniform); jsval resourcedata_to_jsval(JSContext* cx, const cocos2d::ResourceData& v); -template -js_proxy_t *js_get_or_create_proxy(JSContext *cx, T *native_obj); +// forward declaration +template +js_type_class_t *js_get_type_from_native(T* native_obj); + +// Ref version of ccvector_to_jsval template jsval ccvector_to_jsval(JSContext* cx, const cocos2d::Vector& v) { @@ -294,9 +297,10 @@ jsval ccvector_to_jsval(JSContext* cx, const cocos2d::Vector& v) JS::RootedValue arrElement(cx); //First, check whether object is associated with js object. - js_proxy_t* jsproxy = js_get_or_create_proxy(cx, obj); - if (jsproxy) { - arrElement = OBJECT_TO_JSVAL(jsproxy->obj); + js_type_class_t *typeClass = js_get_type_from_native(obj); + JS::RootedObject jsobject(cx, jsb_ref_get_or_create_jsobject(cx, obj, typeClass, typeid(*obj).name())); + if (jsobject.get()) { + arrElement = OBJECT_TO_JSVAL(jsobject); } if (!JS_SetElement(cx, jsretArr, i, arrElement)) { @@ -322,9 +326,11 @@ jsval ccmap_string_key_to_jsval(JSContext* cx, const cocos2d::Mapsecond; //First, check whether object is associated with js object. - js_proxy_t* jsproxy = js_get_or_create_proxy(cx, obj); - if (jsproxy) { - element = OBJECT_TO_JSVAL(jsproxy->obj); + js_type_class_t *typeClass = js_get_type_from_native(obj); + JS::RootedObject jsobject(cx, jsb_ref_get_or_create_jsobject(cx, obj, typeClass, typeid(*obj).name())); + + if (jsobject.get()) { + element = OBJECT_TO_JSVAL(jsobject); } if (!key.empty()) diff --git a/cocos/scripting/js-bindings/manual/network/jsb_socketio.cpp b/cocos/scripting/js-bindings/manual/network/jsb_socketio.cpp index 210dcf1c26..2d54941ef3 100644 --- a/cocos/scripting/js-bindings/manual/network/jsb_socketio.cpp +++ b/cocos/scripting/js-bindings/manual/network/jsb_socketio.cpp @@ -164,8 +164,7 @@ bool js_cocos2dx_SocketIO_connect(JSContext* cx, uint32_t argc, jsval* vp) if (ret) { // link the native object with the javascript object - js_proxy_t *p; - HASH_FIND_PTR(_native_js_global_ht, &ret, p); + js_proxy_t *p = jsb_get_native_proxy(ret); if(!p) { //previous connection not found, create a new one diff --git a/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp b/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp index aa330e84a8..2ae8d26ec6 100644 --- a/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp +++ b/cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp @@ -139,10 +139,9 @@ public: jsval args = OBJECT_TO_JSVAL(jsobj); ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate.ref()), "onclose", 1, &args); - JS::RootedObject wsobj(cx, p->obj); - js_proxy_t* jsproxy = jsb_get_js_proxy(wsobj); - JS::RemoveObjectRoot(cx, &jsproxy->obj); - jsb_remove_proxy(p, jsproxy); + auto copy = &p->obj; + jsb_remove_proxy(p); + JS::RemoveObjectRoot(cx, copy); CC_SAFE_DELETE(ws); } diff --git a/cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.cpp b/cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.cpp index 8b65563ebf..419dc4b603 100644 --- a/cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.cpp +++ b/cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.cpp @@ -46,7 +46,7 @@ JNIEXPORT jint JNICALL Java_org_cocos2dx_lib_Cocos2dxJavascriptJavaBridge_evalSt CCLOG("Cocos2dxJavascriptJavaBridge_evalString error, invalid string code"); return 0; } - ScriptingCore::getInstance()->evalString(strValue.c_str(), nullptr); + ScriptingCore::getInstance()->evalString(strValue.c_str()); return 1; } diff --git a/cocos/scripting/js-bindings/manual/spidermonkey_specifics.h b/cocos/scripting/js-bindings/manual/spidermonkey_specifics.h index 535752474a..e6a2292c54 100644 --- a/cocos/scripting/js-bindings/manual/spidermonkey_specifics.h +++ b/cocos/scripting/js-bindings/manual/spidermonkey_specifics.h @@ -25,19 +25,23 @@ #include "jsapi.h" #include "jsfriendapi.h" -#include "uthash.h" #include "mozilla/Maybe.h" #include +// Probably we can get rid of this struct, but since a lot of code +// depends on it, we cannot remove it easily typedef struct js_proxy { + /** the native object. usually a pointer to cocos2d::Ref, but could be a pointer to another object */ void *ptr; + /** the JS object, as a heap object. Required by GC best practices */ JS::Heap obj; - UT_hash_handle hh; + /** This is the raw pointer. The same as the "obj", but 'raw'. This is needed + because under certain circumstances JS::RemoveRootObject will be called on "obj" + and "obj" will became NULL. Which is not Ok if we need to use "obj" later for other stuff + */ + JSObject* _jsobj; } js_proxy_t; -extern js_proxy_t *_native_js_global_ht; -extern js_proxy_t *_js_native_global_ht; - typedef struct js_type_class { JSClass *jsclass; mozilla::Maybe proto; @@ -60,42 +64,6 @@ public: }; -#define JS_NEW_PROXY(p, native_obj, js_obj) \ -do { \ - p = (js_proxy_t *)malloc(sizeof(js_proxy_t)); \ - assert(p); \ - js_proxy_t* native_obj##js_obj##tmp = NULL; \ - HASH_FIND_PTR(_native_js_global_ht, &native_obj, native_obj##js_obj##tmp); \ - assert(!native_obj##js_obj##tmp); \ - p->ptr = native_obj; \ - p->obj = js_obj; \ - HASH_ADD_PTR(_native_js_global_ht, ptr, p); \ - p = (js_proxy_t *)malloc(sizeof(js_proxy_t)); \ - assert(p); \ - native_obj##js_obj##tmp = NULL; \ - HASH_FIND_PTR(_js_native_global_ht, &js_obj, native_obj##js_obj##tmp); \ - assert(!native_obj##js_obj##tmp); \ - p->ptr = native_obj; \ - p->obj = js_obj; \ - HASH_ADD_PTR(_js_native_global_ht, obj, p); \ -} while(0) \ - -#define JS_GET_PROXY(p, native_obj) \ -do { \ - HASH_FIND_PTR(_native_js_global_ht, &native_obj, p); \ -} while (0) - -#define JS_GET_NATIVE_PROXY(p, js_obj) \ -do { \ - HASH_FIND_PTR(_js_native_global_ht, &js_obj, p); \ -} while (0) - -#define JS_REMOVE_PROXY(nproxy, jsproxy) \ -do { \ - if (nproxy) { HASH_DEL(_native_js_global_ht, nproxy); free(nproxy); } \ - if (jsproxy) { HASH_DEL(_js_native_global_ht, jsproxy); free(jsproxy); } \ -} while (0) - #define TEST_NATIVE_OBJECT(cx, native_obj) \ if (!native_obj) { \ JS_ReportError(cx, "Invalid Native Object"); \ diff --git a/cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj b/cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj index ab0bc1f418..0039e587d0 100644 --- a/cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj +++ b/cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj @@ -164,6 +164,10 @@ 83A5661A18DA878400FC31A0 /* jsb_socketio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83A5661718DA878400FC31A0 /* jsb_socketio.cpp */; }; 83A5661B18DA878400FC31A0 /* jsb_socketio.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A5661818DA878400FC31A0 /* jsb_socketio.h */; }; 83A5661C18DA878400FC31A0 /* jsb_socketio.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A5661818DA878400FC31A0 /* jsb_socketio.h */; }; + ADAC23EE1C2044DC0049A6A2 /* js_module_register.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADD1C0D91C196BDF00733781 /* js_module_register.cpp */; }; + ADD1C0DC1C196BDF00733781 /* js_module_register.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADD1C0D91C196BDF00733781 /* js_module_register.cpp */; }; + ADD1C0DD1C196BDF00733781 /* js_module_register.h in Headers */ = {isa = PBXBuildFile; fileRef = ADD1C0DA1C196BDF00733781 /* js_module_register.h */; }; + ADD1C0DE1C196BDF00733781 /* js-BindingsExport.h in Headers */ = {isa = PBXBuildFile; fileRef = ADD1C0DB1C196BDF00733781 /* js-BindingsExport.h */; }; B38AD56A1B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B38AD5681B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.cpp */; }; B38AD56B1B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = B38AD5691B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.h */; }; B38AD56E1B1D38700057DD7F /* jsb_cocos2dx_experimental_video_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B38AD56C1B1D38700057DD7F /* jsb_cocos2dx_experimental_video_auto.cpp */; }; @@ -172,10 +176,10 @@ BA4095C31A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA4095C01A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp */; }; BA4095C41A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = BA4095C11A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h */; }; BA4095C51A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = BA4095C11A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h */; }; - BA9FD5D21BAC0A7600996C85 /* CCComponentJS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA9FD5D01BAC0A7600996C85 /* CCComponentJS.cpp */; settings = {ASSET_TAGS = (); }; }; - BA9FD5D31BAC0A7600996C85 /* CCComponentJS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA9FD5D01BAC0A7600996C85 /* CCComponentJS.cpp */; settings = {ASSET_TAGS = (); }; }; - BA9FD5D41BAC0A7600996C85 /* CCComponentJS.h in Headers */ = {isa = PBXBuildFile; fileRef = BA9FD5D11BAC0A7600996C85 /* CCComponentJS.h */; settings = {ASSET_TAGS = (); }; }; - BA9FD5D51BAC0A7600996C85 /* CCComponentJS.h in Headers */ = {isa = PBXBuildFile; fileRef = BA9FD5D11BAC0A7600996C85 /* CCComponentJS.h */; settings = {ASSET_TAGS = (); }; }; + BA9FD5D21BAC0A7600996C85 /* CCComponentJS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA9FD5D01BAC0A7600996C85 /* CCComponentJS.cpp */; }; + BA9FD5D31BAC0A7600996C85 /* CCComponentJS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA9FD5D01BAC0A7600996C85 /* CCComponentJS.cpp */; }; + BA9FD5D41BAC0A7600996C85 /* CCComponentJS.h in Headers */ = {isa = PBXBuildFile; fileRef = BA9FD5D11BAC0A7600996C85 /* CCComponentJS.h */; }; + BA9FD5D51BAC0A7600996C85 /* CCComponentJS.h in Headers */ = {isa = PBXBuildFile; fileRef = BA9FD5D11BAC0A7600996C85 /* CCComponentJS.h */; }; BAEE4D711AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */; }; BAEE4D721AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */; }; BAEE4D731AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BAEE4D701AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp */; }; @@ -211,7 +215,6 @@ 1A119E3C18BDF19200352BAA /* jsb_cocos2dx_spine_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_spine_auto.hpp; sourceTree = ""; }; 1A119E3E18BDF19200352BAA /* jsb_cocos2dx_studio_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_studio_auto.cpp; sourceTree = ""; }; 1A119E3F18BDF19200352BAA /* jsb_cocos2dx_studio_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_studio_auto.hpp; sourceTree = ""; }; - 1A119E4318BDF19200352BAA /* Android.mk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Android.mk; sourceTree = ""; }; 1A119E4418BDF19200352BAA /* js_bindings_chipmunk_auto_classes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_chipmunk_auto_classes.cpp; sourceTree = ""; }; 1A119E4518BDF19200352BAA /* js_bindings_chipmunk_auto_classes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_chipmunk_auto_classes.h; sourceTree = ""; }; 1A119E4618BDF19200352BAA /* js_bindings_chipmunk_auto_classes_registration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_chipmunk_auto_classes_registration.h; sourceTree = ""; }; @@ -224,7 +227,6 @@ 1A119E4D18BDF19200352BAA /* js_bindings_chipmunk_registration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_chipmunk_registration.h; sourceTree = ""; }; 1A119E4E18BDF19200352BAA /* cocos2d_specifics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocos2d_specifics.cpp; sourceTree = ""; }; 1A119E4F18BDF19200352BAA /* cocos2d_specifics.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocos2d_specifics.hpp; sourceTree = ""; }; - 1A119E5118BDF19200352BAA /* Android.mk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Android.mk; sourceTree = ""; }; 1A119E5218BDF19200352BAA /* cocosbuilder_specifics.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocosbuilder_specifics.hpp; sourceTree = ""; }; 1A119E5318BDF19200352BAA /* js_bindings_ccbreader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_ccbreader.cpp; sourceTree = ""; }; 1A119E5418BDF19200352BAA /* js_bindings_ccbreader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_ccbreader.h; sourceTree = ""; }; @@ -287,6 +289,9 @@ 4BE089EA1ADF967400D65D4B /* jsb_cocos2dx_experimental_webView_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_cocos2dx_experimental_webView_manual.h; sourceTree = ""; }; 83A5661718DA878400FC31A0 /* jsb_socketio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_socketio.cpp; sourceTree = ""; }; 83A5661818DA878400FC31A0 /* jsb_socketio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_socketio.h; sourceTree = ""; }; + ADD1C0D91C196BDF00733781 /* js_module_register.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_module_register.cpp; sourceTree = ""; }; + ADD1C0DA1C196BDF00733781 /* js_module_register.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_module_register.h; sourceTree = ""; }; + ADD1C0DB1C196BDF00733781 /* js-BindingsExport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "js-BindingsExport.h"; sourceTree = ""; }; B38AD5681B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_cocos2dx_experimental_video_manual.cpp; path = experimental/jsb_cocos2dx_experimental_video_manual.cpp; sourceTree = ""; }; B38AD5691B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsb_cocos2dx_experimental_video_manual.h; path = experimental/jsb_cocos2dx_experimental_video_manual.h; sourceTree = ""; }; B38AD56C1B1D38700057DD7F /* jsb_cocos2dx_experimental_video_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_experimental_video_auto.cpp; sourceTree = ""; }; @@ -397,6 +402,9 @@ 1A119E5018BDF19200352BAA /* cocosbuilder */, 1A119E5518BDF19200352BAA /* cocostudio */, 1A119E5918BDF19200352BAA /* extension */, + ADD1C0D91C196BDF00733781 /* js_module_register.cpp */, + ADD1C0DA1C196BDF00733781 /* js_module_register.h */, + ADD1C0DB1C196BDF00733781 /* js-BindingsExport.h */, 1A119E6118BDF19200352BAA /* js_bindings_config.h */, 1A119E6218BDF19200352BAA /* js_bindings_core.cpp */, 1A119E6318BDF19200352BAA /* js_bindings_core.h */, @@ -428,7 +436,6 @@ 1A119E4218BDF19200352BAA /* chipmunk */ = { isa = PBXGroup; children = ( - 1A119E4318BDF19200352BAA /* Android.mk */, 1A119E4418BDF19200352BAA /* js_bindings_chipmunk_auto_classes.cpp */, 1A119E4518BDF19200352BAA /* js_bindings_chipmunk_auto_classes.h */, 1A119E4618BDF19200352BAA /* js_bindings_chipmunk_auto_classes_registration.h */, @@ -446,7 +453,6 @@ 1A119E5018BDF19200352BAA /* cocosbuilder */ = { isa = PBXGroup; children = ( - 1A119E5118BDF19200352BAA /* Android.mk */, 1A119E5218BDF19200352BAA /* cocosbuilder_specifics.hpp */, 1A119E5318BDF19200352BAA /* js_bindings_ccbreader.cpp */, 1A119E5418BDF19200352BAA /* js_bindings_ccbreader.h */, @@ -629,6 +635,7 @@ 1A119F0318BDF19200352BAA /* spidermonkey_specifics.h in Headers */, 1A119EE718BDF19200352BAA /* jsb_opengl_manual.h in Headers */, 1A119ED518BDF19200352BAA /* js_bindings_core.h in Headers */, + ADD1C0DE1C196BDF00733781 /* js-BindingsExport.h in Headers */, 1A119EC318BDF19200352BAA /* js_bindings_ccbreader.h in Headers */, 1A119EDF18BDF19200352BAA /* jsb_helper.h in Headers */, 1A119ECB18BDF19200352BAA /* jsb_cocos2dx_extension_manual.h in Headers */, @@ -642,6 +649,7 @@ 42638FFF1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp in Headers */, 0541A74F1973876100E45470 /* JavaScriptObjCBridge.h in Headers */, 426390061B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h in Headers */, + ADD1C0DD1C196BDF00733781 /* js_module_register.h in Headers */, 1AB5E62D18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.hpp in Headers */, 420BBCF91AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */, 1A119ED918BDF19200352BAA /* js_bindings_opengl.h in Headers */, @@ -803,6 +811,7 @@ BAEE4D711AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */, 1A119EC518BDF19200352BAA /* jsb_cocos2dx_studio_manual.cpp in Sources */, 1A119E8F18BDF19200352BAA /* jsb_cocos2dx_extension_auto.cpp in Sources */, + ADD1C0DC1C196BDF00733781 /* js_module_register.cpp in Sources */, 1A119ED718BDF19200352BAA /* js_bindings_opengl.cpp in Sources */, 1AB5E62B18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.cpp in Sources */, 1A119E9B18BDF19200352BAA /* jsb_cocos2dx_spine_auto.cpp in Sources */, @@ -836,6 +845,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + ADAC23EE1C2044DC0049A6A2 /* js_module_register.cpp in Sources */, 0541A75B19738AD200E45470 /* JavaScriptObjCBridge.mm in Sources */, 420BBCF81AA48EE900493976 /* jsb_cocos2dx_3d_manual.cpp in Sources */, 1A119E8A18BDF19200352BAA /* jsb_cocos2dx_builder_auto.cpp in Sources */, diff --git a/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Windows/libjscocos2d.Windows.vcxproj b/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Windows/libjscocos2d.Windows.vcxproj index b5980b36de..df4c4ab6dc 100644 --- a/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Windows/libjscocos2d.Windows.vcxproj +++ b/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.Windows/libjscocos2d.Windows.vcxproj @@ -129,7 +129,7 @@ $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 - CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;_USRJSSTATIC;%(PreprocessorDefinitions) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;_USRJSSTATIC;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) true ProgramDatabase @@ -172,7 +172,7 @@ $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 - CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;_USRJSSTATIC;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) true ProgramDatabase @@ -193,7 +193,7 @@ $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manua\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 - CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;_USRJSSTATIC;%(PreprocessorDefinitions) false ProgramDatabase diff --git a/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.WindowsPhone/libjscocos2d.WindowsPhone.vcxproj b/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.WindowsPhone/libjscocos2d.WindowsPhone.vcxproj index ec659e8365..9449b37008 100644 --- a/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.WindowsPhone/libjscocos2d.WindowsPhone.vcxproj +++ b/cocos/scripting/js-bindings/proj.win8.1-universal/libjscocos2d/libjscocos2d.WindowsPhone/libjscocos2d.WindowsPhone.vcxproj @@ -94,7 +94,7 @@ $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(ProjectDir)..\..\..\manual\navmesh;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 - CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;_USRJSSTATIC;%(PreprocessorDefinitions) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;_USRJSSTATIC;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) true ProgramDatabase @@ -137,7 +137,7 @@ $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\spine;$(ProjectDir)..\..\..\manual\navmesh;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 - CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;_USRJSSTATIC;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) true ProgramDatabase @@ -158,7 +158,7 @@ $(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;$(EngineRoot)external\spidermonkey\include\winrt_8.1;$(ProjectDir)..\..\..\auto;$(ProjectDir)..\..\..\manual;$(ProjectDir)..\..\..\manual\cocostudio;$(ProjectDir)..\..\..\manual\navmesh;$(ProjectDir)..\..\..\manual\spine;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) 4800;4703;4101;4083;4700;4068;4996;%(DisableSpecificWarnings) Level3 - CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions) + CC_ENABLE_CHIPMUNK_INTEGRATION=1;_USRJSSTATIC;%(PreprocessorDefinitions) false ProgramDatabase diff --git a/cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js b/cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js index 3e88a1419b..6568a84fc1 100644 --- a/cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js +++ b/cocos/scripting/js-bindings/script/ccui/jsb_cocos2d_ui.js @@ -521,9 +521,9 @@ ccui.Widget.prototype.addTouchEventListener = function (selector, target) { function _ui_addEventListener(selector, target) { if (target === undefined) - this._addTouchEventListener(selector); + this._addEventListener(selector); else - this._addTouchEventListener(selector.bind(target)); + this._addEventListener(selector.bind(target)); } function _ui_applyEventListener(ctor) { var proto = ctor.prototype; diff --git a/cocos/scripting/js-bindings/script/extension/jsb_ext_create_apis.js b/cocos/scripting/js-bindings/script/extension/jsb_ext_create_apis.js index ab0b45867e..78672c48af 100644 --- a/cocos/scripting/js-bindings/script/extension/jsb_ext_create_apis.js +++ b/cocos/scripting/js-bindings/script/extension/jsb_ext_create_apis.js @@ -32,17 +32,25 @@ jsb.EventListenerAssetsManager.prototype._ctor = function(assetsManager, callbac -cc.ControlButton.prototype._ctor = function(label, backgroundSprite, fontSize){ - if(fontSize != undefined) - this.initWithTitleAndFontNameAndFontSize(label, backgroundSprite, fontSize); - else if(backgroundSprite != undefined) - this.initWithLabelAndBackgroundSprite(label, backgroundSprite); - else if(label != undefined) +cc.ControlButton.prototype._ctor = function(label, backgroundSprite, fontSize, fontName, autoSizeWithLabel ){ + if (autoSizeWithLabel !== undefined && backgroundSprite) { + this.initWithLabelAndBackgroundSprite(label, backgroundSprite, autoSizeWithLabel); + } + else if(fontName !== undefined && fontSize !== undefined) { + this.initWithTitleAndFontNameAndFontSize(label, fontName, fontSize); + } + else if(backgroundSprite !== undefined) { + this.initWithLabelAndBackgroundSprite(label, backgroundSprite, true); + } + else if(label !== undefined) { this.initWithBackgroundSprite(label); - else + } + else { this.init(); + } }; + cc.ControlColourPicker.prototype._ctor = function(){ this.init(); }; diff --git a/cocos/scripting/js-bindings/script/jsb_cocos2d.js b/cocos/scripting/js-bindings/script/jsb_cocos2d.js index 6c0cb46b1f..22b244374a 100644 --- a/cocos/scripting/js-bindings/script/jsb_cocos2d.js +++ b/cocos/scripting/js-bindings/script/jsb_cocos2d.js @@ -26,7 +26,7 @@ // CCConfig.js // -cc.ENGINE_VERSION = "Cocos2d-JS v3.9"; +cc.ENGINE_VERSION = "Cocos2d-JS v3.10"; cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0; cc.DIRECTOR_STATS_POSITION = {x: 0, y: 0}; @@ -2771,29 +2771,30 @@ cc.GLProgram.prototype.setUniformLocationWithMatrix2fv = function(){ var tempArray = Array.prototype.slice.call(arguments); tempArray = Array.prototype.concat.call(tempArray, 2); this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray); -} +}; cc.GLProgram.prototype.setUniformLocationWithMatrix3fv = function(){ var tempArray = Array.prototype.slice.call(arguments); tempArray = Array.prototype.concat.call(tempArray, 3); this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray); -} +}; cc.GLProgram.prototype.setUniformLocationWithMatrix4fv = function(){ var tempArray = Array.prototype.slice.call(arguments); tempArray = Array.prototype.concat.call(tempArray, 4); this.setUniformLocationWithMatrixfvUnion.apply(this, tempArray); -} +}; // // Script Component // cc._ComponentJS = cc.ComponentJS; +cc._ComponentJS.extend = cc.Class.extend; cc.ComponentJS = function (filename) { var comp = cc._ComponentJS.create(filename); var res = comp.getScriptObject(); return res; -} +}; cc.ComponentJS.extend = function (prop) { return cc._ComponentJS.extend(prop); }; diff --git a/cocos/scripting/js-bindings/script/jsb_create_apis.js b/cocos/scripting/js-bindings/script/jsb_create_apis.js index b3f24c3eb8..0001d2e9a0 100644 --- a/cocos/scripting/js-bindings/script/jsb_create_apis.js +++ b/cocos/scripting/js-bindings/script/jsb_create_apis.js @@ -254,7 +254,10 @@ _p._ctor = function(normalImage, selectedImage, three, four, five) { target = five; } callback = callback ? callback.bind(target) : null; - this.initWithNormalSprite(new cc.Sprite(normalImage), new cc.Sprite(selectedImage), disabledImage ? new cc.Sprite(disabledImage) : new cc.Sprite(normalImage), callback); + var normalSprite = new cc.Sprite(normalImage); + var selectedSprite = new cc.Sprite(selectedImage); + var disabledSprite = disabledImage ? new cc.Sprite(disabledImage) : new cc.Sprite(normalImage); + this.initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, callback); } }; diff --git a/cocos/scripting/js-bindings/script/studio/parsers/action-1.x.js b/cocos/scripting/js-bindings/script/studio/parsers/action-1.x.js index 6bcebf2734..4b4bacff60 100644 --- a/cocos/scripting/js-bindings/script/studio/parsers/action-1.x.js +++ b/cocos/scripting/js-bindings/script/studio/parsers/action-1.x.js @@ -233,6 +233,7 @@ }); }); - load.registerParser("action", "*", parser); + load.registerParser("action", "0.*", parser); + load.registerParser("action", "1.*", parser); })(ccs._load, ccs._parser); diff --git a/cocos/scripting/js-bindings/script/studio/parsers/action-2.x.js b/cocos/scripting/js-bindings/script/studio/parsers/action-2.x.js index 9a7dece156..76f284286f 100644 --- a/cocos/scripting/js-bindings/script/studio/parsers/action-2.x.js +++ b/cocos/scripting/js-bindings/script/studio/parsers/action-2.x.js @@ -310,6 +310,6 @@ }); }); - load.registerParser("action", "2.*", parser); + load.registerParser("action", "*", parser); })(ccs._load, ccs._parser); diff --git a/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-1.x.js b/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-1.x.js index c9c3efbab5..61a04a2fbf 100644 --- a/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-1.x.js +++ b/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-1.x.js @@ -287,6 +287,7 @@ }); }); - load.registerParser("timeline", "*", parser); + load.registerParser("timeline", "0.*", parser); + load.registerParser("timeline", "1.*", parser); })(ccs._load, ccs._parser); diff --git a/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js b/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js index 0a023cbdf0..eb868281b5 100644 --- a/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js +++ b/cocos/scripting/js-bindings/script/studio/parsers/timelineParser-2.x.js @@ -1777,7 +1777,7 @@ }); - load.registerParser("timeline", "2.*", parser); + load.registerParser("timeline", "*", parser); })(ccs._load, ccs._parser); diff --git a/cocos/scripting/lua-bindings/auto/api/ControlButton.lua b/cocos/scripting/lua-bindings/auto/api/ControlButton.lua index 9da8d10e83..ae6d5f4d21 100644 --- a/cocos/scripting/lua-bindings/auto/api/ControlButton.lua +++ b/cocos/scripting/lua-bindings/auto/api/ControlButton.lua @@ -286,6 +286,7 @@ -- @param self -- @param #cc.Node label -- @param #ccui.Scale9Sprite backgroundSprite +-- @param #bool adjustBackGroundSize -- @return bool#bool ret (return value: bool) -------------------------------- @@ -309,11 +310,12 @@ -- @overload self -- @overload self, cc.Node, ccui.Scale9Sprite -- @overload self, string, string, float +-- @overload self, cc.Node, ccui.Scale9Sprite, bool -- @function [parent=#ControlButton] create -- @param self --- @param #string title --- @param #string fontName --- @param #float fontSize +-- @param #cc.Node label +-- @param #ccui.Scale9Sprite backgroundSprite +-- @param #bool adjustBackGroundSize -- @return ControlButton#ControlButton ret (return value: cc.ControlButton) -------------------------------- diff --git a/cocos/scripting/lua-bindings/auto/api/Label.lua b/cocos/scripting/lua-bindings/auto/api/Label.lua index 80f5b69439..ce836e927c 100644 --- a/cocos/scripting/lua-bindings/auto/api/Label.lua +++ b/cocos/scripting/lua-bindings/auto/api/Label.lua @@ -25,6 +25,12 @@ -- @param #float height -- @return Label#Label self (return value: cc.Label) +-------------------------------- +-- +-- @function [parent=#Label] getWidth +-- @param self +-- @return float#float ret (return value: float) + -------------------------------- -- Return the text the Label is displaying. -- @function [parent=#Label] getString @@ -82,6 +88,14 @@ -- @param #float width -- @return Label#Label self (return value: cc.Label) +-------------------------------- +-- Returns the additional kerning of the Label.
+-- warning Not support system font.
+-- since v3.2.0 +-- @function [parent=#Label] getAdditionalKerning +-- @param self +-- @return float#float ret (return value: float) + -------------------------------- -- Return the user define BMFont size.
-- return The BMFont size in float value. @@ -101,6 +115,12 @@ -- @param self -- @return int#int ret (return value: int) +-------------------------------- +-- Return shadow effect offset value. +-- @function [parent=#Label] getShadowOffset +-- @param self +-- @return size_table#size_table ret (return value: size_table) + -------------------------------- -- Makes the Label to clip upper and lower margin for reduce height of Label. -- @function [parent=#Label] setClipMarginEnabled @@ -124,6 +144,12 @@ -- @param #string font -- @return Label#Label self (return value: cc.Label) +-------------------------------- +-- Return the outline effect size value. +-- @function [parent=#Label] getOutlineSize +-- @param self +-- @return int#int ret (return value: int) + -------------------------------- -- Sets a new bitmap font to Label -- @function [parent=#Label] setBMFontFilePath @@ -220,13 +246,17 @@ -- @return Label#Label self (return value: cc.Label) -------------------------------- --- Returns the additional kerning of the Label.
--- warning Not support system font.
--- since v3.2.0 --- @function [parent=#Label] getAdditionalKerning +-- Return the shadow effect blur radius. +-- @function [parent=#Label] getShadowBlurRadius -- @param self -- @return float#float ret (return value: float) +-------------------------------- +-- Return current effect color vlaue. +-- @function [parent=#Label] getEffectColor +-- @param self +-- @return color4f_table#color4f_table ret (return value: color4f_table) + -------------------------------- -- -- @function [parent=#Label] removeAllChildrenWithCleanup @@ -288,6 +318,12 @@ -- @param self -- @return float#float ret (return value: float) +-------------------------------- +-- Return the shadow effect color value. +-- @function [parent=#Label] getShadowColor +-- @param self +-- @return color4f_table#color4f_table ret (return value: color4f_table) + -------------------------------- -- Returns the TTF configuration object used by the Label.
-- see `TTFConfig` @@ -328,10 +364,10 @@ -- @return Label#Label self (return value: cc.Label) -------------------------------- --- --- @function [parent=#Label] getWidth +-- Return whether the shadow effect is enabled. +-- @function [parent=#Label] isShadowEnabled -- @param self --- @return float#float ret (return value: float) +-- @return bool#bool ret (return value: bool) -------------------------------- -- Enable glow effect to Label.
@@ -396,6 +432,12 @@ -- @param self -- @return bool#bool ret (return value: bool) +-------------------------------- +-- Return current effect type. +-- @function [parent=#Label] getLabelEffectType +-- @param self +-- @return int#int ret (return value: int) + -------------------------------- -- @overload self, int, int -- @overload self, int diff --git a/cocos/scripting/lua-bindings/auto/api/Mesh.lua b/cocos/scripting/lua-bindings/auto/api/Mesh.lua index 66f4bb433e..32cde6d633 100644 --- a/cocos/scripting/lua-bindings/auto/api/Mesh.lua +++ b/cocos/scripting/lua-bindings/auto/api/Mesh.lua @@ -16,12 +16,6 @@ -- @param self -- @return int#int ret (return value: int) --------------------------------- --- check texture each frame? --- @function [parent=#Mesh] enableCheckTexture --- @param self --- @return bool#bool ret (return value: bool) - -------------------------------- -- Sets a new Material to the Mesh -- @function [parent=#Mesh] setMaterial @@ -75,12 +69,6 @@ -- @param #string name -- @return Mesh#Mesh self (return value: cc.Mesh) --------------------------------- --- check texture --- @function [parent=#Mesh] checkTexture --- @param self --- @return Mesh#Mesh self (return value: cc.Mesh) - -------------------------------- -- Mesh index data setter -- @function [parent=#Mesh] setMeshIndexData @@ -115,13 +103,6 @@ -- @param #cc.MeshSkin skin -- @return Mesh#Mesh self (return value: cc.Mesh) --------------------------------- --- set enable check texture, check texture each frame if enable is true. It is false by default --- @function [parent=#Mesh] setEnableCheckTexture --- @param self --- @param #bool enableCheckTexture --- @return Mesh#Mesh self (return value: cc.Mesh) - -------------------------------- -- -- @function [parent=#Mesh] isVisible diff --git a/cocos/scripting/lua-bindings/auto/api/ParticleSystem3D.lua b/cocos/scripting/lua-bindings/auto/api/ParticleSystem3D.lua index 51d2580076..89ee632088 100644 --- a/cocos/scripting/lua-bindings/auto/api/ParticleSystem3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/ParticleSystem3D.lua @@ -42,6 +42,12 @@ -- @param self -- @return bool#bool ret (return value: bool) +-------------------------------- +-- return particle render +-- @function [parent=#ParticleSystem3D] getRender +-- @param self +-- @return Particle3DRender#Particle3DRender ret (return value: cc.Particle3DRender) + -------------------------------- -- set emitter for particle system, can set your own particle emitter -- @function [parent=#ParticleSystem3D] setEmitter diff --git a/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua b/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua index ae4daa569b..7b625dc3a8 100644 --- a/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua +++ b/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua @@ -37,6 +37,8 @@ -------------------------------- -- brief Toggle 9-slice feature.
-- If Scale9Sprite is 9-slice disabled, the Scale9Sprite will rendered as a normal sprite.
+-- warning: Don't use setScale9Enabled(false), use setRenderingType(RenderingType::SIMPLE) instead.
+-- The setScale9Enabled(false) is kept only for back back compatibility.
-- param enabled True to enable 9-slice, false otherwise.
-- js NA -- @function [parent=#Scale9Sprite] setScale9Enabled @@ -388,6 +390,13 @@ -- @param self -- @return float#float ret (return value: float) +-------------------------------- +-- +-- @function [parent=#Scale9Sprite] setGlobalZOrder +-- @param self +-- @param #float globalZOrder +-- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite) + -------------------------------- -- -- @function [parent=#Scale9Sprite] setScaleY diff --git a/cocos/scripting/lua-bindings/auto/api/Slider.lua b/cocos/scripting/lua-bindings/auto/api/Slider.lua index 8e57df2476..ecae510fb8 100644 --- a/cocos/scripting/lua-bindings/auto/api/Slider.lua +++ b/cocos/scripting/lua-bindings/auto/api/Slider.lua @@ -46,14 +46,6 @@ -- @param self -- @return ResourceData#ResourceData ret (return value: cc.ResourceData) --------------------------------- --- Gets capinsets for progress bar slider, if slider is using scale9 renderer.
--- return Capinsets for progress bar slider.
--- js NA --- @function [parent=#Slider] getCapInsetsProgressBarRebderer --- @param self --- @return rect_table#rect_table ret (return value: rect_table) - -------------------------------- -- Sets if slider is using scale9 renderer.
-- param able True that using scale9 renderer, false otherwise. @@ -75,6 +67,15 @@ -- @param self -- @return float#float ret (return value: float) +-------------------------------- +-- Sets capinsets for progress bar slider, if slider is using scale9 renderer.
+-- param capInsets Capinsets for progress bar slider.
+-- js NA +-- @function [parent=#Slider] setCapInsetProgressBarRenderer +-- @param self +-- @param #rect_table capInsets +-- @return Slider#Slider self (return value: ccui.Slider) + -------------------------------- -- Load textures for slider ball.
-- param normal Normal state texture.
@@ -129,6 +130,14 @@ -- @param self -- @return rect_table#rect_table ret (return value: rect_table) +-------------------------------- +-- Gets capinsets for progress bar slider, if slider is using scale9 renderer.
+-- return Capinsets for progress bar slider.
+-- js NA +-- @function [parent=#Slider] getCapInsetsProgressBarRenderer +-- @param self +-- @return rect_table#rect_table ret (return value: rect_table) + -------------------------------- -- Load pressed state texture for slider ball.
-- param pressed Pressed state texture.
@@ -158,15 +167,6 @@ -- @param self -- @return ResourceData#ResourceData ret (return value: cc.ResourceData) --------------------------------- --- Sets capinsets for progress bar slider, if slider is using scale9 renderer.
--- param capInsets Capinsets for progress bar slider.
--- js NA --- @function [parent=#Slider] setCapInsetProgressBarRebderer --- @param self --- @param #rect_table capInsets --- @return Slider#Slider self (return value: ccui.Slider) - -------------------------------- -- Sets capinsets for bar slider, if slider is using scale9 renderer.
-- param capInsets Capinsets for bar slider. diff --git a/cocos/scripting/lua-bindings/auto/api/Text.lua b/cocos/scripting/lua-bindings/auto/api/Text.lua index a2f468df33..7eadb87592 100644 --- a/cocos/scripting/lua-bindings/auto/api/Text.lua +++ b/cocos/scripting/lua-bindings/auto/api/Text.lua @@ -35,6 +35,12 @@ -- @param #int effect -- @return Text#Text self (return value: ccui.Text) +-------------------------------- +-- Return current effect type. +-- @function [parent=#Text] getLabelEffectType +-- @param self +-- @return int#int ret (return value: int) + -------------------------------- -- Gets text color.
-- return Text color. @@ -77,6 +83,12 @@ -- @param #bool enabled -- @return Text#Text self (return value: ccui.Text) +-------------------------------- +-- Return shadow effect offset value. +-- @function [parent=#Text] getShadowOffset +-- @param self +-- @return size_table#size_table ret (return value: size_table) + -------------------------------- -- -- @function [parent=#Text] setString @@ -84,6 +96,12 @@ -- @param #string text -- @return Text#Text self (return value: ccui.Text) +-------------------------------- +-- Return the outline effect size value. +-- @function [parent=#Text] getOutlineSize +-- @param self +-- @return int#int ret (return value: int) + -------------------------------- -- -- @function [parent=#Text] init @@ -93,6 +111,12 @@ -- @param #float fontSize -- @return bool#bool ret (return value: bool) +-------------------------------- +-- Return the shadow effect blur radius. +-- @function [parent=#Text] getShadowBlurRadius +-- @param self +-- @return float#float ret (return value: float) + -------------------------------- -- Gets the touch scale enabled of label.
-- return Touch scale enabled of label. @@ -145,6 +169,12 @@ -- @param #int outlineSize -- @return Text#Text self (return value: ccui.Text) +-------------------------------- +-- Return current effect color vlaue. +-- @function [parent=#Text] getEffectColor +-- @param self +-- @return color4b_table#color4b_table ret (return value: color4b_table) + -------------------------------- -- Gets the font type.
-- return The font type. @@ -159,6 +189,12 @@ -- @param self -- @return int#int ret (return value: int) +-------------------------------- +-- Return whether the shadow effect is enabled. +-- @function [parent=#Text] isShadowEnabled +-- @param self +-- @return bool#bool ret (return value: bool) + -------------------------------- -- Sets the font size of label.
-- param size The font size. @@ -167,6 +203,12 @@ -- @param #float size -- @return Text#Text self (return value: ccui.Text) +-------------------------------- +-- Return the shadow effect color value. +-- @function [parent=#Text] getShadowColor +-- @param self +-- @return color4b_table#color4b_table ret (return value: color4b_table) + -------------------------------- -- Sets text color.
-- param color Text color. diff --git a/cocos/scripting/lua-bindings/auto/api/Texture2D.lua b/cocos/scripting/lua-bindings/auto/api/Texture2D.lua index b8e0e96a08..b4b552afb4 100644 --- a/cocos/scripting/lua-bindings/auto/api/Texture2D.lua +++ b/cocos/scripting/lua-bindings/auto/api/Texture2D.lua @@ -52,13 +52,6 @@ -- @param self -- @return int#int ret (return value: int) --------------------------------- --- Set if the texture is valid, when it been set as false, it will display as default "file missing texture" --- @function [parent=#Texture2D] setValid --- @param self --- @param #bool valid --- @return Texture2D#Texture2D self (return value: cc.Texture2D) - -------------------------------- -- @overload self, int -- @overload self @@ -112,12 +105,6 @@ -- @param self -- @return size_table#size_table ret (return value: size_table) --------------------------------- --- --- @function [parent=#Texture2D] isValid --- @param self --- @return bool#bool ret (return value: bool) - -------------------------------- -- Sets alias texture parameters:
-- - GL_TEXTURE_MIN_FILTER = GL_NEAREST
diff --git a/cocos/scripting/lua-bindings/auto/api/TextureCache.lua b/cocos/scripting/lua-bindings/auto/api/TextureCache.lua index 1d09cf832b..e5825a152f 100644 --- a/cocos/scripting/lua-bindings/auto/api/TextureCache.lua +++ b/cocos/scripting/lua-bindings/auto/api/TextureCache.lua @@ -94,13 +94,6 @@ -- @param #cc.Texture2D texture -- @return string#string ret (return value: string) --------------------------------- --- --- @function [parent=#TextureCache] setDirty --- @param self --- @param #bool dirty --- @return TextureCache#TextureCache self (return value: cc.TextureCache) - -------------------------------- -- Reload texture from a new file.
-- This function is mainly for editor, won't suggest use it in game for performance reason.
@@ -122,12 +115,6 @@ -- @param self -- @return TextureCache#TextureCache self (return value: cc.TextureCache) --------------------------------- --- --- @function [parent=#TextureCache] isDirty --- @param self --- @return bool#bool ret (return value: bool) - -------------------------------- -- Deletes a texture from the cache given a texture. -- @function [parent=#TextureCache] removeTexture diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp index f71501db66..d331e4aed3 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp @@ -1843,53 +1843,6 @@ int lua_cocos2dx_3d_Mesh_getVertexSizeInBytes(lua_State* tolua_S) return 0; } -int lua_cocos2dx_3d_Mesh_enableCheckTexture(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Mesh* 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.Mesh",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Mesh_enableCheckTexture'", 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_3d_Mesh_enableCheckTexture'", nullptr); - return 0; - } - bool ret = cobj->enableCheckTexture(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Mesh:enableCheckTexture",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Mesh_enableCheckTexture'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_3d_Mesh_setMaterial(lua_State* tolua_S) { int argc = 0; @@ -2249,53 +2202,6 @@ int lua_cocos2dx_3d_Mesh_setName(lua_State* tolua_S) return 0; } -int lua_cocos2dx_3d_Mesh_checkTexture(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Mesh* 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.Mesh",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Mesh_checkTexture'", 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_3d_Mesh_checkTexture'", nullptr); - return 0; - } - cobj->checkTexture(); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Mesh:checkTexture",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Mesh_checkTexture'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_3d_Mesh_setMeshIndexData(lua_State* tolua_S) { int argc = 0; @@ -2543,56 +2449,6 @@ int lua_cocos2dx_3d_Mesh_setSkin(lua_State* tolua_S) return 0; } -int lua_cocos2dx_3d_Mesh_setEnableCheckTexture(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Mesh* 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.Mesh",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Mesh_setEnableCheckTexture'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Mesh:setEnableCheckTexture"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Mesh_setEnableCheckTexture'", nullptr); - return 0; - } - cobj->setEnableCheckTexture(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Mesh:setEnableCheckTexture",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Mesh_setEnableCheckTexture'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_3d_Mesh_isVisible(lua_State* tolua_S) { int argc = 0; @@ -2792,7 +2648,6 @@ int lua_register_cocos2dx_3d_Mesh(lua_State* tolua_S) tolua_function(tolua_S,"new",lua_cocos2dx_3d_Mesh_constructor); tolua_function(tolua_S,"getMaterial",lua_cocos2dx_3d_Mesh_getMaterial); tolua_function(tolua_S,"getVertexSizeInBytes",lua_cocos2dx_3d_Mesh_getVertexSizeInBytes); - tolua_function(tolua_S,"enableCheckTexture",lua_cocos2dx_3d_Mesh_enableCheckTexture); tolua_function(tolua_S,"setMaterial",lua_cocos2dx_3d_Mesh_setMaterial); tolua_function(tolua_S,"getName",lua_cocos2dx_3d_Mesh_getName); tolua_function(tolua_S,"getMeshVertexAttribute",lua_cocos2dx_3d_Mesh_getMeshVertexAttribute); @@ -2800,13 +2655,11 @@ int lua_register_cocos2dx_3d_Mesh(lua_State* tolua_S) tolua_function(tolua_S,"draw",lua_cocos2dx_3d_Mesh_draw); tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_3d_Mesh_getBlendFunc); tolua_function(tolua_S,"setName",lua_cocos2dx_3d_Mesh_setName); - tolua_function(tolua_S,"checkTexture",lua_cocos2dx_3d_Mesh_checkTexture); tolua_function(tolua_S,"setMeshIndexData",lua_cocos2dx_3d_Mesh_setMeshIndexData); tolua_function(tolua_S,"getMeshVertexAttribCount",lua_cocos2dx_3d_Mesh_getMeshVertexAttribCount); tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_3d_Mesh_setBlendFunc); tolua_function(tolua_S,"setForce2DQueue",lua_cocos2dx_3d_Mesh_setForce2DQueue); tolua_function(tolua_S,"setSkin",lua_cocos2dx_3d_Mesh_setSkin); - tolua_function(tolua_S,"setEnableCheckTexture",lua_cocos2dx_3d_Mesh_setEnableCheckTexture); tolua_function(tolua_S,"isVisible",lua_cocos2dx_3d_Mesh_isVisible); tolua_function(tolua_S,"setGLProgramState",lua_cocos2dx_3d_Mesh_setGLProgramState); tolua_function(tolua_S,"setVisible",lua_cocos2dx_3d_Mesh_setVisible); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp index 032c267e7f..1be0eff86c 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp @@ -146,9 +146,6 @@ int register_all_cocos2dx_3d(lua_State* tolua_S); - - - diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index 1e4ee24c1c..f4a6a48909 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -782,56 +782,6 @@ int lua_cocos2dx_Texture2D_getPixelsHigh(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Texture2D_setValid(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Texture2D* 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.Texture2D",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Texture2D*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Texture2D_setValid'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Texture2D:setValid"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Texture2D_setValid'", nullptr); - return 0; - } - cobj->setValid(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Texture2D:setValid",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Texture2D_setValid'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_Texture2D_getBitsPerPixelForFormat(lua_State* tolua_S) { int argc = 0; @@ -1275,53 +1225,6 @@ int lua_cocos2dx_Texture2D_getContentSize(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Texture2D_isValid(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::Texture2D* 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.Texture2D",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::Texture2D*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Texture2D_isValid'", 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_Texture2D_isValid'", nullptr); - return 0; - } - bool ret = cobj->isValid(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Texture2D:isValid",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Texture2D_isValid'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_Texture2D_setAliasTexParameters(lua_State* tolua_S) { int argc = 0; @@ -2022,7 +1925,6 @@ int lua_register_cocos2dx_Texture2D(lua_State* tolua_S) tolua_function(tolua_S,"releaseGLTexture",lua_cocos2dx_Texture2D_releaseGLTexture); tolua_function(tolua_S,"hasPremultipliedAlpha",lua_cocos2dx_Texture2D_hasPremultipliedAlpha); tolua_function(tolua_S,"getPixelsHigh",lua_cocos2dx_Texture2D_getPixelsHigh); - tolua_function(tolua_S,"setValid",lua_cocos2dx_Texture2D_setValid); tolua_function(tolua_S,"getBitsPerPixelForFormat",lua_cocos2dx_Texture2D_getBitsPerPixelForFormat); tolua_function(tolua_S,"getName",lua_cocos2dx_Texture2D_getName); tolua_function(tolua_S,"initWithString",lua_cocos2dx_Texture2D_initWithString); @@ -2030,7 +1932,6 @@ int lua_register_cocos2dx_Texture2D(lua_State* tolua_S) tolua_function(tolua_S,"getPath",lua_cocos2dx_Texture2D_getPath); tolua_function(tolua_S,"drawInRect",lua_cocos2dx_Texture2D_drawInRect); tolua_function(tolua_S,"getContentSize",lua_cocos2dx_Texture2D_getContentSize); - tolua_function(tolua_S,"isValid",lua_cocos2dx_Texture2D_isValid); tolua_function(tolua_S,"setAliasTexParameters",lua_cocos2dx_Texture2D_setAliasTexParameters); tolua_function(tolua_S,"setAntiAliasTexParameters",lua_cocos2dx_Texture2D_setAntiAliasTexParameters); tolua_function(tolua_S,"generateMipmap",lua_cocos2dx_Texture2D_generateMipmap); @@ -51243,6 +51144,53 @@ int lua_cocos2dx_Label_setDimensions(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Label_getWidth(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Label* 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.Label",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getWidth'", 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_Label_getWidth'", nullptr); + return 0; + } + double ret = cobj->getWidth(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getWidth",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getWidth'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Label_getString(lua_State* tolua_S) { int argc = 0; @@ -51632,6 +51580,53 @@ int lua_cocos2dx_Label_setWidth(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Label_getAdditionalKerning(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Label* 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.Label",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getAdditionalKerning'", 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_Label_getAdditionalKerning'", nullptr); + return 0; + } + double ret = cobj->getAdditionalKerning(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getAdditionalKerning",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getAdditionalKerning'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Label_getBMFontSize(lua_State* tolua_S) { int argc = 0; @@ -51773,6 +51768,53 @@ int lua_cocos2dx_Label_getHorizontalAlignment(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Label_getShadowOffset(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Label* 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.Label",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getShadowOffset'", 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_Label_getShadowOffset'", nullptr); + return 0; + } + cocos2d::Size ret = cobj->getShadowOffset(); + size_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getShadowOffset",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getShadowOffset'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Label_setClipMarginEnabled(lua_State* tolua_S) { int argc = 0; @@ -51923,6 +51965,53 @@ int lua_cocos2dx_Label_setSystemFontName(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Label_getOutlineSize(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Label* 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.Label",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getOutlineSize'", 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_Label_getOutlineSize'", nullptr); + return 0; + } + int ret = cobj->getOutlineSize(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getOutlineSize",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getOutlineSize'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Label_setBMFontFilePath(lua_State* tolua_S) { int argc = 0; @@ -52707,7 +52796,7 @@ int lua_cocos2dx_Label_enableOutline(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Label_getAdditionalKerning(lua_State* tolua_S) +int lua_cocos2dx_Label_getShadowBlurRadius(lua_State* tolua_S) { int argc = 0; cocos2d::Label* cobj = nullptr; @@ -52727,7 +52816,7 @@ int lua_cocos2dx_Label_getAdditionalKerning(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getAdditionalKerning'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getShadowBlurRadius'", nullptr); return 0; } #endif @@ -52737,19 +52826,66 @@ int lua_cocos2dx_Label_getAdditionalKerning(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getAdditionalKerning'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getShadowBlurRadius'", nullptr); return 0; } - double ret = cobj->getAdditionalKerning(); + double ret = cobj->getShadowBlurRadius(); tolua_pushnumber(tolua_S,(lua_Number)ret); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getAdditionalKerning",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getShadowBlurRadius",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getAdditionalKerning'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getShadowBlurRadius'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_Label_getEffectColor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Label* 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.Label",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getEffectColor'", 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_Label_getEffectColor'", nullptr); + return 0; + } + cocos2d::Color4F ret = cobj->getEffectColor(); + color4f_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getEffectColor",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getEffectColor'.",&tolua_err); #endif return 0; @@ -53186,6 +53322,53 @@ int lua_cocos2dx_Label_getLineHeight(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Label_getShadowColor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Label* 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.Label",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getShadowColor'", 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_Label_getShadowColor'", nullptr); + return 0; + } + cocos2d::Color4F ret = cobj->getShadowColor(); + color4f_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getShadowColor",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getShadowColor'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Label_getTTFConfig(lua_State* tolua_S) { int argc = 0; @@ -53430,7 +53613,7 @@ int lua_cocos2dx_Label_setHeight(lua_State* tolua_S) return 0; } -int lua_cocos2dx_Label_getWidth(lua_State* tolua_S) +int lua_cocos2dx_Label_isShadowEnabled(lua_State* tolua_S) { int argc = 0; cocos2d::Label* cobj = nullptr; @@ -53450,7 +53633,7 @@ int lua_cocos2dx_Label_getWidth(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getWidth'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_isShadowEnabled'", nullptr); return 0; } #endif @@ -53460,19 +53643,19 @@ int lua_cocos2dx_Label_getWidth(lua_State* tolua_S) { if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_getWidth'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_isShadowEnabled'", nullptr); return 0; } - double ret = cobj->getWidth(); - tolua_pushnumber(tolua_S,(lua_Number)ret); + bool ret = cobj->isShadowEnabled(); + tolua_pushboolean(tolua_S,(bool)ret); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getWidth",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:isShadowEnabled",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getWidth'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_isShadowEnabled'.",&tolua_err); #endif return 0; @@ -53912,6 +54095,53 @@ int lua_cocos2dx_Label_isWrapEnabled(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Label_getLabelEffectType(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Label* 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.Label",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_getLabelEffectType'", 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_Label_getLabelEffectType'", nullptr); + return 0; + } + int ret = (int)cobj->getLabelEffectType(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:getLabelEffectType",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Label_getLabelEffectType'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Label_setAlignment(lua_State* tolua_S) { int argc = 0; @@ -54394,6 +54624,7 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S) tolua_function(tolua_S,"isClipMarginEnabled",lua_cocos2dx_Label_isClipMarginEnabled); tolua_function(tolua_S,"enableShadow",lua_cocos2dx_Label_enableShadow); tolua_function(tolua_S,"setDimensions",lua_cocos2dx_Label_setDimensions); + tolua_function(tolua_S,"getWidth",lua_cocos2dx_Label_getWidth); tolua_function(tolua_S,"getString",lua_cocos2dx_Label_getString); tolua_function(tolua_S,"getHeight",lua_cocos2dx_Label_getHeight); tolua_function(tolua_S,"disableEffect",lua_cocos2dx_Label_disableEffect); @@ -54402,12 +54633,15 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S) tolua_function(tolua_S,"getBlendFunc",lua_cocos2dx_Label_getBlendFunc); tolua_function(tolua_S,"enableWrap",lua_cocos2dx_Label_enableWrap); tolua_function(tolua_S,"setWidth",lua_cocos2dx_Label_setWidth); + tolua_function(tolua_S,"getAdditionalKerning",lua_cocos2dx_Label_getAdditionalKerning); tolua_function(tolua_S,"getBMFontSize",lua_cocos2dx_Label_getBMFontSize); tolua_function(tolua_S,"getMaxLineWidth",lua_cocos2dx_Label_getMaxLineWidth); tolua_function(tolua_S,"getHorizontalAlignment",lua_cocos2dx_Label_getHorizontalAlignment); + tolua_function(tolua_S,"getShadowOffset",lua_cocos2dx_Label_getShadowOffset); tolua_function(tolua_S,"setClipMarginEnabled",lua_cocos2dx_Label_setClipMarginEnabled); tolua_function(tolua_S,"setString",lua_cocos2dx_Label_setString); tolua_function(tolua_S,"setSystemFontName",lua_cocos2dx_Label_setSystemFontName); + tolua_function(tolua_S,"getOutlineSize",lua_cocos2dx_Label_getOutlineSize); tolua_function(tolua_S,"setBMFontFilePath",lua_cocos2dx_Label_setBMFontFilePath); tolua_function(tolua_S,"initWithTTF",lua_cocos2dx_Label_initWithTTF); tolua_function(tolua_S,"getFontAtlas",lua_cocos2dx_Label_getFontAtlas); @@ -54420,7 +54654,8 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S) tolua_function(tolua_S,"setLineBreakWithoutSpace",lua_cocos2dx_Label_setLineBreakWithoutSpace); tolua_function(tolua_S,"getStringNumLines",lua_cocos2dx_Label_getStringNumLines); tolua_function(tolua_S,"enableOutline",lua_cocos2dx_Label_enableOutline); - tolua_function(tolua_S,"getAdditionalKerning",lua_cocos2dx_Label_getAdditionalKerning); + tolua_function(tolua_S,"getShadowBlurRadius",lua_cocos2dx_Label_getShadowBlurRadius); + tolua_function(tolua_S,"getEffectColor",lua_cocos2dx_Label_getEffectColor); tolua_function(tolua_S,"removeAllChildrenWithCleanup",lua_cocos2dx_Label_removeAllChildrenWithCleanup); tolua_function(tolua_S,"setCharMap",lua_cocos2dx_Label_setCharMap); tolua_function(tolua_S,"getDimensions",lua_cocos2dx_Label_getDimensions); @@ -54429,12 +54664,13 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S) tolua_function(tolua_S,"setVerticalAlignment",lua_cocos2dx_Label_setVerticalAlignment); tolua_function(tolua_S,"setLineSpacing",lua_cocos2dx_Label_setLineSpacing); tolua_function(tolua_S,"getLineHeight",lua_cocos2dx_Label_getLineHeight); + tolua_function(tolua_S,"getShadowColor",lua_cocos2dx_Label_getShadowColor); tolua_function(tolua_S,"getTTFConfig",lua_cocos2dx_Label_getTTFConfig); tolua_function(tolua_S,"getVerticalAlignment",lua_cocos2dx_Label_getVerticalAlignment); tolua_function(tolua_S,"setTextColor",lua_cocos2dx_Label_setTextColor); tolua_function(tolua_S,"getLetter",lua_cocos2dx_Label_getLetter); tolua_function(tolua_S,"setHeight",lua_cocos2dx_Label_setHeight); - tolua_function(tolua_S,"getWidth",lua_cocos2dx_Label_getWidth); + tolua_function(tolua_S,"isShadowEnabled",lua_cocos2dx_Label_isShadowEnabled); tolua_function(tolua_S,"enableGlow",lua_cocos2dx_Label_enableGlow); tolua_function(tolua_S,"getOverflow",lua_cocos2dx_Label_getOverflow); tolua_function(tolua_S,"setAdditionalKerning",lua_cocos2dx_Label_setAdditionalKerning); @@ -54444,6 +54680,7 @@ int lua_register_cocos2dx_Label(lua_State* tolua_S) tolua_function(tolua_S,"getBMFontFilePath",lua_cocos2dx_Label_getBMFontFilePath); tolua_function(tolua_S,"setHorizontalAlignment",lua_cocos2dx_Label_setHorizontalAlignment); tolua_function(tolua_S,"isWrapEnabled",lua_cocos2dx_Label_isWrapEnabled); + tolua_function(tolua_S,"getLabelEffectType",lua_cocos2dx_Label_getLabelEffectType); tolua_function(tolua_S,"setAlignment",lua_cocos2dx_Label_setAlignment); tolua_function(tolua_S,"requestSystemFontRefresh",lua_cocos2dx_Label_requestSystemFontRefresh); tolua_function(tolua_S,"setBMFontSize",lua_cocos2dx_Label_setBMFontSize); @@ -88321,56 +88558,6 @@ int lua_cocos2dx_TextureCache_getTextureFilePath(lua_State* tolua_S) return 0; } -int lua_cocos2dx_TextureCache_setDirty(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::TextureCache* 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.TextureCache",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::TextureCache*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TextureCache_setDirty'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - bool arg0; - - ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.TextureCache:setDirty"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TextureCache_setDirty'", nullptr); - return 0; - } - cobj->setDirty(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TextureCache:setDirty",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TextureCache_setDirty'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_TextureCache_renameTextureWithKey(lua_State* tolua_S) { int argc = 0; @@ -88471,53 +88658,6 @@ int lua_cocos2dx_TextureCache_removeUnusedTextures(lua_State* tolua_S) return 0; } -int lua_cocos2dx_TextureCache_isDirty(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::TextureCache* 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.TextureCache",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::TextureCache*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TextureCache_isDirty'", 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_TextureCache_isDirty'", nullptr); - return 0; - } - bool ret = cobj->isDirty(); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TextureCache:isDirty",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TextureCache_isDirty'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_TextureCache_removeTexture(lua_State* tolua_S) { int argc = 0; @@ -88675,10 +88815,8 @@ int lua_register_cocos2dx_TextureCache(lua_State* tolua_S) tolua_function(tolua_S,"unbindImageAsync",lua_cocos2dx_TextureCache_unbindImageAsync); tolua_function(tolua_S,"getTextureForKey",lua_cocos2dx_TextureCache_getTextureForKey); tolua_function(tolua_S,"getTextureFilePath",lua_cocos2dx_TextureCache_getTextureFilePath); - tolua_function(tolua_S,"setDirty",lua_cocos2dx_TextureCache_setDirty); tolua_function(tolua_S,"renameTextureWithKey",lua_cocos2dx_TextureCache_renameTextureWithKey); tolua_function(tolua_S,"removeUnusedTextures",lua_cocos2dx_TextureCache_removeUnusedTextures); - tolua_function(tolua_S,"isDirty",lua_cocos2dx_TextureCache_isDirty); tolua_function(tolua_S,"removeTexture",lua_cocos2dx_TextureCache_removeTexture); tolua_function(tolua_S,"waitForQuit",lua_cocos2dx_TextureCache_waitForQuit); tolua_endmodule(tolua_S); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index f1b53ac43b..c5ea706f82 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -2173,6 +2173,9 @@ int register_all_cocos2dx(lua_State* tolua_S); + + + diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp index 895c676c35..c4692ef4f1 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.cpp @@ -2466,24 +2466,27 @@ int lua_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite(lua_St #endif argc = lua_gettop(tolua_S)-1; - if (argc == 2) + if (argc == 3) { cocos2d::Node* arg0; cocos2d::ui::Scale9Sprite* arg1; + bool arg2; ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "cc.ControlButton:initWithLabelAndBackgroundSprite"); ok &= luaval_to_object(tolua_S, 3, "ccui.Scale9Sprite",&arg1, "cc.ControlButton:initWithLabelAndBackgroundSprite"); + + ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.ControlButton:initWithLabelAndBackgroundSprite"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_extension_ControlButton_initWithLabelAndBackgroundSprite'", nullptr); return 0; } - bool ret = cobj->initWithLabelAndBackgroundSprite(arg0, arg1); + bool ret = cobj->initWithLabelAndBackgroundSprite(arg0, arg1, arg2); tolua_pushboolean(tolua_S,(bool)ret); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ControlButton:initWithLabelAndBackgroundSprite",argc, 2); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ControlButton:initWithLabelAndBackgroundSprite",argc, 3); return 0; #if COCOS2D_DEBUG >= 1 @@ -2662,6 +2665,25 @@ int lua_cocos2dx_extension_ControlButton_create(lua_State* tolua_S) } } while (0); ok = true; + do + { + if (argc == 3) + { + cocos2d::Node* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Node",&arg0, "cc.ControlButton:create"); + if (!ok) { break; } + cocos2d::ui::Scale9Sprite* arg1; + ok &= luaval_to_object(tolua_S, 3, "ccui.Scale9Sprite",&arg1, "cc.ControlButton:create"); + if (!ok) { break; } + bool arg2; + ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.ControlButton:create"); + if (!ok) { break; } + cocos2d::extension::ControlButton* ret = cocos2d::extension::ControlButton::create(arg0, arg1, arg2); + object_to_luaval(tolua_S, "cc.ControlButton",(cocos2d::extension::ControlButton*)ret); + return 1; + } + } while (0); + ok = true; luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.ControlButton:create",argc, 3); return 0; #if COCOS2D_DEBUG >= 1 @@ -13296,6 +13318,53 @@ int lua_cocos2dx_extension_ParticleSystem3D_isEnabled(lua_State* tolua_S) return 0; } +int lua_cocos2dx_extension_ParticleSystem3D_getRender(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ParticleSystem3D* 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.ParticleSystem3D",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ParticleSystem3D*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_extension_ParticleSystem3D_getRender'", 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_extension_ParticleSystem3D_getRender'", nullptr); + return 0; + } + cocos2d::Particle3DRender* ret = cobj->getRender(); + object_to_luaval(tolua_S, "cc.Particle3DRender",(cocos2d::Particle3DRender*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.ParticleSystem3D:getRender",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_extension_ParticleSystem3D_getRender'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_extension_ParticleSystem3D_setEmitter(lua_State* tolua_S) { int argc = 0; @@ -13981,6 +14050,7 @@ int lua_register_cocos2dx_extension_ParticleSystem3D(lua_State* tolua_S) tolua_function(tolua_S,"addAffector",lua_cocos2dx_extension_ParticleSystem3D_addAffector); tolua_function(tolua_S,"startParticleSystem",lua_cocos2dx_extension_ParticleSystem3D_startParticleSystem); tolua_function(tolua_S,"isEnabled",lua_cocos2dx_extension_ParticleSystem3D_isEnabled); + tolua_function(tolua_S,"getRender",lua_cocos2dx_extension_ParticleSystem3D_getRender); tolua_function(tolua_S,"setEmitter",lua_cocos2dx_extension_ParticleSystem3D_setEmitter); tolua_function(tolua_S,"isKeepLocal",lua_cocos2dx_extension_ParticleSystem3D_isKeepLocal); tolua_function(tolua_S,"setEnabled",lua_cocos2dx_extension_ParticleSystem3D_setEnabled); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp index c7a29df579..089d889ac6 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_extension_auto.hpp @@ -342,6 +342,7 @@ int register_all_cocos2dx_extension(lua_State* tolua_S); + #endif // __cocos2dx_extension_h__ diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp index 845968cd4e..88275c8e48 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp @@ -11530,6 +11530,53 @@ int lua_cocos2dx_ui_Text_disableEffect(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Text_getLabelEffectType(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Text* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_getLabelEffectType'", 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_ui_Text_getLabelEffectType'", nullptr); + return 0; + } + int ret = (int)cobj->getLabelEffectType(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:getLabelEffectType",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_getLabelEffectType'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Text_getTextColor(lua_State* tolua_S) { int argc = 0; @@ -11727,6 +11774,53 @@ int lua_cocos2dx_ui_Text_setTouchScaleChangeEnabled(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Text_getShadowOffset(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Text* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_getShadowOffset'", 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_ui_Text_getShadowOffset'", nullptr); + return 0; + } + cocos2d::Size ret = cobj->getShadowOffset(); + size_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:getShadowOffset",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_getShadowOffset'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Text_setString(lua_State* tolua_S) { int argc = 0; @@ -11777,6 +11871,53 @@ int lua_cocos2dx_ui_Text_setString(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Text_getOutlineSize(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Text* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_getOutlineSize'", 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_ui_Text_getOutlineSize'", nullptr); + return 0; + } + int ret = cobj->getOutlineSize(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:getOutlineSize",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_getOutlineSize'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Text_init(lua_State* tolua_S) { int argc = 0; @@ -11833,6 +11974,53 @@ int lua_cocos2dx_ui_Text_init(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Text_getShadowBlurRadius(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Text* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_getShadowBlurRadius'", 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_ui_Text_getShadowBlurRadius'", nullptr); + return 0; + } + double ret = cobj->getShadowBlurRadius(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:getShadowBlurRadius",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_getShadowBlurRadius'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Text_isTouchScaleChangeEnabled(lua_State* tolua_S) { int argc = 0; @@ -12138,6 +12326,53 @@ int lua_cocos2dx_ui_Text_enableOutline(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Text_getEffectColor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Text* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_getEffectColor'", 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_ui_Text_getEffectColor'", nullptr); + return 0; + } + cocos2d::Color4B ret = cobj->getEffectColor(); + color4b_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:getEffectColor",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_getEffectColor'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Text_getType(lua_State* tolua_S) { int argc = 0; @@ -12232,6 +12467,53 @@ int lua_cocos2dx_ui_Text_getTextHorizontalAlignment(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Text_isShadowEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Text* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_isShadowEnabled'", 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_ui_Text_isShadowEnabled'", nullptr); + return 0; + } + bool ret = cobj->isShadowEnabled(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:isShadowEnabled",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_isShadowEnabled'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Text_setFontSize(lua_State* tolua_S) { int argc = 0; @@ -12282,6 +12564,53 @@ int lua_cocos2dx_ui_Text_setFontSize(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Text_getShadowColor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Text* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Text",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Text*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Text_getShadowColor'", 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_ui_Text_getShadowColor'", nullptr); + return 0; + } + cocos2d::Color4B ret = cobj->getShadowColor(); + color4b_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Text:getShadowColor",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Text_getShadowColor'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Text_setTextColor(lua_State* tolua_S) { int argc = 0; @@ -12665,21 +12994,28 @@ int lua_register_cocos2dx_ui_Text(lua_State* tolua_S) tolua_function(tolua_S,"getFontSize",lua_cocos2dx_ui_Text_getFontSize); tolua_function(tolua_S,"getString",lua_cocos2dx_ui_Text_getString); tolua_function(tolua_S,"disableEffect",lua_cocos2dx_ui_Text_disableEffect); + tolua_function(tolua_S,"getLabelEffectType",lua_cocos2dx_ui_Text_getLabelEffectType); tolua_function(tolua_S,"getTextColor",lua_cocos2dx_ui_Text_getTextColor); tolua_function(tolua_S,"setTextVerticalAlignment",lua_cocos2dx_ui_Text_setTextVerticalAlignment); tolua_function(tolua_S,"setFontName",lua_cocos2dx_ui_Text_setFontName); tolua_function(tolua_S,"setTouchScaleChangeEnabled",lua_cocos2dx_ui_Text_setTouchScaleChangeEnabled); + tolua_function(tolua_S,"getShadowOffset",lua_cocos2dx_ui_Text_getShadowOffset); tolua_function(tolua_S,"setString",lua_cocos2dx_ui_Text_setString); + tolua_function(tolua_S,"getOutlineSize",lua_cocos2dx_ui_Text_getOutlineSize); tolua_function(tolua_S,"init",lua_cocos2dx_ui_Text_init); + tolua_function(tolua_S,"getShadowBlurRadius",lua_cocos2dx_ui_Text_getShadowBlurRadius); tolua_function(tolua_S,"isTouchScaleChangeEnabled",lua_cocos2dx_ui_Text_isTouchScaleChangeEnabled); tolua_function(tolua_S,"getFontName",lua_cocos2dx_ui_Text_getFontName); tolua_function(tolua_S,"setTextAreaSize",lua_cocos2dx_ui_Text_setTextAreaSize); tolua_function(tolua_S,"getStringLength",lua_cocos2dx_ui_Text_getStringLength); tolua_function(tolua_S,"getAutoRenderSize",lua_cocos2dx_ui_Text_getAutoRenderSize); tolua_function(tolua_S,"enableOutline",lua_cocos2dx_ui_Text_enableOutline); + tolua_function(tolua_S,"getEffectColor",lua_cocos2dx_ui_Text_getEffectColor); tolua_function(tolua_S,"getType",lua_cocos2dx_ui_Text_getType); tolua_function(tolua_S,"getTextHorizontalAlignment",lua_cocos2dx_ui_Text_getTextHorizontalAlignment); + tolua_function(tolua_S,"isShadowEnabled",lua_cocos2dx_ui_Text_isShadowEnabled); tolua_function(tolua_S,"setFontSize",lua_cocos2dx_ui_Text_setFontSize); + tolua_function(tolua_S,"getShadowColor",lua_cocos2dx_ui_Text_getShadowColor); tolua_function(tolua_S,"setTextColor",lua_cocos2dx_ui_Text_setTextColor); tolua_function(tolua_S,"enableGlow",lua_cocos2dx_ui_Text_enableGlow); tolua_function(tolua_S,"getTextVerticalAlignment",lua_cocos2dx_ui_Text_getTextVerticalAlignment); @@ -18496,53 +18832,6 @@ int lua_cocos2dx_ui_Slider_getBallNormalFile(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Slider* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer'", 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_ui_Slider_getCapInsetsProgressBarRebderer'", nullptr); - return 0; - } - const cocos2d::Rect& ret = cobj->getCapInsetsProgressBarRebderer(); - rect_to_luaval(tolua_S, ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getCapInsetsProgressBarRebderer",argc, 0); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Slider_setScale9Enabled(lua_State* tolua_S) { int argc = 0; @@ -18687,6 +18976,56 @@ int lua_cocos2dx_ui_Slider_getZoomScale(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Rect arg0; + + ok &= luaval_to_rect(tolua_S, 2, &arg0, "ccui.Slider:setCapInsetProgressBarRenderer"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer'", nullptr); + return 0; + } + cobj->setCapInsetProgressBarRenderer(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:setCapInsetProgressBarRenderer",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Slider_loadSlidBallTextures(lua_State* tolua_S) { int argc = 0; @@ -19062,6 +19401,53 @@ int lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer'", 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_ui_Slider_getCapInsetsProgressBarRenderer'", nullptr); + return 0; + } + const cocos2d::Rect& ret = cobj->getCapInsetsProgressBarRenderer(); + rect_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:getCapInsetsProgressBarRenderer",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed(lua_State* tolua_S) { int argc = 0; @@ -19270,56 +19656,6 @@ int lua_cocos2dx_ui_Slider_getBallDisabledFile(lua_State* tolua_S) return 0; } -int lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::ui::Slider* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - cocos2d::Rect arg0; - - ok &= luaval_to_rect(tolua_S, 2, &arg0, "ccui.Slider:setCapInsetProgressBarRebderer"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer'", nullptr); - return 0; - } - cobj->setCapInsetProgressBarRebderer(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:setCapInsetProgressBarRebderer",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_ui_Slider_setCapInsetsBarRenderer(lua_State* tolua_S) { int argc = 0; @@ -19740,21 +20076,21 @@ int lua_register_cocos2dx_ui_Slider(lua_State* tolua_S) tolua_function(tolua_S,"loadSlidBallTextureNormal",lua_cocos2dx_ui_Slider_loadSlidBallTextureNormal); tolua_function(tolua_S,"loadProgressBarTexture",lua_cocos2dx_ui_Slider_loadProgressBarTexture); tolua_function(tolua_S,"getBallNormalFile",lua_cocos2dx_ui_Slider_getBallNormalFile); - tolua_function(tolua_S,"getCapInsetsProgressBarRebderer",lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRebderer); tolua_function(tolua_S,"setScale9Enabled",lua_cocos2dx_ui_Slider_setScale9Enabled); tolua_function(tolua_S,"getBallPressedFile",lua_cocos2dx_ui_Slider_getBallPressedFile); tolua_function(tolua_S,"getZoomScale",lua_cocos2dx_ui_Slider_getZoomScale); + tolua_function(tolua_S,"setCapInsetProgressBarRenderer",lua_cocos2dx_ui_Slider_setCapInsetProgressBarRenderer); tolua_function(tolua_S,"loadSlidBallTextures",lua_cocos2dx_ui_Slider_loadSlidBallTextures); tolua_function(tolua_S,"addEventListener",lua_cocos2dx_ui_Slider_addEventListener); tolua_function(tolua_S,"setMaxPercent",lua_cocos2dx_ui_Slider_setMaxPercent); tolua_function(tolua_S,"loadBarTexture",lua_cocos2dx_ui_Slider_loadBarTexture); tolua_function(tolua_S,"getProgressBarFile",lua_cocos2dx_ui_Slider_getProgressBarFile); tolua_function(tolua_S,"getCapInsetsBarRenderer",lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer); + tolua_function(tolua_S,"getCapInsetsProgressBarRenderer",lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer); tolua_function(tolua_S,"loadSlidBallTexturePressed",lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed); tolua_function(tolua_S,"getBackFile",lua_cocos2dx_ui_Slider_getBackFile); tolua_function(tolua_S,"isScale9Enabled",lua_cocos2dx_ui_Slider_isScale9Enabled); tolua_function(tolua_S,"getBallDisabledFile",lua_cocos2dx_ui_Slider_getBallDisabledFile); - tolua_function(tolua_S,"setCapInsetProgressBarRebderer",lua_cocos2dx_ui_Slider_setCapInsetProgressBarRebderer); tolua_function(tolua_S,"setCapInsetsBarRenderer",lua_cocos2dx_ui_Slider_setCapInsetsBarRenderer); tolua_function(tolua_S,"getPercent",lua_cocos2dx_ui_Slider_getPercent); tolua_function(tolua_S,"setCapInsets",lua_cocos2dx_ui_Slider_setCapInsets); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp index 53e67879ca..abef41775e 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp @@ -650,6 +650,13 @@ int register_all_cocos2dx_ui(lua_State* tolua_S); + + + + + + + diff --git a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj index 6ad467fe05..0092be9288 100644 --- a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj +++ b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj @@ -287,6 +287,10 @@ BA0CBB5F1BB0756F00003364 /* CCComponentLua.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA0CBB5C1BB0756F00003364 /* CCComponentLua.cpp */; settings = {ASSET_TAGS = (); }; }; BA0CBB601BB0756F00003364 /* CCComponentLua.h in Headers */ = {isa = PBXBuildFile; fileRef = BA0CBB5D1BB0756F00003364 /* CCComponentLua.h */; settings = {ASSET_TAGS = (); }; }; BA0CBB611BB0756F00003364 /* CCComponentLua.h in Headers */ = {isa = PBXBuildFile; fileRef = BA0CBB5D1BB0756F00003364 /* CCComponentLua.h */; settings = {ASSET_TAGS = (); }; }; + ADAC23ED1C2044A60049A6A2 /* lua_module_register.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADD1C0D21C196B9500733781 /* lua_module_register.cpp */; }; + ADD1C0D51C196B9500733781 /* lua_module_register.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADD1C0D21C196B9500733781 /* lua_module_register.cpp */; }; + ADD1C0D61C196B9500733781 /* lua_module_register.h in Headers */ = {isa = PBXBuildFile; fileRef = ADD1C0D31C196B9500733781 /* lua_module_register.h */; }; + ADD1C0D71C196B9500733781 /* Lua-BindingsExport.h in Headers */ = {isa = PBXBuildFile; fileRef = ADD1C0D41C196B9500733781 /* Lua-BindingsExport.h */; }; F4FE0D5719ECD00100B8B12B /* luasocket_scripts.c in Sources */ = {isa = PBXBuildFile; fileRef = F4FE0D5519ECD00100B8B12B /* luasocket_scripts.c */; }; F4FE0D5819ECD00100B8B12B /* luasocket_scripts.c in Sources */ = {isa = PBXBuildFile; fileRef = F4FE0D5519ECD00100B8B12B /* luasocket_scripts.c */; }; F4FE0D5919ECD00100B8B12B /* luasocket_scripts.h in Headers */ = {isa = PBXBuildFile; fileRef = F4FE0D5619ECD00100B8B12B /* luasocket_scripts.h */; }; @@ -445,6 +449,9 @@ 3E2BDB0919C5E6100055CDCD /* lua_cocos2dx_audioengine_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_cocos2dx_audioengine_manual.h; sourceTree = ""; }; 566F015D19B5EB0F00FCA620 /* CustomGUIReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomGUIReader.cpp; sourceTree = ""; }; 566F015E19B5EB0F00FCA620 /* CustomGUIReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomGUIReader.h; sourceTree = ""; }; + ADD1C0D21C196B9500733781 /* lua_module_register.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_module_register.cpp; sourceTree = ""; }; + ADD1C0D31C196B9500733781 /* lua_module_register.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_module_register.h; sourceTree = ""; }; + ADD1C0D41C196B9500733781 /* Lua-BindingsExport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Lua-BindingsExport.h"; sourceTree = ""; }; BA0CBB5C1BB0756F00003364 /* CCComponentLua.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCComponentLua.cpp; sourceTree = ""; }; BA0CBB5D1BB0756F00003364 /* CCComponentLua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCComponentLua.h; sourceTree = ""; }; C0D9BAFA1974D30000EC35BB /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = ../../../../external/lua/lua/prebuilt/ios/liblua.a; sourceTree = ""; }; @@ -680,6 +687,9 @@ 15C1BD141986526C00A46ACC /* spine */, 15C1BD191986526C00A46ACC /* ui */, 15C1BCD21986525900A46ACC /* cocos2d */, + ADD1C0D21C196B9500733781 /* lua_module_register.cpp */, + ADD1C0D31C196B9500733781 /* lua_module_register.h */, + ADD1C0D41C196B9500733781 /* Lua-BindingsExport.h */, 1AACE76018BC45C200215002 /* CCLuaBridge.cpp */, 1AACE76118BC45C200215002 /* CCLuaBridge.h */, 1AACE76218BC45C200215002 /* CCLuaEngine.cpp */, @@ -857,6 +867,7 @@ 15415AAB19A71A53004F1E71 /* buffer.h in Headers */, 15AC69DE1987711400D17520 /* lauxlib.h in Headers */, 155C7E1419A71CA800F08B25 /* Lua_web_socket.h in Headers */, + ADD1C0D61C196B9500733781 /* lua_module_register.h in Headers */, 15AC69DF1987711400D17520 /* lua.h in Headers */, 15AC69E01987711400D17520 /* luaconf.h in Headers */, 155C7DF819A71C4400F08B25 /* lua_cocos2dx_cocosdenshion_manual.h in Headers */, @@ -888,6 +899,7 @@ 15415AD319A71A53004F1E71 /* timeout.h in Headers */, 15C1C2D5198749BC00A46ACC /* LuaOpengl.h in Headers */, 15A561EE1B00A3F1005D4720 /* lua_cocos2dx_physics3d_manual.h in Headers */, + ADD1C0D71C196B9500733781 /* Lua-BindingsExport.h in Headers */, 155C7E2819A71CE600F08B25 /* lua_cocos2dx_ui_manual.hpp in Headers */, 15C1C2D6198749BC00A46ACC /* lua_cocos2dx_deprecated.h in Headers */, 15C1C2D7198749BC00A46ACC /* lua_cocos2dx_experimental_manual.hpp in Headers */, @@ -1068,6 +1080,7 @@ 15AC69DA1987710400D17520 /* tolua_is.c in Sources */, 15415ACD19A71A53004F1E71 /* tcp.c in Sources */, 15AC69DB1987710400D17520 /* tolua_map.c in Sources */, + ADD1C0D51C196B9500733781 /* lua_module_register.cpp in Sources */, 15415AD519A71A53004F1E71 /* udp.c in Sources */, 150983D01B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.cpp in Sources */, 15415ADD19A71A53004F1E71 /* usocket.c in Sources */, @@ -1133,6 +1146,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + ADAC23ED1C2044A60049A6A2 /* lua_module_register.cpp in Sources */, 15415AC619A71A53004F1E71 /* select.c in Sources */, 15A561ED1B00A3F1005D4720 /* lua_cocos2dx_physics3d_manual.cpp in Sources */, 15EFA646198B3311000C57D3 /* tolua_event.c in Sources */, diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index c877a70eac..ab034d18b4 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -256,7 +256,7 @@ void Button::loadTextureNormal(const std::string& normal,TextureResType texType) } } //FIXME: https://github.com/cocos2d/cocos2d-x/issues/12249 - if (!_ignoreSize) { + if (!_ignoreSize && _customSize.equals(Size::ZERO)) { _customSize = _buttonNormalRenderer->getContentSize(); } this->setupNormalTexture(textureLoaded); diff --git a/cocos/ui/UIImageView.cpp b/cocos/ui/UIImageView.cpp index 79c12adf36..d9af32b8a9 100644 --- a/cocos/ui/UIImageView.cpp +++ b/cocos/ui/UIImageView.cpp @@ -137,7 +137,7 @@ void ImageView::loadTexture(const std::string& fileName, TextureResType texType) break; } //FIXME: https://github.com/cocos2d/cocos2d-x/issues/12249 - if (!_ignoreSize) { + if (!_ignoreSize && _customSize.equals(Size::ZERO)) { _customSize = _imageRenderer->getContentSize(); } this->setupTexture(); diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index b1643eff7e..81ae344ed5 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -87,6 +87,7 @@ _isFocusPassing(false) Layout::~Layout() { CC_SAFE_RELEASE(_clippingStencil); + CC_SAFE_DELETE(_stencileStateManager); } void Layout::onEnter() diff --git a/cocos/ui/UIListView.h b/cocos/ui/UIListView.h index 0112cf585a..66e48efcf1 100644 --- a/cocos/ui/UIListView.h +++ b/cocos/ui/UIListView.h @@ -390,8 +390,8 @@ protected: virtual void onItemListChanged(); + virtual void remedyLayoutParameter(Widget* item); void updateInnerContainerSize(); - void remedyLayoutParameter(Widget* item); void remedyVerticalLayoutParameter(LinearLayoutParameter* layoutParameter, ssize_t itemIndex); void remedyHorizontalLayoutParameter(LinearLayoutParameter* layoutParameter,ssize_t itemIndex); diff --git a/cocos/ui/UILoadingBar.cpp b/cocos/ui/UILoadingBar.cpp index dd1d040947..b232697d92 100644 --- a/cocos/ui/UILoadingBar.cpp +++ b/cocos/ui/UILoadingBar.cpp @@ -111,26 +111,10 @@ void LoadingBar::setDirection(cocos2d::ui::LoadingBar::Direction direction) case Direction::LEFT: _barRenderer->setAnchorPoint(Vec2(0.0f,0.5f)); _barRenderer->setPosition(Vec2(0,_contentSize.height*0.5f)); - if (!_scale9Enabled) - { - auto innerSprite = _barRenderer->getSprite(); - if (nullptr != innerSprite) - { - innerSprite->setFlippedX(false); - } - } break; case Direction::RIGHT: _barRenderer->setAnchorPoint(Vec2(1.0f,0.5f)); _barRenderer->setPosition(Vec2(_totalLength,_contentSize.height*0.5f)); - if (!_scale9Enabled) - { - auto innerSprite = _barRenderer->getSprite(); - if (nullptr != innerSprite) - { - innerSprite->setFlippedX(true); - } - } break; } @@ -163,7 +147,7 @@ void LoadingBar::loadTexture(const std::string& texture,TextureResType texType) } //FIXME: https://github.com/cocos2d/cocos2d-x/issues/12249 - if (!_ignoreSize) { + if (!_ignoreSize && _customSize.equals(Size::ZERO)) { _customSize = _barRenderer->getContentSize(); } this->setupTexture(); @@ -183,25 +167,9 @@ void LoadingBar::setupTexture() { case Direction::LEFT: _barRenderer->setAnchorPoint(Vec2(0.0f,0.5f)); - if (!_scale9Enabled) - { - auto innerSprite = _barRenderer->getSprite(); - if (nullptr != innerSprite) - { - innerSprite->setFlippedX(false); - } - } break; case Direction::RIGHT: _barRenderer->setAnchorPoint(Vec2(1.0f,0.5f)); - if (!_scale9Enabled) - { - auto innerSprite = _barRenderer->getSprite(); - if (nullptr != innerSprite) - { - innerSprite->setFlippedX(true); - } - } break; } _barRenderer->setCapInsets(_capInsets); diff --git a/cocos/ui/UIPageView.cpp b/cocos/ui/UIPageView.cpp index 17904d2c38..3fb95e8093 100644 --- a/cocos/ui/UIPageView.cpp +++ b/cocos/ui/UIPageView.cpp @@ -427,6 +427,11 @@ const Color3B& PageView::getIndicatorSelectedIndexColor() const return _indicator->getSelectedIndexColor(); } +void PageView::remedyLayoutParameter(Widget *item) +{ + item->setContentSize(this->getContentSize()); + ListView::remedyLayoutParameter(item); +} } diff --git a/cocos/ui/UIPageView.h b/cocos/ui/UIPageView.h index c2129ccdda..926eb936c4 100644 --- a/cocos/ui/UIPageView.h +++ b/cocos/ui/UIPageView.h @@ -350,6 +350,7 @@ CC_CONSTRUCTOR_ACCESS: protected: void pageTurningEvent(); + virtual void remedyLayoutParameter(Widget* item)override; virtual void moveInnerContainer(const Vec2& deltaMove, bool canStartBounceBack) override; virtual void onItemListChanged() override; virtual void onSizeChanged() override; diff --git a/cocos/ui/UIScale9Sprite.cpp b/cocos/ui/UIScale9Sprite.cpp index 22977d6b49..1d3a60d480 100644 --- a/cocos/ui/UIScale9Sprite.cpp +++ b/cocos/ui/UIScale9Sprite.cpp @@ -471,6 +471,7 @@ namespace ui { _spriteFrameRotated = rotated; _originalSize = size; _preferredSize = size; + _offset = offset; _capInsetsInternal = capInsets; @@ -520,23 +521,31 @@ namespace ui { auto capInsets = CC_RECT_POINTS_TO_PIXELS(_capInsetsInternal); auto textureRect = CC_RECT_POINTS_TO_PIXELS(_spriteRect); - auto spriteRectSize = CC_SIZE_POINTS_TO_PIXELS(_originalSize); + auto spriteRectSize = _spriteRect.size; + auto originalSize = CC_SIZE_POINTS_TO_PIXELS(_originalSize); + auto offset = CC_POINT_POINTS_TO_PIXELS(_offset); + + Vec4 offsets; + offsets.x = offset.x + (originalSize.width - textureRect.size.width) / 2; + offsets.w = offset.y + (originalSize.height - textureRect.size.height) / 2; + offsets.z = originalSize.width - textureRect.size.width - offsets.x; + offsets.y = originalSize.height - textureRect.size.height - offsets.w; //handle .9.png if (_isPatch9) { - spriteRectSize = Size(spriteRectSize.width - 2, spriteRectSize.height-2); + originalSize = Size(originalSize.width - 2, originalSize.height-2); } if(capInsets.equals(Rect::ZERO)) { - capInsets = Rect(spriteRectSize.width/3, spriteRectSize.height/3, - spriteRectSize.width/3, spriteRectSize.height/3); + capInsets = Rect(originalSize.width/3, originalSize.height/3, + originalSize.width/3, originalSize.height/3); } - auto uv = this->calculateUV(tex, capInsets, spriteRectSize); - auto vertices = this->calculateVertices(capInsets, spriteRectSize); + auto uv = this->calculateUV(tex, capInsets, originalSize, offsets); + auto vertices = this->calculateVertices(capInsets, originalSize, offsets); auto triangles = this->calculateTriangles(uv, vertices); _scale9Image->getPolygonInfo().setTriangles(triangles); @@ -650,7 +659,7 @@ namespace ui { this->updateWithSprite(this->_scale9Image, _spriteRect, _spriteFrameRotated, - Vec2::ZERO, + _offset, _originalSize, capInsets); this->_insetLeft = capInsets.origin.x; @@ -687,7 +696,7 @@ namespace ui { void Scale9Sprite::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) { - if (_scale9Image) { + if (_scale9Image && _scale9Enabled) { #if CC_USE_CULLING // Don't do calculate the culling if the transform was not updated auto visitingCamera = Camera::getVisitingCamera(); @@ -774,12 +783,21 @@ namespace ui { else break; } + + if (!_scale9Enabled && _scale9Image && _scale9Image->getLocalZOrder() < 0 ) + { + _scale9Image->visit(renderer, _modelViewTransform, flags); + } // draw self // if (isVisitableByVisitingCamera()) this->draw(renderer, _modelViewTransform, flags); + if (!_scale9Enabled && _scale9Image && _scale9Image->getLocalZOrder() >= 0 ) + { + _scale9Image->visit(renderer, _modelViewTransform, flags); + } for(auto it=_children.cbegin()+i; it != _children.cend(); ++it) (*it)->visit(renderer, _modelViewTransform, flags); @@ -1070,7 +1088,8 @@ namespace ui { // u0 u1 u2 u3 std::vector Scale9Sprite::calculateUV(Texture2D *tex, const Rect& capInsets, - const Size& spriteRectSize) + const Size& originalSize, + const Vec4& offsets) { auto atlasWidth = tex->getPixelsWide(); auto atlasHeight = tex->getPixelsHigh(); @@ -1081,23 +1100,46 @@ namespace ui { if (_spriteFrameRotated) { - rightWidth = capInsets.origin.y; + rightWidth = capInsets.origin.y - offsets.y; centerWidth = capInsets.size.height; - leftWidth = spriteRectSize.height - centerWidth - rightWidth; + leftWidth = originalSize.height - centerWidth - capInsets.origin.y - offsets.w; - topHeight = capInsets.origin.x; + topHeight = capInsets.origin.x - offsets.x; centerHeight = capInsets.size.width; - bottomHeight = spriteRectSize.width - (topHeight + centerHeight); + bottomHeight = originalSize.width - (capInsets.origin.x + centerHeight) - offsets.z; } else { - leftWidth = capInsets.origin.x; + leftWidth = capInsets.origin.x - offsets.x; centerWidth = capInsets.size.width; - rightWidth = spriteRectSize.width - (leftWidth + centerWidth); + rightWidth = originalSize.width - (capInsets.origin.x + centerWidth) - offsets.z; - topHeight = capInsets.origin.y; + topHeight = capInsets.origin.y - offsets.y; centerHeight = capInsets.size.height; - bottomHeight =spriteRectSize.height - (topHeight + centerHeight); + bottomHeight = originalSize.height - (capInsets.origin.y + centerHeight) - offsets.w; + } + + + if(leftWidth<0) + { + centerWidth += leftWidth; + leftWidth = 0; + } + if(rightWidth<0) + { + centerWidth += rightWidth; + rightWidth = 0; + } + + if(topHeight<0) + { + centerHeight += topHeight; + topHeight = 0; + } + if(bottomHeight<0) + { + centerHeight += bottomHeight; + bottomHeight = 0; } auto textureRect = CC_RECT_POINTS_TO_PIXELS(_spriteRect); @@ -1167,67 +1209,111 @@ namespace ui { //x0,y0-------------------- // x1 x2 x3 std::vector Scale9Sprite::calculateVertices(const Rect& capInsets, - const Size& spriteRectSize) + const Size& originalSize, + const Vec4& offsets) { - float leftWidth = 0, centerWidth = 0, rightWidth = 0; - float topHeight = 0, centerHeight = 0, bottomHeight = 0; - - leftWidth = capInsets.origin.x; - centerWidth = capInsets.size.width; - rightWidth = spriteRectSize.width - (leftWidth + centerWidth); - - topHeight = capInsets.origin.y; - centerHeight = capInsets.size.height; - bottomHeight = spriteRectSize.height - (topHeight + centerHeight); - - - leftWidth = leftWidth / CC_CONTENT_SCALE_FACTOR(); - rightWidth = rightWidth / CC_CONTENT_SCALE_FACTOR(); - topHeight = topHeight / CC_CONTENT_SCALE_FACTOR(); - bottomHeight = bottomHeight / CC_CONTENT_SCALE_FACTOR(); - float sizableWidth = _preferredSize.width - leftWidth - rightWidth; - float sizableHeight = _preferredSize.height - topHeight - bottomHeight; - float x0,x1,x2,x3; - float y0,y1,y2,y3; - if(sizableWidth >= 0) - { - x0 = 0; - x1 = leftWidth; - x2 = leftWidth + sizableWidth; - x3 = _preferredSize.width; - } - else - { - float xScale = _preferredSize.width / (leftWidth + rightWidth); - x0 = 0; - x1 = x2 = leftWidth * xScale; - x3 = (leftWidth + rightWidth) * xScale; - } - - if(sizableHeight >= 0) - { - y0 = 0; - y1 = bottomHeight; - y2 = bottomHeight + sizableHeight; - y3 = _preferredSize.height; - } - else - { - float yScale = _preferredSize.height / (topHeight + bottomHeight); - y0 = 0; - y1 = y2= bottomHeight * yScale; - y3 = (bottomHeight + topHeight) * yScale; - } - - std::vector vertices; + float offsetLeft = offsets.x / CC_CONTENT_SCALE_FACTOR(); + float offsetTop = offsets.y / CC_CONTENT_SCALE_FACTOR(); + float offsetRight = offsets.z / CC_CONTENT_SCALE_FACTOR(); + float offsetBottom = offsets.w / CC_CONTENT_SCALE_FACTOR(); + + std::vector vertices; if (_renderingType == RenderingType::SIMPLE) { - vertices = {Vec2(x0,y0), Vec2(x3,y3)}; + float hScale = _preferredSize.width / (originalSize.width / CC_CONTENT_SCALE_FACTOR()); + float vScale = _preferredSize.height / (originalSize.height / CC_CONTENT_SCALE_FACTOR()); + + vertices = {Vec2(offsetLeft * hScale, offsetBottom * vScale), + Vec2(_preferredSize.width - offsetRight * hScale, _preferredSize.height - offsetTop * vScale)}; } else { - vertices = {Vec2(x0,y0), Vec2(x1,y1), Vec2(x2,y2), Vec2(x3,y3)}; + float leftWidth = 0, centerWidth = 0, rightWidth = 0; + float topHeight = 0, centerHeight = 0, bottomHeight = 0; + + leftWidth = capInsets.origin.x; + centerWidth = capInsets.size.width; + rightWidth = originalSize.width - (leftWidth + centerWidth); + + topHeight = capInsets.origin.y; + centerHeight = capInsets.size.height; + bottomHeight = originalSize.height - (topHeight + centerHeight); + + leftWidth = leftWidth / CC_CONTENT_SCALE_FACTOR(); + rightWidth = rightWidth / CC_CONTENT_SCALE_FACTOR(); + centerWidth = centerWidth / CC_CONTENT_SCALE_FACTOR(); + topHeight = topHeight / CC_CONTENT_SCALE_FACTOR(); + bottomHeight = bottomHeight / CC_CONTENT_SCALE_FACTOR(); + centerHeight = centerHeight / CC_CONTENT_SCALE_FACTOR(); + + float sizableWidth = _preferredSize.width - leftWidth - rightWidth; + float sizableHeight = _preferredSize.height - topHeight - bottomHeight; + + leftWidth -= offsetLeft; + rightWidth -= offsetRight; + topHeight -= offsetTop; + bottomHeight -= offsetBottom; + + float hScale = sizableWidth / centerWidth; + float vScale = sizableHeight / centerHeight; + + if(leftWidth<0) + { + offsetLeft -= leftWidth * (hScale - 1.0f); + sizableWidth += leftWidth * hScale; + leftWidth = 0; + } + if(rightWidth<0) + { + sizableWidth += rightWidth * hScale; + rightWidth = 0; + } + if(topHeight<0) + { + sizableHeight += topHeight * vScale; + topHeight = 0; + } + if(bottomHeight<0) + { + offsetBottom -= bottomHeight * (vScale - 1.0f); + sizableHeight += bottomHeight * vScale; + bottomHeight = 0; + } + + float x0,x1,x2,x3; + float y0,y1,y2,y3; + if(sizableWidth >= 0) + { + x0 = offsetLeft; + x1 = x0 + leftWidth; + x2 = x1 + sizableWidth; + x3 = x2 + rightWidth; + } + else + { + float xScale = _preferredSize.width / (leftWidth + rightWidth); + x0 = offsetLeft; + x1 = x2 = offsetLeft + leftWidth * xScale; + x3 = x2 + rightWidth * xScale; + } + + if(sizableHeight >= 0) + { + y0 = offsetBottom; + y1 = y0 + bottomHeight; + y2 = y1 + sizableHeight; + y3 = y2 + topHeight; + } + else + { + float yScale = _preferredSize.height / (topHeight + bottomHeight); + y0 = offsetBottom; + y1 = y2 = y0 + bottomHeight * yScale; + y3 = y2 + topHeight * yScale; + } + + vertices = {Vec2(x0,y0), Vec2(x1,y1), Vec2(x2,y2), Vec2(x3,y3)}; } return vertices; } @@ -1353,5 +1439,14 @@ namespace ui { CC_SAFE_RELEASE_NULL(this->_scale9Image); } + + void Scale9Sprite::setGlobalZOrder(float globalZOrder) + { + Node::setGlobalZOrder(globalZOrder); + if (_scale9Image) + { + _scale9Image->setGlobalZOrder(globalZOrder); + } + } }} diff --git a/cocos/ui/UIScale9Sprite.h b/cocos/ui/UIScale9Sprite.h index 7a36a5f1de..1dc5d851e9 100644 --- a/cocos/ui/UIScale9Sprite.h +++ b/cocos/ui/UIScale9Sprite.h @@ -577,6 +577,8 @@ namespace ui { /** * @brief Toggle 9-slice feature. * If Scale9Sprite is 9-slice disabled, the Scale9Sprite will rendered as a normal sprite. + * @warning: Don't use setScale9Enabled(false), use setRenderingType(RenderingType::SIMPLE) instead. + * The setScale9Enabled(false) is kept only for back back compatibility. * @param enabled True to enable 9-slice, false otherwise. * @js NA */ @@ -657,7 +659,8 @@ namespace ui { virtual float getScale() const override; using Node::getScaleZ; virtual void setCameraMask(unsigned short mask, bool applyChildren = true) override; - + virtual void setGlobalZOrder(float globalZOrder) override; + /** * Set the slice sprite rendering type. * When setting to SIMPLE, only 4 vertexes is used to rendering. @@ -682,8 +685,8 @@ namespace ui { void applyBlendFunc(); void updateBlendFunc(Texture2D *texture); std::vector calculateUV(Texture2D *tex, const Rect& capInsets, - const Size& spriteRectSize); - std::vector calculateVertices(const Rect& capInsets, const Size& spriteRectSize); + const Size& originalSize, const Vec4& offsets); + std::vector calculateVertices(const Rect& capInsets, const Size& originalSize, const Vec4& offsets); TrianglesCommand::Triangles calculateTriangles(const std::vector& uv, const std::vector& vertices); @@ -698,6 +701,7 @@ namespace ui { /** Original sprite's size. */ Size _originalSize; + Vec2 _offset; /** Preferred sprite's size. By default the preferred size is the original size. */ //if the preferredSize component is given as -1, it is ignored diff --git a/cocos/ui/UIScrollView.cpp b/cocos/ui/UIScrollView.cpp index 81ae8b64a6..e4e5f0cf02 100644 --- a/cocos/ui/UIScrollView.cpp +++ b/cocos/ui/UIScrollView.cpp @@ -178,19 +178,11 @@ void ScrollView::setInnerContainerSize(const Size &size) // Calculate and set the position of the inner container. Vec2 pos = _innerContainer->getPosition(); - if (_innerContainer->getLeftBoundary() > 0.0f) + if (_innerContainer->getLeftBoundary() != 0.0f) { pos.x = _innerContainer->getAnchorPoint().x * _innerContainer->getContentSize().width; } - if (_innerContainer->getRightBoundary() < _contentSize.width) - { - pos.x = _contentSize.width - ((1.0f - _innerContainer->getAnchorPoint().x) * _innerContainer->getContentSize().width); - } - if (_innerContainer->getPosition().y > 0.0f) - { - pos.y = _innerContainer->getAnchorPoint().y * _innerContainer->getContentSize().height; - } - if (_innerContainer->getTopBoundary() < _contentSize.height) + if (_innerContainer->getTopBoundary() != _contentSize.height) { pos.y = _contentSize.height - (1.0f - _innerContainer->getAnchorPoint().y) * _innerContainer->getContentSize().height; } diff --git a/cocos/ui/UISlider.cpp b/cocos/ui/UISlider.cpp index 20909e73ca..5eb9528329 100644 --- a/cocos/ui/UISlider.cpp +++ b/cocos/ui/UISlider.cpp @@ -172,7 +172,7 @@ void Slider::loadBarTexture(const std::string& fileName, TextureResType texType) } } //FIXME: https://github.com/cocos2d/cocos2d-x/issues/12249 - if (!_ignoreSize) { + if (!_ignoreSize && _customSize.equals(Size::ZERO)) { _customSize = _barRenderer->getContentSize(); } this->setupBarTexture(); @@ -258,7 +258,7 @@ void Slider::setScale9Enabled(bool able) ignoreContentAdaptWithSize(_prevIgnoreSize); } setCapInsetsBarRenderer(_capInsetsBarRenderer); - setCapInsetProgressBarRebderer(_capInsetsProgressBarRenderer); + setCapInsetProgressBarRenderer(_capInsetsProgressBarRenderer); _barRendererAdaptDirty = true; _progressBarRendererDirty = true; } @@ -280,7 +280,7 @@ void Slider::ignoreContentAdaptWithSize(bool ignore) void Slider::setCapInsets(const Rect &capInsets) { setCapInsetsBarRenderer(capInsets); - setCapInsetProgressBarRebderer(capInsets); + setCapInsetProgressBarRenderer(capInsets); } void Slider::setCapInsetsBarRenderer(const Rect &capInsets) @@ -298,7 +298,7 @@ const Rect& Slider::getCapInsetsBarRenderer()const return _capInsetsBarRenderer; } -void Slider::setCapInsetProgressBarRebderer(const Rect &capInsets) +void Slider::setCapInsetProgressBarRenderer(const Rect &capInsets) { _capInsetsProgressBarRenderer = ui::Helper::restrictCapInsetRect(capInsets, _progressBarRenderer->getContentSize()); if (!_scale9Enabled) @@ -308,7 +308,7 @@ void Slider::setCapInsetProgressBarRebderer(const Rect &capInsets) _progressBarRenderer->setCapInsets(_capInsetsProgressBarRenderer); } -const Rect& Slider::getCapInsetsProgressBarRebderer()const +const Rect& Slider::getCapInsetsProgressBarRenderer()const { return _capInsetsProgressBarRenderer; } diff --git a/cocos/ui/UISlider.h b/cocos/ui/UISlider.h index f06a337bfd..d35b514d87 100644 --- a/cocos/ui/UISlider.h +++ b/cocos/ui/UISlider.h @@ -143,14 +143,14 @@ public: * @param capInsets Capinsets for progress bar slider. * @js NA */ - void setCapInsetProgressBarRebderer(const Rect &capInsets); + void setCapInsetProgressBarRenderer(const Rect &capInsets); /** * Gets capinsets for progress bar slider, if slider is using scale9 renderer. * @return Capinsets for progress bar slider. * @js NA */ - const Rect& getCapInsetsProgressBarRebderer()const; + const Rect& getCapInsetsProgressBarRenderer()const; /** * Load textures for slider ball. diff --git a/cocos/ui/UIText.cpp b/cocos/ui/UIText.cpp index 99ee47e029..3fae6d0c4e 100644 --- a/cocos/ui/UIText.cpp +++ b/cocos/ui/UIText.cpp @@ -372,6 +372,38 @@ void Text::disableEffect(LabelEffect effect) } } +bool Text::isShadowEnabled() const +{ + return _labelRenderer->isShadowEnabled(); +} +Size Text::getShadowOffset() const +{ + return _labelRenderer->getShadowOffset(); +} +float Text::getShadowBlurRadius() const +{ + return _labelRenderer->getShadowBlurRadius(); +} +Color4B Text::getShadowColor() const +{ + Color4F effect = _labelRenderer->getShadowColor(); + return Color4B(effect.r * 255, effect.g * 255, effect.b * 255, effect.a * 255); +} + +int Text::getOutlineSize() const +{ + return _labelRenderer->getOutlineSize(); +} +LabelEffect Text::getLabelEffectType() const +{ + return _labelRenderer->getLabelEffectType(); +} +Color4B Text::getEffectColor() const +{ + Color4F effect = _labelRenderer->getEffectColor(); + return Color4B(effect.r * 255, effect.g * 255, effect.b * 255, effect.a * 255); +} + Widget* Text::createCloneInstance() { return Text::create(); @@ -391,6 +423,20 @@ void Text::copySpecialProperties(Widget *widget) setTextVerticalAlignment(label->_labelRenderer->getVerticalAlignment()); setTextAreaSize(label->_labelRenderer->getDimensions()); setContentSize(label->getContentSize()); + + LabelEffect effectType = label->getLabelEffectType(); + if (effectType == LabelEffect::GLOW) + { + enableGlow(label->getEffectColor()); + } + else if (effectType == LabelEffect::OUTLINE) + { + enableOutline(label->getEffectColor(),label->getOutlineSize()); + } + if (label->isShadowEnabled()) + { + enableShadow(label->getShadowColor(),label->getShadowOffset(),label->getShadowBlurRadius()); + } } } diff --git a/cocos/ui/UIText.h b/cocos/ui/UIText.h index 6b960d619e..df06d62ebc 100644 --- a/cocos/ui/UIText.h +++ b/cocos/ui/UIText.h @@ -294,6 +294,35 @@ public: */ void disableEffect(LabelEffect effect); + /** + * Return whether the shadow effect is enabled. + */ + bool isShadowEnabled() const; + /** + * Return shadow effect offset value. + */ + Size getShadowOffset() const; + /** + * Return the shadow effect blur radius. + */ + float getShadowBlurRadius() const; + /** + * Return the shadow effect color value. + */ + Color4B getShadowColor() const; + /** + * Return the outline effect size value. + */ + int getOutlineSize() const; + /** + * Return current effect type. + */ + LabelEffect getLabelEffectType() const; + /** + * Return current effect color vlaue. + */ + Color4B getEffectColor() const; + CC_CONSTRUCTOR_ACCESS: virtual bool init() override; virtual bool init(const std::string& textContent, diff --git a/cocos/ui/UITextField.cpp b/cocos/ui/UITextField.cpp index dc13ee6b07..d2310a60c8 100644 --- a/cocos/ui/UITextField.cpp +++ b/cocos/ui/UITextField.cpp @@ -299,7 +299,7 @@ _useTouchArea(false), _textFieldEventListener(nullptr), _textFieldEventSelector(nullptr), _eventCallback(nullptr), -_passwordStyleText(""), +_passwordStyleText("*"), _textFieldRendererAdaptDirty(true), _fontName("Thonburi"), _fontSize(10), @@ -575,6 +575,8 @@ int TextField::getMaxLength()const void TextField::setPasswordEnabled(bool enable) { _textFieldRenderer->setPasswordEnabled(enable); + if (enable) + setPasswordStyleText(getPasswordStyleText()); } bool TextField::isPasswordEnabled()const diff --git a/docs/doxygen.config b/docs/doxygen.config index 8f6c30aa0c..9df6c39a70 100644 --- a/docs/doxygen.config +++ b/docs/doxygen.config @@ -38,7 +38,7 @@ PROJECT_NAME = Cocos2d-x # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = v3.9 +PROJECT_NUMBER = v3.10 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/extensions/GUI/CCControlExtension/CCControlButton.cpp b/extensions/GUI/CCControlExtension/CCControlButton.cpp index 9a69de517e..99e371183a 100644 --- a/extensions/GUI/CCControlExtension/CCControlButton.cpp +++ b/extensions/GUI/CCControlExtension/CCControlButton.cpp @@ -63,10 +63,10 @@ ControlButton::~ControlButton() bool ControlButton::init() { - return this->initWithLabelAndBackgroundSprite(Label::createWithSystemFont("", "Helvetica", 12), cocos2d::ui::Scale9Sprite::create()); + return this->initWithLabelAndBackgroundSprite(Label::createWithSystemFont("", "Helvetica", 12), cocos2d::ui::Scale9Sprite::create(),true); } -bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, ui::Scale9Sprite* backgroundSprite) +bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, ui::Scale9Sprite* backgroundSprite, bool adjustBackGroundSize) { if (Control::init()) { @@ -79,9 +79,9 @@ bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, ui::Scale9Sprit _isPushed = false; - // Adjust the background image by default - setAdjustBackgroundImage(true); + // Adjust the background image by adjustBackGroundSize setPreferredSize(Size::ZERO); + setAdjustBackgroundImage(adjustBackGroundSize); // Zooming button by default _zoomOnTouchDown = true; _scaleRatio = 1.1f; @@ -123,14 +123,22 @@ bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, ui::Scale9Sprit ControlButton* ControlButton::create(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite) { ControlButton *pRet = new (std::nothrow) ControlButton(); - pRet->initWithLabelAndBackgroundSprite(label, backgroundSprite); + pRet->initWithLabelAndBackgroundSprite(label, backgroundSprite, true); + pRet->autorelease(); + return pRet; +} + +ControlButton* ControlButton::create(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite, bool adjustBackGroundSize) +{ + ControlButton *pRet = new (std::nothrow) ControlButton(); + pRet->initWithLabelAndBackgroundSprite(label, backgroundSprite, adjustBackGroundSize); pRet->autorelease(); return pRet; } bool ControlButton::initWithTitleAndFontNameAndFontSize(const std::string& title, const std::string& fontName, float fontSize) { - return initWithLabelAndBackgroundSprite(Label::createWithSystemFont(title, fontName, fontSize), cocos2d::ui::Scale9Sprite::create()); + return initWithLabelAndBackgroundSprite(Label::createWithSystemFont(title, fontName, fontSize), cocos2d::ui::Scale9Sprite::create(),true); } ControlButton* ControlButton::create(const std::string& title, const std::string& fontName, float fontSize) @@ -144,7 +152,7 @@ ControlButton* ControlButton::create(const std::string& title, const std::string bool ControlButton::initWithBackgroundSprite(cocos2d::ui::Scale9Sprite* sprite) { Label *label = Label::createWithSystemFont("", "Arial", 30);// - return initWithLabelAndBackgroundSprite(label, sprite); + return initWithLabelAndBackgroundSprite(label, sprite,false); } ControlButton* ControlButton::create(cocos2d::ui::Scale9Sprite* sprite) diff --git a/extensions/GUI/CCControlExtension/CCControlButton.h b/extensions/GUI/CCControlExtension/CCControlButton.h index 4c7dc27511..cd61842b98 100644 --- a/extensions/GUI/CCControlExtension/CCControlButton.h +++ b/extensions/GUI/CCControlExtension/CCControlButton.h @@ -58,6 +58,7 @@ public: static ControlButton* create(cocos2d::ui::Scale9Sprite* sprite); static ControlButton* create(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite); static ControlButton* create(const std::string& title, const std::string& fontName, float fontSize); + static ControlButton* create(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite, bool adjustBackGroundSize); virtual void needsLayout(void) override; @@ -202,7 +203,7 @@ CC_CONSTRUCTOR_ACCESS: virtual ~ControlButton(); virtual bool init() override; - virtual bool initWithLabelAndBackgroundSprite(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite); + virtual bool initWithLabelAndBackgroundSprite(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite, bool adjustBackGroundSize); virtual bool initWithBackgroundSprite(cocos2d::ui::Scale9Sprite* sprite); virtual bool initWithTitleAndFontNameAndFontSize(const std::string& title, const std::string& fontName, float fontSize); diff --git a/extensions/Particle3D/CCParticle3DRender.cpp b/extensions/Particle3D/CCParticle3DRender.cpp index 14ca60de3f..6e6cb19ff8 100755 --- a/extensions/Particle3D/CCParticle3DRender.cpp +++ b/extensions/Particle3D/CCParticle3DRender.cpp @@ -43,6 +43,7 @@ Particle3DQuadRender::Particle3DQuadRender() , _glProgramState(nullptr) , _indexBuffer(nullptr) , _vertexBuffer(nullptr) +, _texFile("") { } @@ -60,6 +61,7 @@ Particle3DQuadRender* Particle3DQuadRender::create(const std::string& texFile) auto ret = new (std::nothrow)Particle3DQuadRender(); if (ret && ret->initQuadRender(texFile)) { + ret->_texFile = texFile; ret->autorelease(); } else @@ -187,6 +189,8 @@ bool Particle3DQuadRender::initQuadRender( const std::string& texFile ) _texture = tex; glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_PARTICLE_TEXTURE); } + else + _texture = nullptr; } auto glProgramState = GLProgramState::create(glProgram); glProgramState->retain(); @@ -213,6 +217,11 @@ bool Particle3DQuadRender::initQuadRender( const std::string& texFile ) return true; } +void Particle3DQuadRender::reset() +{ + this->initQuadRender(_texFile); +} + ////////////////////////////////////////////////////////////////////////////// Particle3DModelRender::Particle3DModelRender() : _spriteSize(Vec3::ONE) @@ -284,6 +293,14 @@ void Particle3DModelRender::render(Renderer* renderer, const Mat4 &transform, Pa } } +void Particle3DModelRender::reset() +{ + for (auto iter : _spriteList){ + iter->release(); + } + _spriteList.clear(); +} + // MARK: Particle3DRender Particle3DRender::Particle3DRender() diff --git a/extensions/Particle3D/CCParticle3DRender.h b/extensions/Particle3D/CCParticle3DRender.h index e2cf465222..2616071c0b 100644 --- a/extensions/Particle3D/CCParticle3DRender.h +++ b/extensions/Particle3D/CCParticle3DRender.h @@ -73,6 +73,8 @@ public: void copyAttributesTo (Particle3DRender *render); + virtual void reset(){} + CC_CONSTRUCTOR_ACCESS: Particle3DRender(); virtual ~Particle3DRender(); @@ -94,6 +96,7 @@ public: virtual void render(Renderer* renderer, const Mat4 &transform, ParticleSystem3D* particleSystem) override; + virtual void reset()override; CC_CONSTRUCTOR_ACCESS: Particle3DQuadRender(); virtual ~Particle3DQuadRender(); @@ -118,6 +121,7 @@ protected: std::vector _posuvcolors; //vertex data std::vector _indexData; //index data + std::string _texFile; }; // particle render for Sprite3D @@ -128,6 +132,7 @@ public: virtual void render(Renderer* renderer, const Mat4 &transform, ParticleSystem3D* particleSystem) override; + virtual void reset()override; CC_CONSTRUCTOR_ACCESS: Particle3DModelRender(); virtual ~Particle3DModelRender(); diff --git a/extensions/Particle3D/CCParticleSystem3D.h b/extensions/Particle3D/CCParticleSystem3D.h index ab577bb34f..fd5881cc75 100644 --- a/extensions/Particle3D/CCParticleSystem3D.h +++ b/extensions/Particle3D/CCParticleSystem3D.h @@ -204,6 +204,10 @@ public: * set particle render, can set your own particle render */ void setRender(Particle3DRender* render); + /** + * return particle render + */ + Particle3DRender* getRender(){ return _render; } /** * add particle affector */ diff --git a/extensions/Particle3D/PU/CCPUBillboardChain.cpp b/extensions/Particle3D/PU/CCPUBillboardChain.cpp index c023d108fc..2df9248e17 100644 --- a/extensions/Particle3D/PU/CCPUBillboardChain.cpp +++ b/extensions/Particle3D/PU/CCPUBillboardChain.cpp @@ -734,21 +734,15 @@ void PUBillboardChain::setBlendFunc(const BlendFunc& blendFunc) GLuint PUBillboardChain::getTextureName() { - if (Director::getInstance()->getTextureCache()->isDirty()) - { - if (Director::getInstance()->getTextureCache()->getTextureForKey(_texFile) == nullptr) - { - _texture = nullptr; - this->init(""); - } - else - this->init(_texFile); - } - else if (_texture != nullptr && !_texture->isValid()) + if (Director::getInstance()->getTextureCache()->getTextureForKey(_texFile) == nullptr) { _texture = nullptr; this->init(""); } + else if (_texture == nullptr) + { + this->init(_texFile); + } if (_texture == nullptr) return 0; diff --git a/extensions/Particle3D/PU/CCPURender.cpp b/extensions/Particle3D/PU/CCPURender.cpp index 6f7b2e8413..5d23e298bb 100644 --- a/extensions/Particle3D/PU/CCPURender.cpp +++ b/extensions/Particle3D/PU/CCPURender.cpp @@ -244,7 +244,7 @@ void PUParticle3DQuadRender::render(Renderer* renderer, const Mat4 &transform, P _stateBlock->setBlendFunc(particleSystem->getBlendFunc()); - GLuint texId = this->getTextureName(); + GLuint texId = (_texture ? _texture->getName() : 0); _meshCommand->init(0, texId, _glProgramState, @@ -525,6 +525,14 @@ PUParticle3DModelRender* PUParticle3DModelRender::clone() return mr; } +void PUParticle3DModelRender::reset() +{ + for (auto iter : _spriteList){ + iter->release(); + } + _spriteList.clear(); +} + PUParticle3DEntityRender::PUParticle3DEntityRender() : _meshCommand(nullptr) @@ -564,6 +572,8 @@ bool PUParticle3DEntityRender::initRender( const std::string &texFile ) _texture = tex; glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_PARTICLE_TEXTURE); } + else + _texture = nullptr; } auto glProgramState = GLProgramState::create(glProgram); glProgramState->retain(); @@ -587,35 +597,16 @@ bool PUParticle3DEntityRender::initRender( const std::string &texFile ) return true; } -GLuint PUParticle3DEntityRender::getTextureName() -{ - if (Director::getInstance()->getTextureCache()->isDirty()) - { - if (Director::getInstance()->getTextureCache()->getTextureForKey(_texFile) == nullptr) - { - _texture = nullptr; - this->initRender(""); - } - else - this->initRender(_texFile); - } - else if (_texture != nullptr && !_texture->isValid()) - { - _texture = nullptr; - this->initRender(""); - } - - if (_texture == nullptr) - return 0; - - return _texture->getName(); -} - void PUParticle3DEntityRender::copyAttributesTo(PUParticle3DEntityRender *render) { PURender::copyAttributesTo(render); } +void PUParticle3DEntityRender::reset() +{ + this->initRender(_texFile); +} + PUParticle3DBoxRender::PUParticle3DBoxRender() { autoRotate = false; @@ -725,7 +716,7 @@ void PUParticle3DBoxRender::render( Renderer* renderer, const Mat4 &transform, P _vertexBuffer->updateVertices(&_vertices[0], vertexindex/* * sizeof(_posuvcolors[0])*/, 0); _indexBuffer->updateIndices(&_indices[0], index/* * sizeof(unsigned short)*/, 0); - GLuint texId = this->getTextureName(); + GLuint texId = (_texture ? _texture->getName() : 0); _stateBlock->setBlendFunc(_particleSystem->getBlendFunc()); _meshCommand->init(0, texId, @@ -889,8 +880,7 @@ void PUSphereRender::render( Renderer* renderer, const Mat4 &transform, Particle _vertexBuffer->updateVertices(&_vertices[0], vertexindex/* * sizeof(_posuvcolors[0])*/, 0); _indexBuffer->updateIndices(&_indices[0], index/* * sizeof(unsigned short)*/, 0); - GLuint texId = this->getTextureName(); - + GLuint texId = (_texture ? _texture->getName() : 0); _stateBlock->setBlendFunc(particleSystem->getBlendFunc()); _meshCommand->init( 0, diff --git a/extensions/Particle3D/PU/CCPURender.h b/extensions/Particle3D/PU/CCPURender.h index baf976c2b3..43232119a8 100644 --- a/extensions/Particle3D/PU/CCPURender.h +++ b/extensions/Particle3D/PU/CCPURender.h @@ -65,7 +65,7 @@ class CC_DLL PUParticle3DEntityRender : public PURender { public: void copyAttributesTo(PUParticle3DEntityRender *render); - + virtual void reset()override; CC_CONSTRUCTOR_ACCESS: PUParticle3DEntityRender(); virtual ~PUParticle3DEntityRender(); @@ -73,8 +73,6 @@ CC_CONSTRUCTOR_ACCESS: protected: bool initRender(const std::string &texFile); - GLuint getTextureName(); - protected: struct VertexInfo @@ -189,6 +187,7 @@ public: virtual PUParticle3DModelRender* clone() override; void copyAttributesTo(PUParticle3DModelRender *render); + virtual void reset()override; CC_CONSTRUCTOR_ACCESS: PUParticle3DModelRender(); virtual ~PUParticle3DModelRender(); diff --git a/extensions/cocos-ext.h b/extensions/cocos-ext.h index 226fc5dd31..9d491a1070 100644 --- a/extensions/cocos-ext.h +++ b/extensions/cocos-ext.h @@ -21,6 +21,7 @@ #include "ExtensionDeprecated.h" // Particle System, include Particle Universe Particle System +#include "Particle3D/CCParticle3DRender.h" #include "Particle3D/CCParticleSystem3D.h" #include "Particle3D/PU/CCPUParticleSystem3D.h" diff --git a/external/config.json b/external/config.json index 4c7cebe515..0739cd1c10 100644 --- a/external/config.json +++ b/external/config.json @@ -1,6 +1,6 @@ { - "version":"v3-deps-78", - "zip_file_size":"119277304", + "version":"v3-deps-79", + "zip_file_size":"124402591", "repo_name":"cocos2d-x-3rd-party-libs-bin", "repo_parent":"https://github.com/cocos2d/", "move_dirs":{ diff --git a/setup.py b/setup.py index 019fd87a63..91ee4c8760 100755 --- a/setup.py +++ b/setup.py @@ -676,7 +676,7 @@ class SetEnvVar(object): else: return SetEnvVar.RESULT_DO_NOTHING - def set_environment_variables(self, ndk_root, android_sdk_root, ant_root): + def set_environment_variables(self, ndk_root, android_sdk_root, ant_root, quiet): print('\nSetting up cocos2d-x...') @@ -692,10 +692,10 @@ class SetEnvVar(object): else: print('->Configuration for Android platform only, you can also skip and manually edit "%s"\n' % self.file_used_for_setup) - - ndk_ret = self.set_variable(NDK_ROOT, ndk_root) - sdk_ret = self.set_variable(ANDROID_SDK_ROOT, android_sdk_root) - ant_ret = self.set_variable(ANT_ROOT, ant_root) + if(quiet) : + ndk_ret = self.set_variable(NDK_ROOT, ndk_root) + sdk_ret = self.set_variable(ANDROID_SDK_ROOT, android_sdk_root) + ant_ret = self.set_variable(ANT_ROOT, ant_root) # tip the backup file if (self.backup_file is not None) and (os.path.exists(self.backup_file)): @@ -720,12 +720,15 @@ if __name__ == '__main__': dest='android_sdk_root', help='directory of android sdk root') parser.add_option( '-t', '--antroot', dest='ant_root', help='directory that contains ant/ant.bat') + + parser.add_option( + '-q', '--quiet', dest='quiet',action="store_false", default = True, help='setup without setting NDK,SDK,ANT') opts, args = parser.parse_args() # set environment variables env = SetEnvVar() env.set_environment_variables( - opts.ndk_root, opts.android_sdk_root, opts.ant_root) + opts.ndk_root, opts.android_sdk_root, opts.ant_root, opts.quiet) if env._isWindows(): import ctypes diff --git a/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.cpp b/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.cpp index 7c36e30ef7..6229c6536e 100644 --- a/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.cpp +++ b/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.cpp @@ -36,7 +36,7 @@ static const char* sURLList[] = { "http://www.cocos2d-x.org/attachments/802/cocos2dx_landscape.png", "http://www.cocos2d-x.org/docs/manual/framework/native/wiki/logo-resources-of-cocos2d-x/res/2dx_icon_512_rounded.png", - "http://www.cocos2d-x.org/attachments/1503/Cocos2CoordinateRelease.png", + "http://www.cocos2d-x.org/attachments/1503/inexist.png", "http://download.sdkbox.com/installer/v1/sdkbox-iap_v1.2.3.3.tar.gz", }; const static int sListSize = (sizeof(sURLList)/sizeof(sURLList[0])); @@ -44,7 +44,7 @@ static const char* sNameList[sListSize] = { "cocos2dx_landscape.png", "2dx_icon_512_rounded.png", - "Cocos2CoordinateRelease.png", + "inexist file", "big file", }; @@ -112,6 +112,7 @@ struct DownloaderTest : public TestCase label->setPosition(Vec2(viewSize.width / 2, viewSize.height / 2)); label->setContentSize(Size(viewSize.width, 0)); label->setAlignment(TextHAlignment::CENTER, TextVAlignment::CENTER); + label->setDimensions(viewSize.width, viewSize.height); bg->addChild(label, 20); return bg; diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp index 9c8ccae21e..e5b50557dd 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp @@ -280,12 +280,12 @@ ControlButton *ControlButtonTest_Styling::standardButtonWithTitle(const char *ti backgroundButton->setPreferredSize(Size(45, 45)); // Set the prefered size auto backgroundHighlightedButton = ui::Scale9Sprite::create("extensions/buttonHighlighted.png"); backgroundHighlightedButton->setPreferredSize(Size(45, 45)); // Set the prefered size - + auto titleButton = Label::createWithTTF(title, "fonts/Marker Felt.ttf", 30); titleButton->setColor(Color3B(159, 168, 176)); - ControlButton *button = ControlButton::create(titleButton, backgroundButton); + ControlButton *button = ControlButton::create(titleButton, backgroundButton,false); button->setBackgroundSpriteForState(backgroundHighlightedButton, Control::State::HIGH_LIGHTED); button->setTitleColorForState(Color3B::WHITE, Control::State::HIGH_LIGHTED); diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp index 03bc8abe48..0e97ed4e41 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp @@ -93,11 +93,14 @@ public: if(std::get<0>(effect) >=0) break; - QuadCommand &q = std::get<2>(effect); - q.init(_globalZOrder, _texture->getName(), std::get<1>(effect)->getGLProgramState(), _blendFunc, &_quad, 1, transform, flags); - renderer->addCommand(&q); + auto glProgramState = std::get<1>(effect)->getGLProgramState(); + if (glProgramState) + { + QuadCommand &q = std::get<2>(effect); + q.init(_globalZOrder, _texture->getName(), glProgramState, _blendFunc, &_quad, 1, transform, flags); + renderer->addCommand(&q); + } idx++; - } // normal effect: order == 0 @@ -144,8 +147,8 @@ bool Effect::initGLProgramState(const std::string &fragmentFilename) _fragSource = fragSource; #endif - _glprogramstate = GLProgramState::getOrCreateWithGLProgram(glprogram); - _glprogramstate->retain(); + _glprogramstate = (glprogram == nullptr ? nullptr : GLProgramState::getOrCreateWithGLProgram(glprogram)); + CC_SAFE_RETAIN(_glprogramstate); return _glprogramstate != nullptr; } @@ -194,6 +197,9 @@ protected: void EffectBlur::setTarget(EffectSprite *sprite) { + if (_glprogramstate == nullptr) + return; + Size size = sprite->getTexture()->getContentSizeInPixels(); _glprogramstate->setUniformVec2("resolution", size); #if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index 5c6da55cce..bae4787039 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -2602,6 +2602,7 @@ Sprite3DPropertyTest::Sprite3DPropertyTest() _sprite->setPosition(20.f, 0.f); _sprite->setRotation3D(Vec3(0, 180, 0)); _meshTex = _sprite->getMesh()->getTexture(); + _texFile = _meshTex->getPath(); addChild(_sprite); setCameraMask(2); @@ -2616,11 +2617,14 @@ Sprite3DPropertyTest::Sprite3DPropertyTest() auto item1 = MenuItemLabel::create(label1, CC_CALLBACK_1(Sprite3DPropertyTest::printMeshName, this)); auto label2 = Label::createWithTTF(ttfConfig, "Remove Used Texture"); auto item2 = MenuItemLabel::create(label2, CC_CALLBACK_1(Sprite3DPropertyTest::removeUsedTexture, this)); + auto label3 = Label::createWithTTF(ttfConfig, "Reset"); + auto item3 = MenuItemLabel::create(label3, CC_CALLBACK_1(Sprite3DPropertyTest::resetTexture, this)); item1->setPosition(Vec2(VisibleRect::left().x + 100, VisibleRect::bottom().y + item1->getContentSize().height * 4)); item2->setPosition(Vec2(VisibleRect::left().x + 100, VisibleRect::bottom().y + item1->getContentSize().height * 5)); + item3->setPosition(Vec2(VisibleRect::left().x + 100, VisibleRect::bottom().y + item1->getContentSize().height * 6)); - auto pMenu1 = Menu::create(item1, item2, nullptr); + auto pMenu1 = Menu::create(item1, item2, item3,nullptr); pMenu1->setPosition(Vec2(0, 0)); this->addChild(pMenu1, 10); @@ -2654,5 +2658,34 @@ void Sprite3DPropertyTest::removeUsedTexture(cocos2d::Ref* sender) if (_meshTex != nullptr) { TextureCache::getInstance()->removeTexture(_meshTex); + this->refreshSpriteRender(); + } +} + +void Sprite3DPropertyTest::resetTexture(cocos2d::Ref* sender) +{ + if (_meshTex != nullptr) + { + _meshTex = TextureCache::getInstance()->addImage(_texFile); + this->refreshSpriteRender(); + } +} + +void Sprite3DPropertyTest::refreshSpriteRender() +{ + Vector meshes = _sprite->getMeshes(); + for (Mesh* mesh : meshes) + { + std::string file = mesh->getTextureFileName(); + Texture2D* cacheTex = Director::getInstance()->getTextureCache()->getTextureForKey(file); + if (cacheTex == nullptr) + { + unsigned char data[] = { 255, 0, 0, 255 };//1*1 red picture + Image * image = new (std::nothrow) Image(); + image->initWithRawData(data, sizeof(data), 1, 1, sizeof(unsigned char)); + cacheTex = Director::getInstance()->getTextureCache()->addImage(image, "/dummyTexture"); + image->release(); + } + mesh->setTexture(cacheTex, cocos2d::NTextureData::Usage::Diffuse, false); } } \ No newline at end of file diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h index 301b9f9356..bbfd47652c 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h @@ -606,9 +606,13 @@ public: void printMeshName(cocos2d::Ref* sender); void removeUsedTexture(cocos2d::Ref* sender); + void resetTexture(cocos2d::Ref* sender); + + void refreshSpriteRender(); protected: cocos2d::Sprite3D* _sprite; cocos2d::Texture2D* _meshTex; + std::string _texFile; }; #endif diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp index 8a32353e17..0c75cc28e5 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp @@ -75,7 +75,15 @@ bool UIButtonTest::init() _uiLayer->addChild(imageView); + _button = button; + TTFConfig ttfConfig("fonts/arial.ttf", 15); + auto label1 = Label::createWithTTF(ttfConfig, "Print Resources"); + auto item1 = MenuItemLabel::create(label1, CC_CALLBACK_1(UIButtonTest::printWidgetResources, this)); + item1->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y + item1->getContentSize().height * 3)); + auto pMenu1 = Menu::create(item1, nullptr); + pMenu1->setPosition(Vec2(0, 0)); + this->addChild(pMenu1, 10); return true; } @@ -117,6 +125,16 @@ void UIButtonTest::touchEvent(Ref *pSender, Widget::TouchEventType type) } } +void UIButtonTest::printWidgetResources(cocos2d::Ref* sender) +{ + cocos2d::ResourceData normalFileName = _button->getNormalFile(); + CCLOG("normalFileName Name : %s, Type: %d", normalFileName.file.c_str(), normalFileName.type); + cocos2d::ResourceData clickedFileName = _button->getPressedFile(); + CCLOG("clickedFileName Name : %s, Type: %d", clickedFileName.file.c_str(), clickedFileName.type); + cocos2d::ResourceData disabledFileName = _button->getDisabledFile(); + CCLOG("disabledFileName Name : %s, Type: %d", disabledFileName.file.c_str(), disabledFileName.type); +} + // UIButtonTest_Scale9 UIButtonTest_Scale9::UIButtonTest_Scale9() diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.h index c52d86f2f2..8a34c6493d 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.h @@ -40,8 +40,10 @@ public: virtual bool init() override; void touchEvent(cocos2d::Ref* sender, cocos2d::ui::Widget::TouchEventType type); + void printWidgetResources(cocos2d::Ref* sender); protected: cocos2d::ui::Text* _displayValueLabel; + cocos2d::ui::Button* _button; }; class UIButtonTest_Scale9 : public UIScene diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp index 746705dc41..e750b2bed9 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp @@ -40,15 +40,23 @@ bool UICheckBoxTest::init() _uiLayer->addChild(alert); // Create the checkbox - CheckBox* checkBox = CheckBox::create("cocosui/check_box_normal.png", + _checkBox = CheckBox::create("cocosui/check_box_normal.png", "cocosui/check_box_normal_press.png", "cocosui/check_box_active.png", "cocosui/check_box_normal_disable.png", "cocosui/check_box_active_disable.png"); - checkBox->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f)); + _checkBox->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f)); - checkBox->addEventListener(CC_CALLBACK_2(UICheckBoxTest::selectedEvent, this)); - _uiLayer->addChild(checkBox); + _checkBox->addEventListener(CC_CALLBACK_2(UICheckBoxTest::selectedEvent, this)); + _uiLayer->addChild(_checkBox); + + TTFConfig ttfConfig("fonts/arial.ttf", 15); + auto label1 = Label::createWithTTF(ttfConfig, "Print Resources"); + auto item1 = MenuItemLabel::create(label1, CC_CALLBACK_1(UICheckBoxTest::printWidgetResources, this)); + item1->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y + item1->getContentSize().height * 3)); + auto pMenu1 = Menu::create(item1, nullptr); + pMenu1->setPosition(Vec2(0, 0)); + this->addChild(pMenu1, 10); return true; } @@ -73,6 +81,20 @@ void UICheckBoxTest::selectedEvent(Ref* pSender,CheckBox::EventType type) } +void UICheckBoxTest::printWidgetResources(cocos2d::Ref* sender) +{ + cocos2d::ResourceData backGroundFileName = _checkBox->getBackNormalFile(); + CCLOG("backGroundFile Name : %s, Type: %d", backGroundFileName.file.c_str(),backGroundFileName.type); + cocos2d::ResourceData backGroundSelectedFileName = _checkBox->getBackPressedFile(); + CCLOG("backGroundSelectedFile Name : %s, Type: %d", backGroundSelectedFileName.file.c_str(), backGroundSelectedFileName.type); + cocos2d::ResourceData backGroundDisabledFileName = _checkBox->getBackDisabledFile(); + CCLOG("backGroundDisabledFile Name : %s, Type: %d", backGroundDisabledFileName.file.c_str(), backGroundDisabledFileName.type); + cocos2d::ResourceData frontCrossFileName = _checkBox->getCrossNormalFile(); + CCLOG("frontCrossFile Name : %s, Type: %d", frontCrossFileName.file.c_str(), frontCrossFileName.type); + cocos2d::ResourceData frontCrossDisabledFileName = _checkBox->getCrossDisabledFile(); + CCLOG("frontCrossDisabledFile Name : %s, Type: %d", frontCrossDisabledFileName.file.c_str(), frontCrossDisabledFileName.type); +} + // UICheckBoxDefaultBehaviorTest UICheckBoxDefaultBehaviorTest::UICheckBoxDefaultBehaviorTest() diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.h index 061f277c5b..d79722f22c 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.h @@ -40,8 +40,10 @@ public: virtual bool init() override; void selectedEvent(cocos2d::Ref* sender,cocos2d::ui::CheckBox::EventType type); + void printWidgetResources(cocos2d::Ref* sender); protected: cocos2d::ui::Text* _displayValueLabel; + cocos2d::ui::CheckBox* _checkBox; }; class UICheckBoxDefaultBehaviorTest : public UIScene diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp index fb941b2f56..ecc7dd380f 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp @@ -35,13 +35,26 @@ bool UIImageViewTest::init() _uiLayer->addChild(imageView); - + _image = imageView; + + TTFConfig ttfConfig("fonts/arial.ttf", 15); + auto label1 = Label::createWithTTF(ttfConfig, "Print Resources"); + auto item1 = MenuItemLabel::create(label1, CC_CALLBACK_1(UIImageViewTest::printWidgetResources, this)); + item1->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y + item1->getContentSize().height * 3)); + auto pMenu1 = Menu::create(item1, nullptr); + pMenu1->setPosition(Vec2(0, 0)); + this->addChild(pMenu1, 10); return true; } return false; } +void UIImageViewTest::printWidgetResources(cocos2d::Ref* sender) +{ + cocos2d::ResourceData textureFile = _image->getRenderFile(); + CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); +} // UIImageViewTest_Scale9 diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.h index b3cde4867b..6672294576 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.h @@ -35,6 +35,10 @@ public: CREATE_FUNC(UIImageViewTest); virtual bool init() override; + + void printWidgetResources(cocos2d::Ref* sender); +protected: + cocos2d::ui::ImageView* _image; }; class UIImageViewTest_Scale9 : public UIScene diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp index 02cdb5d4d5..89a450d0d0 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp @@ -264,12 +264,28 @@ bool UILayoutTest_BackGroundImage::init() button_scale9->getContentSize().height / 2.0f)); layout->addChild(button_scale9); + + _layout = layout; + + TTFConfig ttfConfig("fonts/arial.ttf", 15); + auto label1 = Label::createWithTTF(ttfConfig, "Print Resources"); + auto item1 = MenuItemLabel::create(label1, CC_CALLBACK_1(UILayoutTest_BackGroundImage::printWidgetResources, this)); + item1->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y + item1->getContentSize().height * 3)); + auto pMenu1 = Menu::create(item1, nullptr); + pMenu1->setPosition(Vec2(0, 0)); + this->addChild(pMenu1, 10); return true; } return false; } +void UILayoutTest_BackGroundImage::printWidgetResources(cocos2d::Ref* sender) +{ + cocos2d::ResourceData textureFile = _layout->getRenderFile(); + CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); +} + // UILayoutTest_BackGroundImage_Scale9 UILayoutTest_BackGroundImage_Scale9::UILayoutTest_BackGroundImage_Scale9() diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.h index 65336919c9..c5d8a77319 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.h @@ -67,6 +67,10 @@ public: virtual bool init() override; CREATE_FUNC(UILayoutTest_BackGroundImage); + + void printWidgetResources(cocos2d::Ref* sender); +protected: + cocos2d::ui::Layout* _layout; }; class UILayoutTest_BackGroundImage_Scale9 : public UIScene diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp index ad20c3c2a4..58f9aa1cfa 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp @@ -12,6 +12,7 @@ UILoadingBarTests::UILoadingBarTests() ADD_TEST_CASE(UILoadingBarTest_Scale9_State_Change); ADD_TEST_CASE(UILoadingBarReloadTexture); ADD_TEST_CASE(UILoadingBarIssue12249); + ADD_TEST_CASE(UILoadingBarTest_Direction); } // UILoadingBarTest_Left @@ -79,6 +80,16 @@ bool UILoadingBarTest_Left::init() _uiLayer->addChild(loadingBar,1); _uiLayer->addChild(loadingBarCopy,2); _uiLayer->addChild(button); + + _loadingBar = loadingBar; + + TTFConfig ttfConfig("fonts/arial.ttf", 15); + auto label1 = Label::createWithTTF(ttfConfig, "Print Resources"); + auto item1 = MenuItemLabel::create(label1, CC_CALLBACK_1(UILoadingBarTest_Left::printWidgetResources, this)); + item1->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y + item1->getContentSize().height * 3)); + auto pMenu1 = Menu::create(item1, nullptr); + pMenu1->setPosition(Vec2(0, 0)); + this->addChild(pMenu1, 10); return true; } @@ -98,6 +109,12 @@ void UILoadingBarTest_Left::update(float delta) loadingBarCopy->setPercent(_count); } +void UILoadingBarTest_Left::printWidgetResources(cocos2d::Ref* sender) +{ + cocos2d::ResourceData textureFile = _loadingBar->getRenderFile(); + CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); +} + // UILoadingBarTest_Right UILoadingBarTest_Right::UILoadingBarTest_Right() @@ -493,4 +510,77 @@ void UILoadingBarIssue12249::update(float delta) LoadingBar* loadingBarCopy = static_cast(_uiLayer->getChildByTag(1)); loadingBar->setPercent(_count); loadingBarCopy->setPercent(_count); +} + +// UILoadingBarTest_Direction + +UILoadingBarTest_Direction::UILoadingBarTest_Direction() + : _count(0) +{ + +} + +UILoadingBarTest_Direction::~UILoadingBarTest_Direction() +{ + //unscheduleUpdate(); +} + +bool UILoadingBarTest_Direction::init() +{ + if (UIScene::init()) + { + //scheduleUpdate(); + + Size widgetSize = _widget->getContentSize(); + + // Add the alert + Text* alert = Text::create("Test LoadingBar Change Direction", + "fonts/Marker Felt.ttf", 30); + alert->setColor(Color3B(159, 168, 176)); + alert->setPosition(Vec2(widgetSize.width / 2.0f, + widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f)); + _uiLayer->addChild(alert); + + // Create the loading bar + LoadingBar* loadingBar = LoadingBar::create("cocosui/sliderProgress.png"); + loadingBar->setTag(0); + loadingBar->setPercent(80); + loadingBar->setPosition(Vec2(widgetSize.width / 2.0f, + widgetSize.height / 2.0f + loadingBar->getContentSize().height / 4.0f)); + + auto loadingBarCopy = (LoadingBar*)loadingBar->clone(); + loadingBarCopy->setTag(1); + loadingBarCopy->setPosition(loadingBar->getPosition() + + Vec2(0, -40)); + loadingBarCopy->setDirection(LoadingBar::Direction::RIGHT); + + Button* button = Button::create("cocosui/animationbuttonnormal.png", + "cocosui/animationbuttonpressed.png"); + button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 50)); + button->setTitleText("Click to change direction!"); + + button->addTouchEventListener([=](Ref*, Widget::TouchEventType type) + { + if (type == Widget::TouchEventType::ENDED) + { + if (loadingBar->getDirection() == LoadingBar::Direction::LEFT) + { + loadingBar->setDirection(LoadingBar::Direction::RIGHT); + loadingBarCopy->setDirection(LoadingBar::Direction::LEFT); + } + else + { + loadingBar->setDirection(LoadingBar::Direction::LEFT); + loadingBarCopy->setDirection(LoadingBar::Direction::RIGHT); + } + } + }); + _uiLayer->addChild(loadingBar, 1); + _uiLayer->addChild(loadingBarCopy, 2); + _uiLayer->addChild(button); + + _loadingBar = loadingBar; + return true; + } + return false; } \ No newline at end of file diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.h index 49d1eeb744..1d74955cea 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.h @@ -38,9 +38,11 @@ public: ~UILoadingBarTest_Left(); virtual bool init() override; void update(float delta)override; + void printWidgetResources(cocos2d::Ref* sender); protected: int _count; + cocos2d::ui::LoadingBar* _loadingBar; }; class UILoadingBarTest_Right : public UIScene @@ -127,4 +129,17 @@ protected: int _count; }; +class UILoadingBarTest_Direction : public UIScene +{ +public: + CREATE_FUNC(UILoadingBarTest_Direction); + + UILoadingBarTest_Direction(); + ~UILoadingBarTest_Direction(); + virtual bool init() override; +protected: + int _count; + cocos2d::ui::LoadingBar* _loadingBar; +}; + #endif /* defined(__TestCpp__UILoadingBarTest__) */ diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp index 20040dfdb2..7306c0d9a8 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp @@ -13,6 +13,7 @@ UIPageViewTests::UIPageViewTests() ADD_TEST_CASE(UIPageViewJumpToPageTest); ADD_TEST_CASE(UIPageViewVerticalTest); ADD_TEST_CASE(UIPageViewDisableTouchTest); + ADD_TEST_CASE(UIPageViewChildSizeTest); } // UIPageViewTest @@ -876,3 +877,88 @@ bool UIPageViewDisableTouchTest::init() return false; } +// UIPageViewTest +UIPageViewChildSizeTest::UIPageViewChildSizeTest() + : _displayValueLabel(nullptr) +{ + +} + +UIPageViewChildSizeTest::~UIPageViewChildSizeTest() +{ +} + +bool UIPageViewChildSizeTest::init() +{ + if (UIScene::init()) + { + Size widgetSize = _widget->getContentSize(); + + // Add a label in which the dragpanel events will be displayed + _displayValueLabel = Text::create("Move by horizontal direction", "fonts/Marker Felt.ttf", 32); + _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f)); + _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, + widgetSize.height / 2.0f + + _displayValueLabel->getContentSize().height * 1.5)); + _uiLayer->addChild(_displayValueLabel); + + // Add the black background + Text* alert = Text::create("PageView", "fonts/Marker Felt.ttf", 30); + alert->setColor(Color3B(159, 168, 176)); + alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f)); + _uiLayer->addChild(alert); + + Layout* root = static_cast(_uiLayer->getChildByTag(81)); + + Layout* background = dynamic_cast(root->getChildByName("background_Panel")); + + // Create the page view + Size size(240, 130); + PageView* pageView = PageView::create(); + pageView->setDirection(PageView::Direction::HORIZONTAL); + pageView->setContentSize(size); + Size backgroundSize = background->getContentSize(); + pageView->setPosition((widgetSize - pageView->getContentSize()) / 2.0f); + pageView->removeAllItems(); + pageView->setIndicatorEnabled(true); + + int pageCount = 4; + for (int i = 0; i < pageCount; ++i) + { + ImageView* imageView = ImageView::create("cocosui/scrollviewbg.png"); + imageView->setScale9Enabled(true); + + Text* label = Text::create(StringUtils::format("page %d", (i + 1)), "fonts/Marker Felt.ttf", 30); + label->setColor(Color3B(192, 192, 192)); + label->setAnchorPoint(Vec2::ZERO); + imageView->addChild(label); + + pageView->insertCustomItem(imageView, i); + } + + pageView->addEventListener(CC_CALLBACK_2(UIPageViewChildSizeTest::pageViewEvent, this)); + + _uiLayer->addChild(pageView); + + return true; + } + return false; +} + +void UIPageViewChildSizeTest::pageViewEvent(Ref *pSender, PageView::EventType type) +{ + switch (type) + { + case PageView::EventType::TURNING: + { + PageView* pageView = dynamic_cast(pSender); + + _displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurrentPageIndex() + 1)); + } + break; + + default: + break; + } +} + diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.h index 466b95673a..bc17231970 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.h @@ -139,4 +139,20 @@ protected: cocos2d::ui::Text* _displayValueLabel; }; +class UIPageViewChildSizeTest : public UIScene +{ +public: + CREATE_FUNC(UIPageViewChildSizeTest); + + UIPageViewChildSizeTest(); + ~UIPageViewChildSizeTest(); + virtual bool init() override; + + void pageViewEvent(cocos2d::Ref* sender, cocos2d::ui::PageView::EventType type); + +protected: + + cocos2d::ui::Text* _displayValueLabel; +}; + #endif /* defined(__TestCpp__UIPageViewTest__) */ diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp index 408c61f91b..dd5628d656 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp @@ -38,6 +38,8 @@ UIScale9SpriteTests::UIScale9SpriteTests() ADD_TEST_CASE(UIS9FrameNameSpriteSheetRotated); ADD_TEST_CASE(UIS9FrameNameSpriteSheetCropped); ADD_TEST_CASE(UIS9FrameNameSpriteSheetCroppedRotated); + ADD_TEST_CASE(UIS9FrameNameSpriteSheetCroppedSimple); + ADD_TEST_CASE(UIS9FrameNameSpriteSheetCroppedRotatedSimple); ADD_TEST_CASE(UIS9BatchNodeScaledNoInsets); ADD_TEST_CASE(UIS9FrameNameSpriteSheetScaledNoInsets); ADD_TEST_CASE(UIS9FrameNameSpriteSheetRotatedScaledNoInsets); @@ -55,6 +57,8 @@ UIScale9SpriteTests::UIScale9SpriteTests() ADD_TEST_CASE(UIS9NinePatchTest); ADD_TEST_CASE(UIS9BatchTest); ADD_TEST_CASE(UIS9ToggleRenderingTypeTest); + ADD_TEST_CASE(UIS9GlobalZOrderTest); + ADD_TEST_CASE(UIS9EnableScale9FalseTest); } // UIScale9SpriteTest @@ -92,6 +96,7 @@ bool UIScale9SpriteTest::init() normalSprite2->setPosition(120, 270); normalSprite2->setScale9Enabled(false); normalSprite2->setOpacity(100); + normalSprite2->setContentSize(normalSprite2->getContentSize() * 2); this->addChild(normalSprite2); normalSprite2->setColor(Color3B::GREEN); normalSprite2->runAction(action); @@ -327,6 +332,8 @@ bool UIS9FrameNameSpriteSheetRotated::init() auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png"); + blocks->setPreferredSize(Size(400,80)); + blocks->setPosition(Vec2(x, y)); this->addChild(blocks); @@ -347,11 +354,15 @@ bool UIS9FrameNameSpriteSheetCropped::init() SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist); auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9c.png"); - blocks->setRenderingType(Scale9Sprite::RenderingType::SIMPLE); - blocks->setPosition(Vec2(x, y)); - blocks->setCapInsets(Rect(5,5,5,5)); + blocks->setPreferredSize(Size(400,80)); + blocks->setPosition(Vec2(x, y + 45)); this->addChild(blocks); + auto blocks2 = ui::Scale9Sprite::create("Images/blocks9c.png"); + blocks2->setPreferredSize(Size(400,80)); + blocks2->setPosition(Vec2(x, y - 45)); + this->addChild(blocks2); + return true; } @@ -368,11 +379,67 @@ bool UIS9FrameNameSpriteSheetCroppedRotated::init() SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist); auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9cr.png"); - blocks->setRenderingType(Scale9Sprite::RenderingType::SIMPLE); - blocks->setPosition(Vec2(x, y)); - blocks->setInsetBottom(10); + blocks->setPreferredSize(Size(400,80)); + blocks->setPosition(Vec2(x, y + 45)); this->addChild(blocks); + auto blocks2 = ui::Scale9Sprite::create("Images/blocks9cr.png"); + blocks2->setPreferredSize(Size(400,80)); + blocks2->setPosition(Vec2(x, y - 45)); + this->addChild(blocks2); + + return true; + } + + return false; +} + +bool UIS9FrameNameSpriteSheetCroppedSimple::init() +{ + if (UIScene::init()) { + auto winSize = Director::getInstance()->getWinSize(); + float x = winSize.width / 2; + float y = 0 + (winSize.height / 2); + + SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist); + + auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9c.png"); + blocks->setRenderingType(Scale9Sprite::RenderingType::SIMPLE); + blocks->setPreferredSize(Size(400,80)); + blocks->setPosition(Vec2(x, y + 45)); + this->addChild(blocks); + + auto blocksSprite = Sprite::createWithSpriteFrameName("blocks9c.png"); + blocksSprite->setScale(400/blocksSprite->getContentSize().width, 80/blocksSprite->getContentSize().height); + blocksSprite->setPosition(Vec2(x, y - 45)); + this->addChild(blocksSprite); + + return true; + } + + return false; +} + +bool UIS9FrameNameSpriteSheetCroppedRotatedSimple::init() +{ + if (UIScene::init()) { + auto winSize = Director::getInstance()->getWinSize(); + float x = winSize.width / 2; + float y = 0 + (winSize.height / 2); + + SpriteFrameCache::getInstance()->addSpriteFramesWithFile(s_s9s_blocks9_plist); + + auto blocks = ui::Scale9Sprite::createWithSpriteFrameName("blocks9cr.png"); + blocks->setRenderingType(Scale9Sprite::RenderingType::SIMPLE); + blocks->setPreferredSize(Size(400,80)); + blocks->setPosition(Vec2(x, y + 45)); + this->addChild(blocks); + + auto blocksSprite = Sprite::createWithSpriteFrameName("blocks9cr.png"); + blocksSprite->setScale(400/blocksSprite->getContentSize().width, 80/blocksSprite->getContentSize().height); + blocksSprite->setPosition(Vec2(x, y - 45)); + this->addChild(blocksSprite); + return true; } @@ -994,3 +1061,82 @@ bool UIS9ToggleRenderingTypeTest::init() return false; } + +bool UIS9GlobalZOrderTest::init() +{ + if (UIScene::init()) { + + auto winSize = Director::getInstance()->getWinSize(); + float x = winSize.width / 2; + float y = 0 + (winSize.height / 2 - 20); + + auto label = Label::createWithSystemFont("The green scale9sprite is in the back.", "Arial", 15); + label->setPosition(Vec2(winSize.width/2, winSize.height - 60)); + this->addChild(label); + + auto blocks = ui::Scale9Sprite::create("Images/blocks9.png"); + + blocks->setPosition(Vec2(x, y)); + blocks->setPreferredSize(Size(96*2, 96*1.5)); + blocks->setColor(Color3B::RED); + blocks->setGlobalZOrder(1); + this->addChild(blocks); + + + auto blocks2 = ui::Scale9Sprite::create("Images/blocks9.png"); + blocks2->setPosition(Vec2(x, y)); + blocks2->setPreferredSize(Size(96*3, 96)); + blocks2->setGlobalZOrder(0); + blocks2->setColor(Color3B::GREEN); + this->addChild(blocks2); + + + return true; + } + return false; +} + + +bool UIS9EnableScale9FalseTest::init() +{ + if (UIScene::init()) { + + auto winSize = Director::getInstance()->getWinSize(); + float x = winSize.width / 2 + 50; + float y = 0 + (winSize.height / 2 + 10); + + auto label = Label::createWithSystemFont("Only the yellow block intersect with the green one.", "Arial", 15); + label->setPosition(Vec2(winSize.width/2, winSize.height - 60)); + this->addChild(label); + + auto blocks = ui::Scale9Sprite::create("Images/blocks9.png"); + blocks->setScale9Enabled(false); + blocks->setPosition(Vec2(x, y)); + blocks->setPreferredSize(Size(96*2, 96)); + blocks->setColor(Color3B::RED); + blocks->setGlobalZOrder(1); + this->addChild(blocks); + + + auto blocks2 = ui::Scale9Sprite::create("Images/blocks9.png"); + blocks2->setScale9Enabled(false); + blocks2->setPosition(Vec2(0, 0)); + blocks2->setPreferredSize(Size(96*1.5, 96)); + blocks2->setGlobalZOrder(0); + blocks2->setColor(Color3B::GREEN); + blocks->addChild(blocks2); + + auto blocks3 = ui::Scale9Sprite::create("Images/blocks9.png"); + blocks3->setScale9Enabled(false); + blocks3->setPosition(Vec2(0, 0)); + blocks3->setPreferredSize(Size(96, 96)); + blocks3->setGlobalZOrder(2); + blocks3->setColor(Color3B::YELLOW); + blocks2->addChild(blocks3); + + + return true; + } + return false; +} + diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.h index 87b328bf9c..11042a7990 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.h @@ -91,6 +91,27 @@ public: virtual bool init() override; }; +// S9FrameNameSpriteSheetCroppedSimple + +class UIS9FrameNameSpriteSheetCroppedSimple : public UIScene +{ +public: + CREATE_FUNC(UIS9FrameNameSpriteSheetCroppedSimple); + + virtual bool init() override; +}; + +// S9FrameNameSpriteSheetCroppedRotatedSimple + +class UIS9FrameNameSpriteSheetCroppedRotatedSimple : public UIScene +{ +public: + CREATE_FUNC(UIS9FrameNameSpriteSheetCroppedRotatedSimple); + + virtual bool init() override; +}; + + // S9FrameNameSpriteSheetCropped class UIS9FrameNameSpriteSheetCropped : public UIScene @@ -274,4 +295,20 @@ public: virtual bool init() override; }; +class UIS9GlobalZOrderTest: public UIScene +{ +public: + CREATE_FUNC(UIS9GlobalZOrderTest); + + virtual bool init() override; +}; + +class UIS9EnableScale9FalseTest: public UIScene +{ +public: + CREATE_FUNC(UIS9EnableScale9FalseTest); + + virtual bool init() override; +}; + #endif /* defined(__cocos2d_tests__UIScale9SpriteTest__) */ diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp index 4dbc7c2879..9f695b896c 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp @@ -13,6 +13,7 @@ UIScrollViewTests::UIScrollViewTests() ADD_TEST_CASE(UIScrollViewNestTest); ADD_TEST_CASE(UIScrollViewRotated); ADD_TEST_CASE(UIScrollViewDisableTest); + ADD_TEST_CASE(UIScrollViewInnerSize); } // UIScrollViewTest_Vertical @@ -618,3 +619,65 @@ bool UIScrollViewDisableTest::init() return false; } + +// UIScrollViewInnerSize + +UIScrollViewInnerSize::UIScrollViewInnerSize() + : _displayValueLabel(nullptr) +{ +} + +UIScrollViewInnerSize::~UIScrollViewInnerSize() +{ +} + +bool UIScrollViewInnerSize::init() +{ + if (UIScene::init()) + { + Size widgetSize = _widget->getContentSize(); + + // Add a label in which the scrollview alert will be displayed + _displayValueLabel = Text::create("ScrollView InnerSize Test", "fonts/Marker Felt.ttf", 32); + _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f)); + _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, + widgetSize.height / 2.0f + _displayValueLabel->getContentSize().height * 1.5f)); + _uiLayer->addChild(_displayValueLabel); + + // Add the alert + Text* alert = Text::create("ScrollView & InnerContainer should be align to the left and top point", "fonts/Marker Felt.ttf", 10); + alert->setColor(Color3B(159, 168, 176)); + alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f)); + _uiLayer->addChild(alert); + + Layout* root = static_cast(_uiLayer->getChildByTag(81)); + + Layout* background = dynamic_cast(root->getChildByName("background_Panel")); + + // Create the scrollview by vertical + ui::ScrollView* scrollView = ui::ScrollView::create(); + scrollView->setContentSize(Size(200.0f, 50.0f)); + Size backgroundSize = background->getContentSize(); + scrollView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f + + (backgroundSize.width - scrollView->getContentSize().width) / 2.0f, + (widgetSize.height - backgroundSize.height) / 2.0f + + (backgroundSize.height - scrollView->getContentSize().height) / 2.0f)); + scrollView->setScrollBarWidth(4); + scrollView->setTouchEnabled(false); + scrollView->setScrollBarPositionFromCorner(Vec2(2, 2)); + scrollView->setScrollBarColor(Color3B::WHITE); + scrollView->setBackGroundColorType(Layout::BackGroundColorType::SOLID); + scrollView->setBackGroundColor(ccc3(150, 150, 100)); + scrollView->getInnerContainer()->setBackGroundColorType(Layout::BackGroundColorType::SOLID); + scrollView->getInnerContainer()->setBackGroundColor(ccc3(50, 100, 50)); + scrollView->getInnerContainer()->setBackGroundColorOpacity(100); + scrollView->setClippingEnabled(false); + _uiLayer->addChild(scrollView); + + scrollView->setInnerContainerSize(Size(250.f, 100.f)); + + return true; + } + + return false; +} \ No newline at end of file diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.h index 25b3fcdf11..35f5bfe79e 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.h @@ -136,6 +136,20 @@ public: ~UIScrollViewDisableTest(); virtual bool init() override; +protected: + + cocos2d::ui::Text* _displayValueLabel; +}; + +class UIScrollViewInnerSize : public UIScene +{ +public: + CREATE_FUNC(UIScrollViewInnerSize); + + UIScrollViewInnerSize(); + ~UIScrollViewInnerSize(); + virtual bool init() override; + protected: cocos2d::ui::Text* _displayValueLabel; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp index 36c04482fc..80980203fc 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp @@ -54,6 +54,15 @@ bool UISliderTest::init() slider->addEventListener(CC_CALLBACK_2(UISliderTest::sliderEvent, this)); _uiLayer->addChild(slider); + _slider = slider; + + TTFConfig ttfConfig("fonts/arial.ttf", 15); + auto label1 = Label::createWithTTF(ttfConfig, "Print Resources"); + auto item1 = MenuItemLabel::create(label1, CC_CALLBACK_1(UISliderTest::printWidgetResources, this)); + item1->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y + item1->getContentSize().height * 3)); + auto pMenu1 = Menu::create(item1, nullptr); + pMenu1->setPosition(Vec2(0, 0)); + this->addChild(pMenu1, 10); return true; } @@ -70,6 +79,19 @@ void UISliderTest::sliderEvent(Ref *pSender, Slider::EventType type) _displayValueLabel->setString(StringUtils::format("Percent %f", 10000.0 * percent / maxPercent)); } } +void UISliderTest::printWidgetResources(cocos2d::Ref* sender) +{ + cocos2d::ResourceData textureFile = _slider->getBackFile(); + CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); + cocos2d::ResourceData progressBarTextureFile = _slider->getProgressBarFile(); + CCLOG("progressBarTextureFile Name : %s, Type: %d", progressBarTextureFile.file.c_str(), progressBarTextureFile.type); + cocos2d::ResourceData slidBallNormalTextureFile = _slider->getBallNormalFile(); + CCLOG("slidBallNormalTextureFile Name : %s, Type: %d", slidBallNormalTextureFile.file.c_str(), slidBallNormalTextureFile.type); + cocos2d::ResourceData slidBallPressedTextureFile = _slider->getBallPressedFile(); + CCLOG("slidBallPressedTextureFile Name : %s, Type: %d", slidBallPressedTextureFile.file.c_str(), slidBallPressedTextureFile.type); + cocos2d::ResourceData slidBallDisabledTextureFile = _slider->getBallDisabledFile(); + CCLOG("slidBallDisabledTextureFile Name : %s, Type: %d", slidBallDisabledTextureFile.file.c_str(), slidBallDisabledTextureFile.type); +} // UISliderTest_Scale9 diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.h index 3e65577dd0..4f504c183b 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.h @@ -38,9 +38,11 @@ public: ~UISliderTest(); virtual bool init() override; void sliderEvent(cocos2d::Ref* sender, cocos2d::ui::Slider::EventType type); + void printWidgetResources(cocos2d::Ref* sender); protected: cocos2d::ui::TextBMFont* _displayValueLabel; + cocos2d::ui::Slider* _slider; }; class UISliderTest_Scale9 : public UIScene diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp index 6a09be81f8..fa90a3ff43 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp @@ -34,7 +34,21 @@ bool UITextAtlasTest::init() textAtlas->setPosition(Vec2((widgetSize.width) / 2, widgetSize.height / 2.0f)); _uiLayer->addChild(textAtlas); + _textAtlas = textAtlas; + + TTFConfig ttfConfig("fonts/arial.ttf", 15); + auto label1 = Label::createWithTTF(ttfConfig, "Print Resources"); + auto item1 = MenuItemLabel::create(label1, CC_CALLBACK_1(UITextAtlasTest::printWidgetResources, this)); + item1->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y + item1->getContentSize().height * 3)); + auto pMenu1 = Menu::create(item1, nullptr); + pMenu1->setPosition(Vec2(0, 0)); + this->addChild(pMenu1, 10); return true; } return false; } +void UITextAtlasTest::printWidgetResources(cocos2d::Ref* sender) +{ + cocos2d::ResourceData textureFile = _textAtlas->getRenderFile(); + CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); +} diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.h index 2eef8b80c0..bc7c03aa53 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.h @@ -13,6 +13,9 @@ public: CREATE_FUNC(UITextAtlasTest); virtual bool init() override; + void printWidgetResources(cocos2d::Ref* sender); +protected: + cocos2d::ui::TextAtlas* _textAtlas; }; #endif /* defined(__TestCpp__UITextAtlasTest__) */ diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp index 211132dc02..902d724d79 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp @@ -25,7 +25,22 @@ bool UITextBMFontTest::init() textBMFont->setPosition(Vec2(widgetSize.width / 2, widgetSize.height / 2.0f + textBMFont->getContentSize().height / 8.0f)); _uiLayer->addChild(textBMFont); + _textBMFont = textBMFont; + + TTFConfig ttfConfig("fonts/arial.ttf", 15); + auto label1 = Label::createWithTTF(ttfConfig, "Print Resources"); + auto item1 = MenuItemLabel::create(label1, CC_CALLBACK_1(UITextBMFontTest::printWidgetResources, this)); + item1->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y + item1->getContentSize().height * 3)); + auto pMenu1 = Menu::create(item1, nullptr); + pMenu1->setPosition(Vec2(0, 0)); + this->addChild(pMenu1, 10); + return true; } return false; } +void UITextBMFontTest::printWidgetResources(cocos2d::Ref* sender) +{ + cocos2d::ResourceData textureFile = _textBMFont->getRenderFile(); + CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); +} diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.h index c3a228a695..795e7bd60b 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.h @@ -35,6 +35,9 @@ public: CREATE_FUNC(UITextBMFontTest) virtual bool init() override; + void printWidgetResources(cocos2d::Ref* sender); +protected: + cocos2d::ui::TextBMFont* _textBMFont; }; #endif /* defined(__TestCpp__UITextBMFontTest__) */ diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp index 603121c565..97dc2f06c1 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp @@ -11,6 +11,7 @@ UITextTests::UITextTests() ADD_TEST_CASE(UILabelTest_Effect); ADD_TEST_CASE(UITextTest_TTF); ADD_TEST_CASE(UITextTest_IgnoreConentSize); + ADD_TEST_CASE(UITextTest_Clone); } // UITextTest @@ -263,3 +264,33 @@ bool UITextTest_IgnoreConentSize::init() } return false; } + +// UITextTest_IgnoreConentSize + +bool UITextTest_Clone::init() +{ + if (UIScene::init()) + { + Size widgetSize = _widget->getContentSize(); + + Text* singleText = Text::create("ignore conent", + "fonts/Marker Felt.ttf", 30); + singleText->setPosition(Vec2(widgetSize.width / 2.0f - 80, + widgetSize.height / 2.0f)); + singleText->setString("CHUKONG"); + singleText->setTouchScaleChangeEnabled(true); + singleText->setTouchEnabled(true); + singleText->enableOutline(Color4B(255,0,0,100), 10); + singleText->enableShadow(Color4B::YELLOW, Size(2,-2), 0); + _uiLayer->addChild(singleText); + + auto cloneText = singleText->clone(); + cloneText->setPosition(Vec2(widgetSize.width / 2.0f + 80, + widgetSize.height / 2.0f)); + _uiLayer->addChild(cloneText); + + return true; + } + return false; +} + diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.h index 081b4ab94e..e0a8947ab9 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.h @@ -71,4 +71,12 @@ public: virtual bool init() override; }; +class UITextTest_Clone : public UIScene +{ +public: + CREATE_FUNC(UITextTest_Clone); + + virtual bool init() override; +}; + #endif /* defined(__TestCpp__UITextTest__) */ diff --git a/tests/cpp-tests/Resources/Images/blocks9c.png b/tests/cpp-tests/Resources/Images/blocks9c.png new file mode 100644 index 0000000000..39674a445c Binary files /dev/null and b/tests/cpp-tests/Resources/Images/blocks9c.png differ diff --git a/tests/cpp-tests/Resources/Images/blocks9cr.png b/tests/cpp-tests/Resources/Images/blocks9cr.png new file mode 100644 index 0000000000..beea86d7f8 Binary files /dev/null and b/tests/cpp-tests/Resources/Images/blocks9cr.png differ diff --git a/tests/cpp-tests/Resources/Images/blocks9ss.plist b/tests/cpp-tests/Resources/Images/blocks9ss.plist index 2cc9ac518e..07f3083a4a 100755 --- a/tests/cpp-tests/Resources/Images/blocks9ss.plist +++ b/tests/cpp-tests/Resources/Images/blocks9ss.plist @@ -33,28 +33,28 @@ blocks9c.png frame - {{103,189},{50,60}} + {{101,197},{58, 48}} offset - {13,18} + {15, -20} rotated sourceColorRect - {{0,0},{192,192}} + {{34, 44}, {58, 48}} sourceSize - {96,96} + {96, 96} blocks9cr.png frame - {{103,91},{50,60}} + {{71,89},{58, 48}} offset - {13,18} + {15, -20} rotated sourceColorRect - {{0,0},{96,96}} + {{34, 44}, {58, 48}} sourceSize - {96,96} + {96, 96} grossini_dance_01.png diff --git a/tests/cpp-tests/Resources/hd/Images/blocks9c.png b/tests/cpp-tests/Resources/hd/Images/blocks9c.png new file mode 100644 index 0000000000..2dca858356 Binary files /dev/null and b/tests/cpp-tests/Resources/hd/Images/blocks9c.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/blocks9cr.png b/tests/cpp-tests/Resources/hd/Images/blocks9cr.png new file mode 100644 index 0000000000..74fc6c8b01 Binary files /dev/null and b/tests/cpp-tests/Resources/hd/Images/blocks9cr.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/blocks9r.png b/tests/cpp-tests/Resources/hd/Images/blocks9r.png new file mode 100644 index 0000000000..79c0c94604 Binary files /dev/null and b/tests/cpp-tests/Resources/hd/Images/blocks9r.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/blocks9ss.plist b/tests/cpp-tests/Resources/hd/Images/blocks9ss.plist index 9f77a49011..4548217df5 100755 --- a/tests/cpp-tests/Resources/hd/Images/blocks9ss.plist +++ b/tests/cpp-tests/Resources/hd/Images/blocks9ss.plist @@ -33,28 +33,28 @@ blocks9c.png frame - {{204,374},{100,120}} + {{197,388}, {122, 102}} offset - {26,36} + {30, -41} rotated sourceColorRect - {{0,0},{192,192}} + {{65, 86}, {122, 102}} sourceSize - {192,192} + {192, 192} blocks9cr.png frame - {{204,180},{100,120}} + {{136,173}, {122, 102}} offset - {26,36} + {30, -41} rotated sourceColorRect - {{0,0},{192,192}} + {{65, 86}, {122, 102}} sourceSize - {192,192} + {192, 192} grossini_dance_01.png diff --git a/tests/cpp-tests/proj.ios/Info.plist b/tests/cpp-tests/proj.ios/Info.plist index a08bb21d3b..84b34b2f90 100644 --- a/tests/cpp-tests/proj.ios/Info.plist +++ b/tests/cpp-tests/proj.ios/Info.plist @@ -8,6 +8,15 @@ NSExceptionDomains + sdkbox.com + + NSIncludesSubdomains + + NSTemporaryExceptionAllowsInsecureHTTPLoads + + NSTemporaryExceptionMinimumTLSVersion + TLSv1.1 + cocos2d-x.org NSIncludesSubdomains diff --git a/tests/js-tests/project/Classes/js_DrawNode3D_bindings.cpp b/tests/js-tests/project/Classes/js_DrawNode3D_bindings.cpp index cc1bb7a1f0..e3d0dc14fb 100644 --- a/tests/js-tests/project/Classes/js_DrawNode3D_bindings.cpp +++ b/tests/js-tests/project/Classes/js_DrawNode3D_bindings.cpp @@ -485,29 +485,15 @@ bool js_cocos2dx_DrawNode3D_constructor(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - cocos2d::DrawNode3D* cobj = new (std::nothrow) cocos2d::DrawNode3D(); + cocos2d::DrawNode3D* cobj = new (std::nothrow) cocos2d::DrawNode3D; cobj->init(); - cocos2d::Ref *_ccobj = dynamic_cast(cobj); - if (_ccobj) { - _ccobj->autorelease(); - } - TypeTest t; - js_type_class_t *typeClass = nullptr; - std::string typeName = t.s_name(); - auto typeMapIter = _js_global_type_map.find(typeName); - CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!"); - typeClass = typeMapIter->second; - CCASSERT(typeClass, "The value is null."); - // JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto); - JS::RootedObject proto(cx, typeClass->proto.ref()); - JS::RootedObject parent(cx, typeClass->parentProto.ref()); - JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent)); - args.rval().set(OBJECT_TO_JSVAL(obj)); + js_type_class_t *typeClass = js_get_type_from_native(cobj); + // link the native object with the javascript object - js_proxy_t* p = jsb_new_proxy(cobj, obj); - AddNamedObjectRoot(cx, &p->obj, "cocos2d::DrawNode3D"); - if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok) - ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args); + JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::DrawNode3D")); + args.rval().set(OBJECT_TO_JSVAL(jsobj)); + if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args); return true; } @@ -520,9 +506,6 @@ static bool js_is_native_obj(JSContext *cx, uint32_t argc, jsval *vp) extern JSObject *jsb_cocos2d_Node_prototype; -void js_cocos2d_DrawNode3D_finalize(JSFreeOp *fop, JSObject *obj) { - CCLOGINFO("jsbindings: finalizing JS object %p (DrawNode3D)", obj); -} void js_register_cocos2dx_DrawNode3D(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_DrawNode3D_class = (JSClass *)calloc(1, sizeof(JSClass)); @@ -534,7 +517,7 @@ void js_register_cocos2dx_DrawNode3D(JSContext *cx, JS::HandleObject global) { jsb_cocos2d_DrawNode3D_class->enumerate = JS_EnumerateStub; jsb_cocos2d_DrawNode3D_class->resolve = JS_ResolveStub; jsb_cocos2d_DrawNode3D_class->convert = JS_ConvertStub; - jsb_cocos2d_DrawNode3D_class->finalize = js_cocos2d_DrawNode3D_finalize; + jsb_cocos2d_DrawNode3D_class->finalize = jsb_ref_finalize; jsb_cocos2d_DrawNode3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2); static JSPropertySpec properties[] = { diff --git a/tests/js-tests/src/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.js b/tests/js-tests/src/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.js index cb30419028..03092ff658 100644 --- a/tests/js-tests/src/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.js +++ b/tests/js-tests/src/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.js @@ -264,7 +264,7 @@ var ControlButtonTest_Styling = ControlScene.extend({ titleButton.color = cc.color(159, 168, 176); - var button = new cc.ControlButton(titleButton, backgroundButton); + var button = new cc.ControlButton(titleButton, backgroundButton, null, null, false); button.setBackgroundSpriteForState(backgroundHighlightedButton, cc.CONTROL_STATE_HIGHLIGHTED); button.setTitleColorForState(cc.color.WHITE, cc.CONTROL_STATE_HIGHLIGHTED); diff --git a/tests/js-tests/src/GUITest/UIFocusTest/UIFocusTest.js b/tests/js-tests/src/GUITest/UIFocusTest/UIFocusTest.js index 5b172dae05..27ea0e2164 100644 --- a/tests/js-tests/src/GUITest/UIFocusTest/UIFocusTest.js +++ b/tests/js-tests/src/GUITest/UIFocusTest/UIFocusTest.js @@ -188,8 +188,6 @@ var UIFocusTestVertical = UIFocusTestBase.extend({ w.setTag(i); w.addTouchEventListener(this.onImageViewClicked, this); this._verticalLayout.addChild(w); - if (i == 2) - w.requestFocus(); } this._loopText = new ccui.Text("loop enabled", "Arial", 20); diff --git a/tests/js-tests/src/MemoryModelTest/MemoryModelTest.js b/tests/js-tests/src/MemoryModelTest/MemoryModelTest.js index a38d14f122..ea0e8a245d 100644 --- a/tests/js-tests/src/MemoryModelTest/MemoryModelTest.js +++ b/tests/js-tests/src/MemoryModelTest/MemoryModelTest.js @@ -70,6 +70,7 @@ var SetPropertyMemoryModelTest = MemoryModelTestBase.extend({ _subtitle:"See console for possible errors", ctor:function () { + cc.sys.garbageCollect(); this._super(); var sprite = new cc.Sprite(s_grossini_dance_atlas, cc.rect(0, 0, 85, 121)); var tag = 10; @@ -157,6 +158,12 @@ var LocalVarMemoryModelTest = MemoryModelTestBase.extend({ var sprite2 = new cc.Sprite(s_grossini_dance_atlas, cc.rect(0, 0, 85, 121)); var sprite3 = new cc.Sprite(s_grossini_dance_atlas, cc.rect(0, 0, 85, 121)); var a = 10; + this.addChild(sprite1); + this.removeChild(sprite1); +// this.addChild(sprite2); +// this.removeChild(sprite2); + this.addChild(sprite3); + this.removeChild(sprite3); //cc.sys.dumpRoot(); cc.sys.garbageCollect(); cc.log(sprite1); diff --git a/tests/js-tests/src/TextureCacheTest/TextureCacheTest.js b/tests/js-tests/src/TextureCacheTest/TextureCacheTest.js index 5c6c0c2190..0f9d06c645 100644 --- a/tests/js-tests/src/TextureCacheTest/TextureCacheTest.js +++ b/tests/js-tests/src/TextureCacheTest/TextureCacheTest.js @@ -282,6 +282,8 @@ var RemoteTextureTest = TextureCacheTestBase.extend({ for (var i = 0; i < imageUrlArray.length; i++) { cc.textureCache.addImageAsync(imageUrlArray[i], this.texLoaded, this); } + + cc.loader.loadImg("http://www.cocos2d-x.org/no_such_file.jpg", this.failLoaded.bind(this)); }, texLoaded: function(texture) { @@ -296,6 +298,21 @@ var RemoteTextureTest = TextureCacheTestBase.extend({ else { cc.log("Fail to load remote texture"); } + }, + + failLoaded: function (err, img) { + var str = ""; + if (err) { + str = "Correct behavior: failed to download from wrong url"; + } + else { + str = "!!! Wrong behavior: succeed to download from wrong url"; + } + + var label = new cc.LabelTTF(str, "Times New Roman", 28); + label.x = winSize.width / 2; + label.y = winSize.height / 2; + this.addChild(label, 100); } }); diff --git a/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua b/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua index 237c35d62b..114cd78764 100644 --- a/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua +++ b/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua @@ -1722,13 +1722,11 @@ add_new_testcase(function() local pageView = ccui.PageView:create() pageView:setTouchEnabled(true) pageView:setContentSize(cc.size(240, 130)) - pageView:setDirection(ccui.PageViewDirection.HORIZONTAL) local backgroundSize = background:getContentSize() pageView:setPosition(cc.p((widgetSize.width - backgroundSize.width) / 2 + (backgroundSize.width - pageView:getContentSize().width) / 2, (widgetSize.height - backgroundSize.height) / 2 + (backgroundSize.height - pageView:getContentSize().height) / 2)) - for i = 1 , 3 do local layout = ccui.Layout:create() layout:setContentSize(cc.size(240, 130)) @@ -1788,7 +1786,7 @@ add_new_testcase(function() local pageView = ccui.PageView:create() pageView:setTouchEnabled(true) - pageView:setDirection(ccui.PageViewDirection.VERTICAL) + pageView:setDirection(ccui.ScrollViewDir.vertical) pageView:setContentSize(cc.size(240, 130)) local backgroundSize = background:getContentSize() pageView:setPosition(cc.p((widgetSize.width - backgroundSize.width) / 2 + @@ -2343,6 +2341,15 @@ add_new_testcase(function() local eventDispatcher = self:getEventDispatcher() eventDispatcher:addEventListenerWithFixedPriority(eventListener, 1) + local function onExit(tag) + if tag == "exit" then + if eventListener ~= nil then + eventDispatcher:removeEventListener(eventListener) + end + end + end + self:registerScriptHandler(onExit) + local winSize = cc.Director:getInstance():getVisibleSize() self._horizontalLayout = ccui.HBox:create() self._horizontalLayout:setPosition(cc.p(20, winSize.height / 2 + 40)) @@ -2476,6 +2483,15 @@ add_new_testcase(function() local eventDispatcher = self:getEventDispatcher() eventDispatcher:addEventListenerWithFixedPriority(eventListener, 1) + local function onExit(tag) + if tag == "exit" then + if eventListener ~= nil then + eventDispatcher:removeEventListener(eventListener) + end + end + end + self:registerScriptHandler(onExit) + local winSize = cc.Director:getInstance():getVisibleSize() self._verticalLayout = ccui.VBox:create() self._verticalLayout:setPosition(cc.p(winSize.width/2 - 100, winSize.height - 70)) @@ -2609,6 +2625,15 @@ add_new_testcase(function() local eventDispatcher = self:getEventDispatcher() eventDispatcher:addEventListenerWithFixedPriority(eventListener, 1) + local function onExit(tag) + if tag == "exit" then + if eventListener ~= nil then + eventDispatcher:removeEventListener(eventListener) + end + end + end + self:registerScriptHandler(onExit) + local winSize = cc.Director:getInstance():getVisibleSize() self._verticalLayout = ccui.VBox:create() @@ -2774,6 +2799,15 @@ add_new_testcase(function() local eventDispatcher = self:getEventDispatcher() eventDispatcher:addEventListenerWithFixedPriority(eventListener, 1) + local function onExit(tag) + if tag == "exit" then + if eventListener ~= nil then + eventDispatcher:removeEventListener(eventListener) + end + end + end + self:registerScriptHandler(onExit) + local winSize = cc.Director:getInstance():getVisibleSize() self._horizontalLayout = ccui.HBox:create() @@ -2939,6 +2973,15 @@ add_new_testcase(function() local eventDispatcher = self:getEventDispatcher() eventDispatcher:addEventListenerWithFixedPriority(eventListener, 1) + local function onExit(tag) + if tag == "exit" then + if eventListener ~= nil then + eventDispatcher:removeEventListener(eventListener) + end + end + end + self:registerScriptHandler(onExit) + local winSize = cc.Director:getInstance():getVisibleSize() self._verticalLayout = ccui.VBox:create() diff --git a/tests/lua-tests/src/ExtensionTest/ExtensionTest.lua b/tests/lua-tests/src/ExtensionTest/ExtensionTest.lua index e62cb39f23..e20f04c7c2 100644 --- a/tests/lua-tests/src/ExtensionTest/ExtensionTest.lua +++ b/tests/lua-tests/src/ExtensionTest/ExtensionTest.lua @@ -591,7 +591,7 @@ local function runCCControlTest() pTitleButton:setColor(cc.c3b(159, 168, 176)) - local pButton = cc.ControlButton:create(pTitleButton, pBackgroundButton) + local pButton = cc.ControlButton:create(pTitleButton, pBackgroundButton,false) pButton:setBackgroundSpriteForState(pBackgroundHighlightedButton, cc.CONTROL_STATE_HIGH_LIGHTED ) pButton:setTitleColorForState(cc.c3b(255,255,255), cc.CONTROL_STATE_HIGH_LIGHTED ) diff --git a/tools/bindings-generator b/tools/bindings-generator index 26b56a42b7..54eff9fa73 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 26b56a42b7ea74ca7acb4003c7f98fe149741503 +Subproject commit 54eff9fa737a71fef7886a4c785dc1b10e079231 diff --git a/tools/cocos2d-console b/tools/cocos2d-console index c33fea773d..1ad9331a9e 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit c33fea773db67e94818ce7ac9e2146895fd15d53 +Subproject commit 1ad9331a9e3cbef9c499b6c785d64c25b2f7e133 diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist b/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist index 3a52f89600..70c8595a30 100644 --- a/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist +++ b/tools/simulator/frameworks/runtime-src/proj.ios_mac/mac/Info.plist @@ -41,7 +41,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.9 + 3.10 CFBundleSignature ???? CFBundleVersion diff --git a/tools/simulator/frameworks/runtime-src/proj.win32/game.rc b/tools/simulator/frameworks/runtime-src/proj.win32/game.rc index 35e7e472f4..65a3d825ec 100755 --- a/tools/simulator/frameworks/runtime-src/proj.win32/game.rc +++ b/tools/simulator/frameworks/runtime-src/proj.win32/game.rc @@ -64,7 +64,7 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "About Simulator" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CTEXT "Version 3.9 (20151106)",IDC_ABOUT_VERSION,35,70,173,17 + CTEXT "Version 3.10 (20151222)",IDC_ABOUT_VERSION,35,70,173,17 CTEXT "Cocos Simulator",IDC_ABOUT_TITLE,35,49,173,17 CTEXT "Copyright (C) 2015. All rights reserved.",IDC_STATIC,35,94,173,17 ICON "GLFW_ICON",IDC_STATIC,111,15,20,20 @@ -167,7 +167,7 @@ VS_VERSION_INFO VERSIONINFO BEGIN BLOCK "StringFileInfo" BEGIN - BLOCK "040904B0" + BLOCK "040904b0" BEGIN VALUE "FileDescription", "game Module" VALUE "FileVersion", "1, 0, 0, 1" diff --git a/tools/simulator/libsimulator/proj.ios_mac/libsimulator.xcodeproj/project.pbxproj b/tools/simulator/libsimulator/proj.ios_mac/libsimulator.xcodeproj/project.pbxproj index d92ef78d6d..dc5d90a573 100644 --- a/tools/simulator/libsimulator/proj.ios_mac/libsimulator.xcodeproj/project.pbxproj +++ b/tools/simulator/libsimulator/proj.ios_mac/libsimulator.xcodeproj/project.pbxproj @@ -147,6 +147,7 @@ 9FF504BF1A5EA75D00AFDA55 /* PlayerTaskServiceProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FF504AA1A5EA75D00AFDA55 /* PlayerTaskServiceProtocol.h */; }; 9FF504C01A5EA75D00AFDA55 /* PlayerUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9FF504AB1A5EA75D00AFDA55 /* PlayerUtils.cpp */; }; 9FF504C11A5EA75D00AFDA55 /* PlayerUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FF504AC1A5EA75D00AFDA55 /* PlayerUtils.h */; }; + ADD1C0E11C196C2500733781 /* SimulatorExport.h in Headers */ = {isa = PBXBuildFile; fileRef = ADD1C0E01C196C2500733781 /* SimulatorExport.h */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -274,6 +275,7 @@ 9FF504AA1A5EA75D00AFDA55 /* PlayerTaskServiceProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayerTaskServiceProtocol.h; sourceTree = ""; }; 9FF504AB1A5EA75D00AFDA55 /* PlayerUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlayerUtils.cpp; sourceTree = ""; }; 9FF504AC1A5EA75D00AFDA55 /* PlayerUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayerUtils.h; sourceTree = ""; }; + ADD1C0E01C196C2500733781 /* SimulatorExport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimulatorExport.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -449,6 +451,7 @@ 9FF504AB1A5EA75D00AFDA55 /* PlayerUtils.cpp */, 9FF504AC1A5EA75D00AFDA55 /* PlayerUtils.h */, 9FD6FC0E1A5D281D0028EDC6 /* cocos2dx_extra.h */, + ADD1C0E01C196C2500733781 /* SimulatorExport.h */, 9FD6FC0F1A5D281D0028EDC6 /* network */, 9FD6FC131A5D281D0028EDC6 /* platform */, 9FD6FC161A5D281D0028EDC6 /* ProjectConfig */, @@ -565,6 +568,7 @@ 9FB638931A635BA300AAEC43 /* stringprintf.h in Headers */, 9FB6388E1A635BA300AAEC43 /* once.h in Headers */, 9FD6FC671A5D2A380028EDC6 /* PlayerMac.h in Headers */, + ADD1C0E11C196C2500733781 /* SimulatorExport.h in Headers */, 9FB6386E1A635BA300AAEC43 /* coded_stream_inl.h in Headers */, 9F2F21BF1A635F1C006B8BF1 /* RuntimeCCSImpl.h in Headers */, 9FD6FC311A5D281D0028EDC6 /* cocos2dx_extra.h in Headers */, diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index 411003cd71..05a6f77104 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -31,7 +31,7 @@ replace_headers = CCComponentJS.h::component/CCComponentJS.h classes = New.* Sprite SpriteBatchNode SpriteFrame SpriteFrameCache Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn ReverseTime Animate AnimationFrame Animation AnimationCache Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc CallFuncN RenderTexture GridAction Grid3DAction Grid3D TiledGrid3D GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Lens3D Ripple3D PageTurn3D ShakyTiles3D ShatteredTiles3D WavesTiles3D JumpTiles3D Speed ActionManager Set SimpleAudioEngine Scheduler Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram GLProgramCache Application ClippingNode MotionStreak TextFieldTTF GLViewProtocol GLView Component ComponentContainer __NodeRGBA __LayerRGBA SAXParser Event(?!.*(Physics).*).* Device Configuration ProtectedNode GLProgramState Image .*Light$ AsyncTaskPool Properties Material Technique RenderState Pass ComponentJS -classes_need_extend = Node __NodeRGBA Layer.* Sprite SpriteBatchNode SpriteFrame Menu MenuItem.* Scene DrawNode Component .*Action.* GridBase Grid3D TiledGrid3D MotionStreak ParticleBatchNode ParticleSystem TextFieldTTF RenderTexture TileMapAtlas TMXLayer TMXTiledMap TMXMapInfo TransitionScene ProgressTimer ParallaxNode Label.* GLProgram Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn ReverseTime Animate AnimationFrame Animation AnimationCache Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* Orbit.* Follow.* Bezier.* Hide CallFunc CallFuncN ComponentJS +classes_need_extend = Node __NodeRGBA Layer.* Sprite SpriteBatchNode SpriteFrame Menu MenuItem.* Scene DrawNode Component .*Action.* GridBase Grid3D TiledGrid3D MotionStreak ParticleBatchNode ParticleSystem TextFieldTTF RenderTexture TileMapAtlas TMXLayer TMXTiledMap TMXMapInfo TransitionScene ProgressTimer ParallaxNode Label.* GLProgram Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn ReverseTime Animate AnimationFrame Animation AnimationCache Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* Orbit.* Follow.* Bezier.* Hide CallFunc CallFuncN # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also @@ -140,7 +140,7 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat Camera::[unproject isVisibleInFrustum], ClippingNode::[init], RenderState::[setStateBlock], - ComponentJS::[getScriptObject update] + ComponentJS::[create getScriptObject update] rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame], MenuItemFont::[setFontNameObj=setFontName setFontSizeObj=setFontSize getFontSizeObj=getFontSize getFontNameObj=getFontName], @@ -186,7 +186,7 @@ base_classes_to_skip = Ref Clonable # classes that create no constructor # Set is special and we will use a hand-written constructor -abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application GLViewProtocol GLView ComponentContainer SAXParser Configuration EventListener BaseLight AsyncTaskPool +abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application GLViewProtocol GLView ComponentContainer SAXParser Configuration EventListener BaseLight AsyncTaskPool ComponentJS # Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'. script_control_cpp = no diff --git a/web b/web index 116c3c9ac1..8586470e65 160000 --- a/web +++ b/web @@ -1 +1 @@ -Subproject commit 116c3c9ac13354cd62e65dc4ef48738fa9872340 +Subproject commit 8586470e65d43f60b06d2846bde72b384e884e5d