diff --git a/AUTHORS b/AUTHORS index d8e16d5e7e..d7e741a0d1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -540,6 +540,7 @@ Developers: hawkwood (Justin Hawkwood) Fixing a bug that EditBox doesn't show any text if it's initialized with text. + Fixed a memory leak in new Audio. wtyqm (zhang peng) Fixing a bug that ccbRootPath wasn't passed to sub ccb nodes. diff --git a/CHANGELOG b/CHANGELOG index 8077d9b366..733222002d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ cocos2d-x-3.6beta0 Apr.14 2015 [NEW] 3D: added texturecub supported + [NEW] Animate3D: added `Animate3D::setHighQuality()` to set animation quality + [FIX] Audio: memory leak [FIX] Sprite3D: memory leak cocos2d-x-3.5 Mar.23 2015 diff --git a/README.md b/README.md index fa768f5a12..86c99154be 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ Select the test you want from Xcode Scheme chooser. ``` $ cd cocos2d-x/build -$ open cocos_tests.xcodeproj +$ open cocos2d_tests.xcodeproj ``` * For Linux diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index 1db15c51e1..fce0a94bc0 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -1282,6 +1282,8 @@ 38B8E2E219E671D2002D7CE7 /* UILayoutComponent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38B8E2DF19E671D2002D7CE7 /* UILayoutComponent.cpp */; }; 38B8E2E319E671D2002D7CE7 /* UILayoutComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */; }; 38B8E2E419E671D2002D7CE7 /* UILayoutComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */; }; + 38D9629D1ACA9721007C6FAF /* CocoStudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */; }; + 38D9629E1ACA9721007C6FAF /* CocoStudio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */; }; 38F5263E1A48363B000DB7F7 /* ArmatureNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */; }; 38F5263F1A48363B000DB7F7 /* ArmatureNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */; }; 38F526401A48363B000DB7F7 /* ArmatureNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */; }; @@ -3113,6 +3115,7 @@ 38B8E2D419E66581002D7CE7 /* CSLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSLoader.h; sourceTree = ""; }; 38B8E2DF19E671D2002D7CE7 /* UILayoutComponent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UILayoutComponent.cpp; sourceTree = ""; }; 38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILayoutComponent.h; sourceTree = ""; }; + 38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CocoStudio.cpp; sourceTree = ""; }; 38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArmatureNodeReader.cpp; sourceTree = ""; }; 38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArmatureNodeReader.h; sourceTree = ""; }; 38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSArmatureNode_generated.h; sourceTree = ""; }; @@ -4876,6 +4879,7 @@ 1A8C5984180E930E00EF57C3 /* CCUtilMath.cpp */, 1A8C5985180E930E00EF57C3 /* CCUtilMath.h */, 1A8C5986180E930E00EF57C3 /* CocoStudio.h */, + 38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */, 1A8C5989180E930E00EF57C3 /* DictionaryHelper.cpp */, 1A8C598A180E930E00EF57C3 /* DictionaryHelper.h */, ); @@ -8617,6 +8621,7 @@ B665E2561AA80A6500DDB1C5 /* CCPUDoAffectorEventHandlerTranslator.cpp in Sources */, 15AE18A419AAD33D00C27E9E /* CCScale9SpriteLoader.cpp in Sources */, 182C5CD61A98F30500C30D34 /* Sprite3DReader.cpp in Sources */, + 38D9629D1ACA9721007C6FAF /* CocoStudio.cpp in Sources */, B665E3D61AA80A6600DDB1C5 /* CCPUScriptParser.cpp in Sources */, 15AE1B5719AADA9900C27E9E /* UISlider.cpp in Sources */, B665E2F61AA80A6500DDB1C5 /* CCPUListener.cpp in Sources */, @@ -9060,6 +9065,7 @@ B665E3AF1AA80A6500DDB1C5 /* CCPURender.cpp in Sources */, 382383FB1A258FA7002C4610 /* idl_gen_go.cpp in Sources */, B665E2EF1AA80A6500DDB1C5 /* CCPULineEmitter.cpp in Sources */, + 38D9629E1ACA9721007C6FAF /* CocoStudio.cpp in Sources */, 50ABBDBA1925AB4100A911A9 /* CCTextureAtlas.cpp in Sources */, 1A5702FB180BCE750088DEC7 /* CCTMXXMLParser.cpp in Sources */, B665E40B1AA80A6600DDB1C5 /* CCPUSphereSurfaceEmitterTranslator.cpp in Sources */, diff --git a/cocos/2d/CCActionCamera.h b/cocos/2d/CCActionCamera.h index 18ca96af41..4ab7c1eac7 100644 --- a/cocos/2d/CCActionCamera.h +++ b/cocos/2d/CCActionCamera.h @@ -49,6 +49,7 @@ class CC_DLL ActionCamera : public ActionInterval // public: /** * @js ctor + * @lua new */ ActionCamera(); /** diff --git a/cocos/2d/CCMenuItem.cpp b/cocos/2d/CCMenuItem.cpp index f2dfb426fa..a9faaa8b6e 100644 --- a/cocos/2d/CCMenuItem.cpp +++ b/cocos/2d/CCMenuItem.cpp @@ -2,7 +2,7 @@ Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2011 Zynga Inc. -Copyright (c) 2013-2014 Chukong Technologies Inc. +Copyright (c) 2013-2015 Chukong Technologies Inc. http://www.cocos2d-x.org @@ -33,13 +33,6 @@ THE SOFTWARE. #include "deprecated/CCString.h" #include -#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#elif _MSC_VER >= 1400 //vs 2005 or higher -#pragma warning (push) -#pragma warning (disable: 4996) -#endif - NS_CC_BEGIN static int _globalFontSize = kItemSize; @@ -65,7 +58,7 @@ MenuItem* MenuItem::create() MenuItem* MenuItem::create(Ref *target, SEL_MenuHandler selector) { MenuItem *ret = new (std::nothrow) MenuItem(); - ret->initWithTarget(target, selector); + ret->initWithCallback(std::bind(selector, target, std::placeholders::_1)); ret->autorelease(); return ret; } @@ -81,8 +74,6 @@ MenuItem* MenuItem::create( const ccMenuCallback& callback) // FIXME: deprecated bool MenuItem::initWithTarget(cocos2d::Ref *target, SEL_MenuHandler selector ) { - _target = target; - CC_SAFE_RETAIN(_target); return initWithCallback( std::bind(selector,target, std::placeholders::_1) ); } @@ -102,7 +93,6 @@ MenuItem::~MenuItem() void MenuItem::onExit() { Node::onExit(); - CC_SAFE_RELEASE(_target); } void MenuItem::selected() @@ -159,8 +149,6 @@ bool MenuItem::isSelected() const // FIXME: deprecated void MenuItem::setTarget(Ref *target, SEL_MenuHandler selector) { - _target = target; - CC_SAFE_RETAIN(_target); setCallback( std::bind( selector, target, std::placeholders::_1) ); } @@ -199,7 +187,7 @@ void MenuItemLabel::setLabel(Node* var) MenuItemLabel * MenuItemLabel::create(Node*label, Ref* target, SEL_MenuHandler selector) { MenuItemLabel *ret = new (std::nothrow) MenuItemLabel(); - ret->initWithLabel(label, target, selector); + ret->initWithLabel(label, std::bind(selector, target, std::placeholders::_1)); ret->autorelease(); return ret; } @@ -223,8 +211,6 @@ MenuItemLabel* MenuItemLabel::create(Node *label) // FIXME:: deprecated bool MenuItemLabel::initWithLabel(Node* label, Ref* target, SEL_MenuHandler selector) { - _target = target; - CC_SAFE_RETAIN(_target); return initWithLabel(label, std::bind(selector,target, std::placeholders::_1) ); } @@ -329,7 +315,7 @@ MenuItemAtlasFont * MenuItemAtlasFont::create(const std::string& value, const st MenuItemAtlasFont * MenuItemAtlasFont::create(const std::string& value, const std::string& charMapFile, int itemWidth, int itemHeight, char startCharMap, Ref* target, SEL_MenuHandler selector) { MenuItemAtlasFont *ret = new (std::nothrow) MenuItemAtlasFont(); - ret->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, target, selector); + ret->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, std::bind(selector, target, std::placeholders::_1)); ret->autorelease(); return ret; } @@ -345,8 +331,6 @@ MenuItemAtlasFont * MenuItemAtlasFont::create(const std::string& value, const st // FIXME:: deprecated bool MenuItemAtlasFont::initWithString(const std::string& value, const std::string& charMapFile, int itemWidth, int itemHeight, char startCharMap, Ref* target, SEL_MenuHandler selector) { - _target = target; - CC_SAFE_RETAIN(_target); return initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, std::bind(selector,target, std::placeholders::_1) ); } @@ -395,7 +379,7 @@ const std::string& MenuItemFont::getFontName() MenuItemFont * MenuItemFont::create(const std::string& value, Ref* target, SEL_MenuHandler selector) { MenuItemFont *ret = new (std::nothrow) MenuItemFont(); - ret->initWithString(value, target, selector); + ret->initWithString(value, std::bind(selector, target, std::placeholders::_1)); ret->autorelease(); return ret; } @@ -431,8 +415,6 @@ bool MenuItemFont::initWithString(const std::string& value, Ref* target, SEL_Men { CCASSERT( !value.empty(), "Value length must be greater than 0"); - _target = target; - CC_SAFE_RETAIN(target); return initWithString(value, std::bind(selector,target, std::placeholders::_1) ); } @@ -552,7 +534,7 @@ MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite // FIXME: deprecated MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite, Ref* target, SEL_MenuHandler selector) { - return MenuItemSprite::create(normalSprite, selectedSprite, nullptr, target, selector); + return MenuItemSprite::create(normalSprite, selectedSprite, nullptr, std::bind(selector, target, std::placeholders::_1)); } MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite, const ccMenuCallback& callback) @@ -564,7 +546,7 @@ MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite MenuItemSprite * MenuItemSprite::create(Node *normalSprite, Node *selectedSprite, Node *disabledSprite, Ref *target, SEL_MenuHandler selector) { MenuItemSprite *ret = new (std::nothrow) MenuItemSprite(); - ret->initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector); + ret->initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, std::bind(selector, target, std::placeholders::_1)); ret->autorelease(); return ret; } @@ -580,8 +562,6 @@ MenuItemSprite * MenuItemSprite::create(Node *normalSprite, Node *selectedSprite // FIXME: deprecated bool MenuItemSprite::initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, Ref* target, SEL_MenuHandler selector) { - _target = target; - CC_SAFE_RETAIN(_target); return initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, std::bind(selector,target, std::placeholders::_1) ); } @@ -712,7 +692,7 @@ MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std: // FIXME: deprecated MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std::string& selectedImage, Ref* target, SEL_MenuHandler selector) { - return MenuItemImage::create(normalImage, selectedImage, "", target, selector); + return MenuItemImage::create(normalImage, selectedImage, "", std::bind(selector, target, std::placeholders::_1)); } MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std::string& selectedImage, const ccMenuCallback& callback) @@ -724,7 +704,7 @@ MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std: MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, Ref* target, SEL_MenuHandler selector) { MenuItemImage *ret = new (std::nothrow) MenuItemImage(); - if (ret && ret->initWithNormalImage(normalImage, selectedImage, disabledImage, target, selector)) + if (ret && ret->initWithNormalImage(normalImage, selectedImage, disabledImage, std::bind(selector, target, std::placeholders::_1))) { ret->autorelease(); return ret; @@ -760,8 +740,6 @@ MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std: // FIXME:: deprecated bool MenuItemImage::initWithNormalImage(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, Ref* target, SEL_MenuHandler selector) { - _target = target; - CC_SAFE_RETAIN(_target); return initWithNormalImage(normalImage, selectedImage, disabledImage, std::bind(selector,target, std::placeholders::_1) ); } bool MenuItemImage::initWithNormalImage(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, const ccMenuCallback& callback) @@ -813,7 +791,7 @@ void MenuItemImage::setDisabledSpriteFrame(SpriteFrame * frame) MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler selector, const Vector& menuItems) { MenuItemToggle *ret = new (std::nothrow) MenuItemToggle(); - ret->MenuItem::initWithTarget(target, selector); + ret->MenuItem::initWithCallback(std::bind(selector, target, std::placeholders::_1)); ret->_subItems = menuItems; ret->_selectedIndex = UINT_MAX; ret->setSelectedIndex(0); @@ -836,7 +814,7 @@ MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler s va_list args; va_start(args, item); MenuItemToggle *ret = new (std::nothrow) MenuItemToggle(); - ret->initWithTarget(target, selector, item, args); + ret->initWithCallback(std::bind(selector, target, std::placeholders::_1), item, args); ret->autorelease(); va_end(args); return ret; @@ -877,8 +855,6 @@ MenuItemToggle * MenuItemToggle::create() // FIXME:: deprecated bool MenuItemToggle::initWithTarget(Ref* target, SEL_MenuHandler selector, MenuItem* item, va_list args) { - _target = target; - CC_SAFE_RETAIN(_target); return initWithCallback(std::bind( selector, target, std::placeholders::_1), item, args); } @@ -995,9 +971,3 @@ MenuItem* MenuItemToggle::getSelectedItem() } NS_CC_END - -#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) -#pragma GCC diagnostic warning "-Wdeprecated-declarations" -#elif _MSC_VER >= 1400 //vs 2005 or higher -#pragma warning (pop) -#endif diff --git a/cocos/2d/CCMenuItem.h b/cocos/2d/CCMenuItem.h index 01bed48f11..807661def1 100644 --- a/cocos/2d/CCMenuItem.h +++ b/cocos/2d/CCMenuItem.h @@ -110,7 +110,6 @@ CC_CONSTRUCTOR_ACCESS: : _selected(false) , _enabled(false) , _callback(nullptr) - , _target(nullptr) {} /** * @js NA @@ -133,8 +132,6 @@ protected: bool _enabled; // callback ccMenuCallback _callback; - // If using the old API, the _target needs to be retained / released - Ref *_target; private: CC_DISALLOW_COPY_AND_ASSIGN(MenuItem); diff --git a/cocos/2d/CCTMXXMLParser.cpp b/cocos/2d/CCTMXXMLParser.cpp index e9801c4c4f..176c9d2ae9 100644 --- a/cocos/2d/CCTMXXMLParser.cpp +++ b/cocos/2d/CCTMXXMLParser.cpp @@ -51,7 +51,7 @@ TMXLayerInfo::TMXLayerInfo() TMXLayerInfo::~TMXLayerInfo() { CCLOGINFO("deallocing TMXLayerInfo: %p", this); - if( _ownTiles && _tiles ) + if (_ownTiles && _tiles) { free(_tiles); _tiles = nullptr; @@ -62,6 +62,7 @@ ValueMap& TMXLayerInfo::getProperties() { return _properties; } + void TMXLayerInfo::setProperties(ValueMap var) { _properties = var; @@ -100,7 +101,7 @@ Rect TMXTilesetInfo::getRectForGID(uint32_t gid) TMXMapInfo * TMXMapInfo::create(const std::string& tmxFile) { TMXMapInfo *ret = new (std::nothrow) TMXMapInfo(); - if(ret->initWithTMXFile(tmxFile)) + if (ret->initWithTMXFile(tmxFile)) { ret->autorelease(); return ret; @@ -112,7 +113,7 @@ TMXMapInfo * TMXMapInfo::create(const std::string& tmxFile) TMXMapInfo * TMXMapInfo::createWithXML(const std::string& tmxString, const std::string& resourcePath) { TMXMapInfo *ret = new (std::nothrow) TMXMapInfo(); - if(ret->initWithXML(tmxString, resourcePath)) + if (ret->initWithXML(tmxString, resourcePath)) { ret->autorelease(); return ret; @@ -123,12 +124,12 @@ TMXMapInfo * TMXMapInfo::createWithXML(const std::string& tmxString, const std:: void TMXMapInfo::internalInit(const std::string& tmxFileName, const std::string& resourcePath) { - if (tmxFileName.size() > 0) + if (!tmxFileName.empty()) { _TMXFileName = FileUtils::getInstance()->fullPathForFilename(tmxFileName); } - if (resourcePath.size() > 0) + if (!resourcePath.empty()) { _resources = resourcePath; } @@ -142,6 +143,7 @@ void TMXMapInfo::internalInit(const std::string& tmxFileName, const std::string& _parentElement = TMXPropertyNone; _currentFirstGID = -1; } + bool TMXMapInfo::initWithXML(const std::string& tmxString, const std::string& resourcePath) { internalInit("", resourcePath); @@ -202,20 +204,19 @@ bool TMXMapInfo::parseXMLFile(const std::string& xmlFilename) return parser.parse(FileUtils::getInstance()->fullPathForFilename(xmlFilename).c_str()); } - // the XML parser calls here with all the elements void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts) { CC_UNUSED_PARAM(ctx); TMXMapInfo *tmxMapInfo = this; - std::string elementName = (char*)name; + std::string elementName = name; ValueMap attributeDict; if (atts && atts[0]) { - for(int i = 0; atts[i]; i += 2) + for (int i = 0; atts[i]; i += 2) { - std::string key = (char*)atts[i]; - std::string value = (char*)atts[i+1]; + std::string key = atts[i]; + std::string value = atts[i+1]; attributeDict.insert(std::make_pair(key, Value(value))); } } @@ -227,16 +228,21 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts) CCLOG("cocos2d: TMXFormat: Unsupported TMX version: %s", version.c_str()); } std::string orientationStr = attributeDict["orientation"].asString(); - if (orientationStr == "orthogonal") + if (orientationStr == "orthogonal") { tmxMapInfo->setOrientation(TMXOrientationOrtho); - else if (orientationStr == "isometric") + } + else if (orientationStr == "isometric") { tmxMapInfo->setOrientation(TMXOrientationIso); - else if(orientationStr == "hexagonal") + } + else if (orientationStr == "hexagonal") { tmxMapInfo->setOrientation(TMXOrientationHex); - else if(orientationStr == "staggered") + } + else if (orientationStr == "staggered") { tmxMapInfo->setOrientation(TMXOrientationStaggered); - else + } + else { CCLOG("cocos2d: TMXFomat: Unsupported orientation: %d", tmxMapInfo->getOrientation()); + } Size s; s.width = attributeDict["width"].asFloat(); @@ -356,7 +362,6 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts) // The parent element is now "layer" tmxMapInfo->setParentElement(TMXPropertyLayer); - } else if (elementName == "objectgroup") { @@ -372,7 +377,6 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts) // The parent element is now "objectgroup" tmxMapInfo->setParentElement(TMXPropertyObjectGroup); - } else if (elementName == "image") { @@ -416,7 +420,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts) tmxMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribBase64); tmxMapInfo->setStoringCharacters(true); - if( compression == "gzip" ) + if (compression == "gzip") { layerAttribs = tmxMapInfo->getLayerAttribs(); tmxMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribGzip); @@ -428,7 +432,6 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts) } CCASSERT( compression == "" || compression == "gzip" || compression == "zlib", "TMX: unsupported compression method" ); } - } else if (elementName == "object") { @@ -438,11 +441,10 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts) // Create an instance of TMXObjectInfo to store the object and its properties ValueMap dict; // Parse everything automatically - const char* array[] = {"name", "type", "width", "height", "gid"}; + const char* keys[] = {"name", "type", "width", "height", "gid"}; - for(size_t i = 0; i < sizeof(array)/sizeof(array[0]); ++i ) + for (const auto& key : keys) { - const char* key = array[i]; Value value = attributeDict[key]; dict[key] = value; } @@ -468,9 +470,8 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts) // Add the object to the objectGroup objectGroup->getObjects().push_back(Value(dict)); - // The parent element is now "object" - tmxMapInfo->setParentElement(TMXPropertyObject); - + // The parent element is now "object" + tmxMapInfo->setParentElement(TMXPropertyObject); } else if (elementName == "property") { @@ -536,23 +537,23 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts) // parse points string into a space-separated set of points stringstream pointsStream(value); string pointPair; - while(std::getline(pointsStream, pointPair, ' ')) + while (std::getline(pointsStream, pointPair, ' ')) { // parse each point combo into a comma-separated x,y point stringstream pointStream(pointPair); - string xStr,yStr; + string xStr, yStr; ValueMap pointDict; // set x - if(std::getline(pointStream, xStr, ',')) + if (std::getline(pointStream, xStr, ',')) { int x = atoi(xStr.c_str()) + (int)objectGroup->getPositionOffset().x; pointDict["x"] = Value(x); } // set y - if(std::getline(pointStream, yStr, ',')) + if (std::getline(pointStream, yStr, ',')) { int y = atoi(yStr.c_str()) + (int)objectGroup->getPositionOffset().y; pointDict["y"] = Value(y); @@ -581,23 +582,23 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts) // parse points string into a space-separated set of points stringstream pointsStream(value); string pointPair; - while(std::getline(pointsStream, pointPair, ' ')) + while (std::getline(pointsStream, pointPair, ' ')) { // parse each point combo into a comma-separated x,y point stringstream pointStream(pointPair); - string xStr,yStr; + string xStr, yStr; ValueMap pointDict; // set x - if(std::getline(pointStream, xStr, ',')) + if (std::getline(pointStream, xStr, ',')) { int x = atoi(xStr.c_str()) + (int)objectGroup->getPositionOffset().x; pointDict["x"] = Value(x); } // set y - if(std::getline(pointStream, yStr, ',')) + if (std::getline(pointStream, yStr, ',')) { int y = atoi(yStr.c_str()) + (int)objectGroup->getPositionOffset().y; pointDict["y"] = Value(y); @@ -616,11 +617,9 @@ void TMXMapInfo::endElement(void *ctx, const char *name) { CC_UNUSED_PARAM(ctx); TMXMapInfo *tmxMapInfo = this; - std::string elementName = (char*)name; + std::string elementName = name; - int len = 0; - - if(elementName == "data") + if (elementName == "data") { if (tmxMapInfo->getLayerAttribs() & TMXLayerAttribBase64) { @@ -630,14 +629,14 @@ void TMXMapInfo::endElement(void *ctx, const char *name) std::string currentString = tmxMapInfo->getCurrentString(); unsigned char *buffer; - len = base64Decode((unsigned char*)currentString.c_str(), (unsigned int)currentString.length(), &buffer); - if( ! buffer ) + auto len = base64Decode((unsigned char*)currentString.c_str(), (unsigned int)currentString.length(), &buffer); + if (!buffer) { CCLOG("cocos2d: TiledMap: decode data error"); return; } - if( tmxMapInfo->getLayerAttribs() & (TMXLayerAttribGzip | TMXLayerAttribZlib) ) + if (tmxMapInfo->getLayerAttribs() & (TMXLayerAttribGzip | TMXLayerAttribZlib)) { unsigned char *deflated = nullptr; Size s = layer->_layerSize; @@ -650,7 +649,7 @@ void TMXMapInfo::endElement(void *ctx, const char *name) free(buffer); buffer = nullptr; - if( ! deflated ) + if (!deflated) { CCLOG("cocos2d: TiledMap: inflate data error"); return; @@ -669,7 +668,6 @@ void TMXMapInfo::endElement(void *ctx, const char *name) { _xmlTileIndex = 0; } - } else if (elementName == "map") { @@ -701,7 +699,7 @@ void TMXMapInfo::textHandler(void *ctx, const char *ch, int len) { CC_UNUSED_PARAM(ctx); TMXMapInfo *tmxMapInfo = this; - std::string text((char*)ch,0,len); + std::string text(ch, 0, len); if (tmxMapInfo->isStoringCharacters()) { diff --git a/cocos/2d/CCTextFieldTTF.h b/cocos/2d/CCTextFieldTTF.h index ab5765afe0..78cd7f53ae 100644 --- a/cocos/2d/CCTextFieldTTF.h +++ b/cocos/2d/CCTextFieldTTF.h @@ -108,10 +108,13 @@ class CC_DLL TextFieldTTF : public Label, public IMEDelegate { public: /** + * Default constructor. * @js ctor */ TextFieldTTF(); + /** + * Default destructor. * @js NA * @lua NA */ diff --git a/cocos/2d/CCTransition.h b/cocos/2d/CCTransition.h index 15f0c9aa4e..e3b579f686 100644 --- a/cocos/2d/CCTransition.h +++ b/cocos/2d/CCTransition.h @@ -102,6 +102,8 @@ public: */ void hideOutShowIn(void); + Scene* getInScene() const{ return _inScene; } + float getDuration() const { return _duration; } // // Overrides // diff --git a/cocos/2d/libcocos2d.vcxproj b/cocos/2d/libcocos2d.vcxproj index 2addcc5a44..cded43a3e1 100755 --- a/cocos/2d/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d.vcxproj @@ -515,6 +515,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + diff --git a/cocos/2d/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d.vcxproj.filters index ed06921a08..11a84c92a7 100755 --- a/cocos/2d/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d.vcxproj.filters @@ -1798,6 +1798,9 @@ cocostudio\json + + cocostudio\json + diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems index 24f873310a..6720cba446 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems @@ -949,6 +949,7 @@ + diff --git a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters index 7020b4128d..c729cd4add 100644 --- a/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters +++ b/cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters @@ -3318,6 +3318,9 @@ 3d + + cocostudio\json + diff --git a/cocos/2d/libcocos2d_wp8.vcxproj b/cocos/2d/libcocos2d_wp8.vcxproj index 6b862f370e..7162254a64 100644 --- a/cocos/2d/libcocos2d_wp8.vcxproj +++ b/cocos/2d/libcocos2d_wp8.vcxproj @@ -538,6 +538,7 @@ + @@ -1179,6 +1180,7 @@ + diff --git a/cocos/2d/libcocos2d_wp8.vcxproj.filters b/cocos/2d/libcocos2d_wp8.vcxproj.filters index 9e6d9e7b74..5c26fcabad 100644 --- a/cocos/2d/libcocos2d_wp8.vcxproj.filters +++ b/cocos/2d/libcocos2d_wp8.vcxproj.filters @@ -1815,6 +1815,9 @@ 3d + + cocostudio\json + @@ -3528,6 +3531,9 @@ 3d + + cocostudio\json + diff --git a/cocos/3d/CCAABB.h b/cocos/3d/CCAABB.h index 27814eadfd..a06da15bb4 100644 --- a/cocos/3d/CCAABB.h +++ b/cocos/3d/CCAABB.h @@ -44,11 +44,13 @@ class CC_DLL AABB public: /** * Constructor. + * @lua new */ AABB(); /** * Constructor. + * @lua new */ AABB(const Vec3& min, const Vec3& max); @@ -122,7 +124,7 @@ public: Vec3 _max; }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCAnimate3D.cpp b/cocos/3d/CCAnimate3D.cpp index fb14c2a52d..a862cd3c6b 100644 --- a/cocos/3d/CCAnimate3D.cpp +++ b/cocos/3d/CCAnimate3D.cpp @@ -26,6 +26,7 @@ #include "3d/CCSprite3D.h" #include "3d/CCSkeleton3D.h" #include "platform/CCFileUtils.h" +#include "base/CCConfiguration.h" NS_CC_BEGIN @@ -68,6 +69,7 @@ bool Animate3D::init(Animation3D* animation) animation->retain(); setDuration(animation->getDuration()); setOriginInterval(animation->getDuration()); + setHighQuality(Configuration::getInstance()->isHighAnimate3DQuality()); return true; } @@ -83,6 +85,7 @@ bool Animate3D::init(Animation3D* animation, float fromTime, float duration) setOriginInterval(duration); _animation = animation; animation->retain(); + setHighQuality(Configuration::getInstance()->isHighAnimate3DQuality()); return true; } @@ -310,28 +313,26 @@ void Animate3D::update(float t) t = 1 - t; t = _start + t * _last; - for (const auto& it : _boneCurves) - { - for (const auto& it : _boneCurves) { - auto bone = it.first; - auto curve = it.second; - if (curve->translateCurve) - { - curve->translateCurve->evaluate(t, transDst, EvaluateType::INT_LINEAR); - trans = &transDst[0]; - } - if (curve->rotCurve) - { - curve->rotCurve->evaluate(t, rotDst, EvaluateType::INT_QUAT_SLERP); - rot = &rotDst[0]; - } - if (curve->scaleCurve) - { - curve->scaleCurve->evaluate(t, scaleDst, EvaluateType::INT_LINEAR); - scale = &scaleDst[0]; - } - bone->setAnimationValue(trans, rot, scale, this, _weight); + + for (const auto& it : _boneCurves) { + auto bone = it.first; + auto curve = it.second; + if (curve->translateCurve) + { + curve->translateCurve->evaluate(t, transDst, _translateEvaluate); + trans = &transDst[0]; } + if (curve->rotCurve) + { + curve->rotCurve->evaluate(t, rotDst, _roteEvaluate); + rot = &rotDst[0]; + } + if (curve->scaleCurve) + { + curve->scaleCurve->evaluate(t, scaleDst, _scaleEvaluate); + scale = &scaleDst[0]; + } + bone->setAnimationValue(trans, rot, scale, this, _weight); } for (const auto& it : _nodeCurves) @@ -341,18 +342,18 @@ void Animate3D::update(float t) Mat4 transform; if (curve->translateCurve) { - curve->translateCurve->evaluate(t, transDst, EvaluateType::INT_LINEAR); + curve->translateCurve->evaluate(t, transDst, _translateEvaluate); transform.translate(transDst[0], transDst[1], transDst[2]); } if (curve->rotCurve) { - curve->rotCurve->evaluate(t, rotDst, EvaluateType::INT_QUAT_SLERP); + curve->rotCurve->evaluate(t, rotDst, _roteEvaluate); Quaternion qua(rotDst[0], rotDst[1], rotDst[2], rotDst[3]); transform.rotate(qua); } if (curve->scaleCurve) { - curve->scaleCurve->evaluate(t, scaleDst, EvaluateType::INT_LINEAR); + curve->scaleCurve->evaluate(t, scaleDst, _scaleEvaluate); transform.scale(scaleDst[0], scaleDst[1], scaleDst[2]); } node->setAdditionalTransform(&transform); @@ -383,6 +384,28 @@ void Animate3D::setOriginInterval(float interval) _originInterval = interval; } +void Animate3D::setHighQuality(bool isHighQuality) +{ + if (isHighQuality) + { + _translateEvaluate = EvaluateType::INT_LINEAR; + _roteEvaluate = EvaluateType::INT_QUAT_SLERP; + _scaleEvaluate = EvaluateType::INT_LINEAR; + } + else + { + _translateEvaluate = EvaluateType::INT_NEAR; + _roteEvaluate = EvaluateType::INT_NEAR; + _scaleEvaluate = EvaluateType::INT_NEAR; + } + _isHighQuality = isHighQuality; +} + +bool Animate3D::isHighQuality() const +{ + return _isHighQuality; +} + Animate3D::Animate3D() : _state(Animate3D::Animate3DState::Running) , _animation(nullptr) @@ -395,7 +418,7 @@ Animate3D::Animate3D() , _lastTime(0.0f) , _originInterval(0.0f) { - + setHighQuality(true); } Animate3D::~Animate3D() { @@ -410,12 +433,9 @@ void Animate3D::removeFromMap() if (_target) { Sprite3D* sprite = static_cast(_target); - if (_state == Animate3D::Animate3DState::FadeIn) - s_fadeInAnimates.erase(sprite); - else if (_state == Animate3D::Animate3DState::FadeOut) - s_fadeOutAnimates.erase(sprite); - else - s_runningAnimates.erase(sprite); + s_fadeInAnimates.erase(sprite); + s_fadeOutAnimates.erase(sprite); + s_runningAnimates.erase(sprite); } } diff --git a/cocos/3d/CCAnimate3D.h b/cocos/3d/CCAnimate3D.h index 3d95779089..e784d142af 100644 --- a/cocos/3d/CCAnimate3D.h +++ b/cocos/3d/CCAnimate3D.h @@ -105,6 +105,17 @@ public: CC_DEPRECATED_ATTRIBUTE bool getPlayBack() const { return _playReverse; } CC_DEPRECATED_ATTRIBUTE void setPlayBack(bool reverse) { _playReverse = reverse; } + /**set high quality + * The default value is based on Configuration::isHighAnimate3DQuality(). You can configure it in the config.plist. However, you can modify it using the following function + * @param true: is high quality, false: is low quality. + */ + void setHighQuality(bool isHighQuality); + + /**get high quality + * is it high quality + */ + bool isHighQuality() const; + CC_CONSTRUCTOR_ACCESS: Animate3D(); @@ -137,6 +148,13 @@ protected: float _accTransTime; // acculate transition time float _lastTime; // last t (0 - 1) float _originInterval;// save origin interval time + + // animation quality + EvaluateType _translateEvaluate; + EvaluateType _roteEvaluate; + EvaluateType _scaleEvaluate; + bool _isHighQuality; // true: is high quality, false: is low quality + std::unordered_map _boneCurves; //weak ref std::unordered_map _nodeCurves; @@ -146,7 +164,7 @@ protected: static std::unordered_map s_runningAnimates; }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCAnimation3D.h b/cocos/3d/CCAnimation3D.h index 09588c6c33..c95886ccfd 100644 --- a/cocos/3d/CCAnimation3D.h +++ b/cocos/3d/CCAnimation3D.h @@ -54,25 +54,36 @@ public: public: typedef AnimationCurve<3> AnimationCurveVec3; typedef AnimationCurve<4> AnimationCurveQuat; - AnimationCurveVec3* translateCurve; //translate curve - AnimationCurveQuat* rotCurve;//rotation curve - AnimationCurveVec3* scaleCurve;//scale curve - + /**translation curve*/ + AnimationCurveVec3* translateCurve; + /**rotation curve*/ + AnimationCurveQuat* rotCurve; + /**scaling curve*/ + AnimationCurveVec3* scaleCurve; + /**constructor */ Curve(); + /**constructor */ ~Curve(); }; /**read all animation or only the animation with given animationName? animationName == "" read the first.*/ static Animation3D* create(const std::string& filename, const std::string& animationName = ""); + /**the cache method to create or get an Animation3D object*/ CC_DEPRECATED_ATTRIBUTE static Animation3D* getOrCreate(const std::string& filename, const std::string& animationName = ""){ return create(filename, animationName); } /**get duration*/ float getDuration() const { return _duration; } - /**get bone curve*/ + /** + * get bone curve + * + * @lua NA + */ Curve* getBoneCurveByName(const std::string& name) const; + + /**get the bone Curves set*/ const std::unordered_map& getBoneCurves() const {return _boneCurves;} CC_CONSTRUCTOR_ACCESS: @@ -120,7 +131,7 @@ protected: std::unordered_map _animations; //cached animations }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCAnimationCurve.h b/cocos/3d/CCAnimationCurve.h index 9708d0349b..5c0b7e4630 100644 --- a/cocos/3d/CCAnimationCurve.h +++ b/cocos/3d/CCAnimationCurve.h @@ -54,6 +54,8 @@ enum class EvaluateType /** * @brief curve of bone's position, rotation or scale + * + * @lua NA */ template class AnimationCurve: public Ref @@ -100,7 +102,7 @@ protected: std::function _evaluateFun; //user defined function }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCAttachNode.h b/cocos/3d/CCAttachNode.h index fadb6d19b1..7e07f84d12 100644 --- a/cocos/3d/CCAttachNode.h +++ b/cocos/3d/CCAttachNode.h @@ -68,7 +68,7 @@ protected: mutable Mat4 _transformToParent; }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCBillBoard.h b/cocos/3d/CCBillBoard.h index f1bc07d8c6..a10a37ed1a 100644 --- a/cocos/3d/CCBillBoard.h +++ b/cocos/3d/CCBillBoard.h @@ -45,7 +45,7 @@ public: VIEW_POINT_ORIENTED, // orient to the camera VIEW_PLANE_ORIENTED // orient to the XOY plane of camera }; - /// @{ + /// @name Creators /** @@ -96,7 +96,11 @@ public: /** update billboard's transform and turn it towards camera */ virtual void visit(Renderer *renderer, const Mat4& parentTransform, uint32_t parentFlags) override; - /** draw BillBoard object */ + /** + * draw BillBoard object. + * + * @lua NA + */ virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override; @@ -122,7 +126,7 @@ private: }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCBundle3D.cpp b/cocos/3d/CCBundle3D.cpp index a464ef4e32..7973e8dcc1 100644 --- a/cocos/3d/CCBundle3D.cpp +++ b/cocos/3d/CCBundle3D.cpp @@ -874,9 +874,11 @@ bool Bundle3D::loadMaterialsBinary(MaterialDatas& materialdatas) { NMaterialData materialData; materialData.id = _binaryReader.readString(); + + // skip: diffuse(3), ambient(3), emissive(3), opacity(1), specular(3), shininess(1) float data[14]; _binaryReader.read(&data,sizeof(float), 14); - + unsigned int textruenum = 1; _binaryReader.read(&textruenum, 4, 1); for(unsigned int j = 0; j < textruenum ; j++ ) diff --git a/cocos/3d/CCBundle3D.h b/cocos/3d/CCBundle3D.h index 6dd3cd1331..f9927eeac3 100644 --- a/cocos/3d/CCBundle3D.h +++ b/cocos/3d/CCBundle3D.h @@ -45,6 +45,7 @@ class Data; * c3t text file * c3b binary file * @js NA + * @lua NA */ class CC_DLL Bundle3D { @@ -181,7 +182,7 @@ protected: bool _isBinary; }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCBundle3DData.h b/cocos/3d/CCBundle3DData.h index 307161d564..d19568ebd8 100644 --- a/cocos/3d/CCBundle3DData.h +++ b/cocos/3d/CCBundle3DData.h @@ -37,6 +37,7 @@ NS_CC_BEGIN /**mesh vertex attribute * @js NA +* @lua NA */ struct MeshVertexAttrib { @@ -53,6 +54,7 @@ struct MeshVertexAttrib /** model node data, since 3.3 * @js NA +* @lua NA */ struct ModelData { @@ -74,6 +76,7 @@ struct ModelData /** Node data, since 3.3 * @js NA +* @lua NA */ struct NodeData { @@ -107,6 +110,7 @@ struct NodeData /** node datas, since 3.3 * @js NA +* @lua NA */ struct NodeDatas { @@ -130,6 +134,7 @@ struct NodeDatas /**mesh data * @js NA +* @lua NA */ struct MeshData { @@ -185,6 +190,7 @@ public: /** mesh datas * @js NA +* @lua NA */ struct MeshDatas { @@ -206,6 +212,7 @@ struct MeshDatas /**skin data * @js NA +* @lua NA */ struct SkinData { @@ -277,6 +284,7 @@ struct SkinData /**material data, * @js NA +* @lua NA */ struct MaterialData { @@ -290,6 +298,7 @@ struct MaterialData /**new material, since 3.3 * @js NA +* @lua NA */ struct NTextureData { @@ -328,6 +337,7 @@ struct NMaterialData }; /** material datas, since 3.3 * @js NA +* @lua NA */ struct MaterialDatas { @@ -348,6 +358,7 @@ struct MaterialDatas }; /**animation data * @js NA +* @lua NA */ struct Animation3DData { @@ -420,6 +431,7 @@ public: /**reference data * @js NA +* @lua NA */ struct Reference { diff --git a/cocos/3d/CCBundleReader.h b/cocos/3d/CCBundleReader.h index dc81ffb844..a4c80071a8 100644 --- a/cocos/3d/CCBundleReader.h +++ b/cocos/3d/CCBundleReader.h @@ -42,6 +42,7 @@ NS_CC_BEGIN /** * @brief BundleReader is an interface for reading sequence of bytes. * @js NA + * @lua NA */ class BundleReader: public cocos2d::Ref { @@ -128,6 +129,8 @@ private: char* _buffer; }; +/// @cond + /** * template read routines */ @@ -207,7 +210,9 @@ inline bool BundleReader::readArray(unsigned int *length, std::vect return true; } -// end of actions group +/// @endcond + +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCFrustum.h b/cocos/3d/CCFrustum.h index 2ea5eda944..0fb2d30d63 100755 --- a/cocos/3d/CCFrustum.h +++ b/cocos/3d/CCFrustum.h @@ -39,6 +39,7 @@ class Camera; * the frustum is a six-side geometry, usually use the frustum to do fast-culling: * check a entity whether is a potential visible entity * @js NA + * @lua NA */ class CC_DLL Frustum { diff --git a/cocos/3d/CCMesh.h b/cocos/3d/CCMesh.h index c5ef7cf347..5821fe0bec 100644 --- a/cocos/3d/CCMesh.h +++ b/cocos/3d/CCMesh.h @@ -59,14 +59,28 @@ public: /**create mesh with vertex attributes*/ CC_DEPRECATED_ATTRIBUTE static Mesh* create(const std::vector& vertices, int perVertexSizeInFloat, const IndexArray& indices, int numIndex, const std::vector& attribs, int attribCount){ return create(vertices, perVertexSizeInFloat, indices, attribs); } + /** + * @lua NA + */ static Mesh* create(const std::vector& vertices, int perVertexSizeInFloat, const IndexArray& indices, const std::vector& attribs); - /** create mesh */ + /** + * create mesh + * @lua NA + */ static Mesh* create(const std::string& name, MeshIndexData* indexData, MeshSkin* skin = nullptr); - /**get vertex buffer*/ + /** + * get vertex buffer + * + * @lua NA + */ GLuint getVertexBuffer() const; - /**has vertex attribute?*/ + /** + * has vertex attribute? + * + * @lua NA + */ bool hasVertexAttrib(int attrib) const; /**get mesh vertex attribute count*/ ssize_t getMeshVertexAttribCount() const; @@ -84,13 +98,25 @@ public: void setVisible(bool visible); bool isVisible() const { return _visible; } - /**skin getter */ + /** + * skin getter + * + * @lua NA + */ MeshSkin* getSkin() const { return _skin; } - /**mesh index data getter */ + /** + * mesh index data getter + * + * @lua NA + */ MeshIndexData* getMeshIndexData() const { return _meshIndexData; } - /**get GLProgramState*/ + /** + * get GLProgramState + * + * @lua NA + */ GLProgramState* getGLProgramState() const { return _glProgramState; } /**name getter */ @@ -99,13 +125,29 @@ public: void setBlendFunc(const BlendFunc &blendFunc); const BlendFunc &getBlendFunc() const; - /** get primitive type*/ + /** + * get primitive type + * + * @lua NA + */ GLenum getPrimitiveType() const; - /**get index count*/ + /** + * get index count + * + * @lua NA + */ ssize_t getIndexCount() const; - /**get index format*/ + /** + * get index format + * + * @lua NA + */ GLenum getIndexFormat() const; - /**get index buffer*/ + /** + * get index buffer + * + * @lua NA + */ GLuint getIndexBuffer() const; /**get AABB*/ @@ -163,7 +205,7 @@ protected: std::function _visibleChanged; }; -// end of actions group +// end of 3d group /// @} diff --git a/cocos/3d/CCMeshSkin.h b/cocos/3d/CCMeshSkin.h index 5209c6a0ad..1339ca17dc 100644 --- a/cocos/3d/CCMeshSkin.h +++ b/cocos/3d/CCMeshSkin.h @@ -45,6 +45,7 @@ class Skeleton3D; * @brief MeshSkin, A class maintain a collection of bones that affect Mesh vertex. * And it is responsible for computing matrix palletes that used by skin mesh rendering. * @js NA + * @lua NA */ class CC_DLL MeshSkin: public Ref { @@ -105,7 +106,7 @@ protected: Vec4* _matrixPalette; }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCMeshVertexIndexData.h b/cocos/3d/CCMeshVertexIndexData.h index aa406ab074..0f2659a012 100644 --- a/cocos/3d/CCMeshVertexIndexData.h +++ b/cocos/3d/CCMeshVertexIndexData.h @@ -52,6 +52,7 @@ class MeshVertexData; * the MeshIndexData class. * @brief the MeshIndexData contain all of the indices data which mesh need. * @js NA + * @lua NA */ class MeshIndexData : public Ref { @@ -138,7 +139,7 @@ protected: int _vertexCount; //vertex count }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCOBB.h b/cocos/3d/CCOBB.h index b45df08447..5c83ab6460 100644 --- a/cocos/3d/CCOBB.h +++ b/cocos/3d/CCOBB.h @@ -46,11 +46,15 @@ public: /* * Construct obb from oriented bounding box + * + * @lua NA */ OBB(const AABB& aabb); /* * Construct obb from points + * + * @lua NA */ OBB(const Vec3* verts, int num); @@ -135,7 +139,7 @@ public: Vec3 _extents; // obb length along each axis }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCObjLoader.h b/cocos/3d/CCObjLoader.h index d856c791c6..3a9d38b3d5 100644 --- a/cocos/3d/CCObjLoader.h +++ b/cocos/3d/CCObjLoader.h @@ -24,6 +24,7 @@ NS_CC_BEGIN /** * @brief .obj file Loader * @js NA + * @lua NA **/ class ObjLoader { @@ -106,7 +107,7 @@ public: }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCPlane.h b/cocos/3d/CCPlane.h index 2c66cb845f..cc1baf822c 100755 --- a/cocos/3d/CCPlane.h +++ b/cocos/3d/CCPlane.h @@ -40,6 +40,7 @@ enum class PointSide /** * Defines plane * @js NA + * @lua NA **/ class CC_DLL Plane { diff --git a/cocos/3d/CCRay.h b/cocos/3d/CCRay.h index 3bd18c7f61..2b23eadaa3 100644 --- a/cocos/3d/CCRay.h +++ b/cocos/3d/CCRay.h @@ -46,11 +46,14 @@ class CC_DLL Ray public: /** * Constructor. + * + * @lua new */ Ray(); /** * Constructor. + * @lua NA */ Ray(const Ray& ray); @@ -59,11 +62,13 @@ public: * * @param origin The ray's origin. * @param direction The ray's direction. + * @lua new */ Ray(const Vec3& origin, const Vec3& direction); /** * Destructor. + * @lua NA */ ~Ray(); @@ -99,7 +104,7 @@ public: Vec3 _direction; // The ray direction vector. }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCSkeleton3D.h b/cocos/3d/CCSkeleton3D.h index 303917d009..89a9ba15f5 100644 --- a/cocos/3d/CCSkeleton3D.h +++ b/cocos/3d/CCSkeleton3D.h @@ -39,6 +39,7 @@ NS_CC_BEGIN /** * @brief Defines a basic hierachial structure of transformation spaces. + * @lua NA */ class CC_DLL Bone3D : public Ref { @@ -189,7 +190,9 @@ protected: class CC_DLL Skeleton3D: public Ref { public: - + /** + * @lua NA + */ static Skeleton3D* create(const std::vector& skeletondata); /**get total bone count*/ @@ -231,7 +234,7 @@ protected: Vector _rootBones; }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCSkybox.cpp b/cocos/3d/CCSkybox.cpp index c9eb9705dc..07c5944d69 100644 --- a/cocos/3d/CCSkybox.cpp +++ b/cocos/3d/CCSkybox.cpp @@ -22,6 +22,14 @@ THE SOFTWARE. ****************************************************************************/ +#include "base/ccMacros.h" +#include "base/CCConfiguration.h" +#include "base/CCDirector.h" +#include "renderer/ccGLStateCache.h" +#include "renderer/CCGLProgram.h" +#include "renderer/CCGLProgramCache.h" +#include "renderer/CCGLProgramState.h" +#include "renderer/CCRenderer.h" #include "3d/CCSkybox.h" #include "3d/CCTextureCube.h" @@ -53,6 +61,17 @@ Skybox::~Skybox() _texture->release(); } +Skybox* Skybox::create(const std::string& positive_x, const std::string& negative_x, + const std::string& positive_y, const std::string& negative_y, + const std::string& positive_z, const std::string& negative_z) +{ + auto ret = new (std::nothrow) Skybox(); + ret->init(positive_x, negative_x, positive_y, negative_y, positive_z, negative_z); + + ret->autorelease(); + return ret; +} + bool Skybox::init() { // create and set our custom shader @@ -68,6 +87,19 @@ bool Skybox::init() return true; } +bool Skybox::init(const std::string& positive_x, const std::string& negative_x, + const std::string& positive_y, const std::string& negative_y, + const std::string& positive_z, const std::string& negative_z) +{ + auto texture = TextureCube::create(positive_x, negative_x, positive_y, negative_y, positive_z, negative_z); + if (texture == nullptr) + return false; + + init(); + setTexture(texture); + return true; +} + void Skybox::initBuffers() { if (Configuration::getInstance()->supportsShareableVAO()) @@ -120,6 +152,9 @@ void Skybox::onDraw(const Mat4& transform, uint32_t flags) { auto state = getGLProgramState(); state->apply(transform); + + Vec4 color(_displayedColor.r / 255.f, _displayedColor.g / 255.f, _displayedColor.b / 255.f, 1.f); + state->setUniformVec4("u_color", color); GLboolean depthFlag = glIsEnabled(GL_DEPTH_TEST); GLint depthFunc; @@ -179,12 +214,6 @@ void Skybox::setTexture(TextureCube* texture) void Skybox::reload() { - auto glProgram = getGLProgramState()->getGLProgram(); - glProgram->reset(); - glProgram->initWithFilenames("Shaders3D/Skybox.vert", "Shaders3D/Skybox.frag"); - glProgram->link(); - glProgram->updateUniforms(); - initBuffers(); } diff --git a/cocos/3d/CCSkybox.h b/cocos/3d/CCSkybox.h index 266e0eca86..f11143241e 100644 --- a/cocos/3d/CCSkybox.h +++ b/cocos/3d/CCSkybox.h @@ -25,10 +25,18 @@ #ifndef __SKYBOX_H__ #define __SKYBOX_H__ -#include "cocos2d.h" +#include "base/ccTypes.h" +#include "platform/CCPlatformMacros.h" +#include "renderer/CCCustomCommand.h" +#include "2d/CCNode.h" NS_CC_BEGIN +/** + * @addtogroup _3d + * @{ + */ + class TextureCube; /** @@ -38,6 +46,19 @@ class CC_DLL Skybox : public Node { public: CREATE_FUNC(Skybox); + + /** create skybox from 6 textures. + @param positive_x texture for the right side of the texture cube face. + @param negative_x texture for the up side of the texture cube face. + @param positive_y texture for the top side of the texture cube face + @param negative_y texture for the bottom side of the texture cube face + @param positive_z texture for the forward side of the texture cube face. + @param negative_z texture for the rear side of the texture cube face. + @return A new skybox inited with given parameters. + */ + static Skybox* create(const std::string& positive_x, const std::string& negative_x, + const std::string& positive_y, const std::string& negative_y, + const std::string& positive_z, const std::string& negative_z); /**texture getter and setter*/ void setTexture(TextureCube*); @@ -63,6 +84,13 @@ CC_CONSTRUCTOR_ACCESS: * init Skybox. */ virtual bool init(); + + /** + * initialize with texture path + */ + bool init(const std::string& positive_x, const std::string& negative_x, + const std::string& positive_y, const std::string& negative_y, + const std::string& positive_z, const std::string& negative_z); protected: @@ -84,6 +112,9 @@ private: CC_DISALLOW_COPY_AND_ASSIGN(Skybox); }; +// end of 3d group +/// @} + NS_CC_END #endif // __SKYBOX_H__ diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp index 3297b64b6a..8f9ad8988b 100644 --- a/cocos/3d/CCSprite3D.cpp +++ b/cocos/3d/CCSprite3D.cpp @@ -244,6 +244,7 @@ Sprite3D::Sprite3D() , _aabbDirty(true) , _lightMask(-1) , _shaderUsingLight(false) +, _forceDepthWrite(false) { } diff --git a/cocos/3d/CCSprite3D.h b/cocos/3d/CCSprite3D.h index 0502108510..51467a91e3 100644 --- a/cocos/3d/CCSprite3D.h +++ b/cocos/3d/CCSprite3D.h @@ -90,7 +90,11 @@ public: /**get Mesh by Name, it returns the first one if there are more than one mesh with the same name */ Mesh* getMeshByName(const std::string& name) const; - /** get mesh array by name, returns all meshes with the given name */ + /** + * get mesh array by name, returns all meshes with the given name + * + * @lua NA + */ std::vector getMeshArrayByName(const std::string& name) const; /**get mesh*/ @@ -266,10 +270,18 @@ public: static Sprite3DCache* getInstance(); static void destroyInstance(); - /**get the SpriteData struct*/ + /** + * get the SpriteData struct + * + * @lua NA + */ Sprite3DData* getSpriteData(const std::string& key) const; - /**add the SpriteData into Sprite3D by given the specified key*/ + /** + * add the SpriteData into Sprite3D by given the specified key + * + * @lua NA + */ bool addSprite3DData(const std::string& key, Sprite3DData* spritedata); /**remove the SpriteData from Sprite3D by given the specified key*/ @@ -289,9 +301,11 @@ protected: std::unordered_map _spriteDatas; //cached sprite datas }; +/// @cond extern std::string CC_DLL s_attributeNames[];//attribute names array +/// @endcond -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCSprite3DMaterial.h b/cocos/3d/CCSprite3DMaterial.h index 0201ad4509..cf7b950fc3 100644 --- a/cocos/3d/CCSprite3DMaterial.h +++ b/cocos/3d/CCSprite3DMaterial.h @@ -41,12 +41,15 @@ class Texture2D; /** * @brief the sprite3D material is only texture for now * @js NA + * @lua NA */ class Sprite3DMaterialCache { public: /**get & destroy cache*/ static Sprite3DMaterialCache* getInstance(); + + /**destroy the instance*/ static void destroyInstance(); /**add to cache*/ @@ -71,7 +74,7 @@ protected: }; -// end of actions group +// end of 3d group /// @} NS_CC_END diff --git a/cocos/3d/CCTextureCube.cpp b/cocos/3d/CCTextureCube.cpp index f11c306040..779a1c64f5 100644 --- a/cocos/3d/CCTextureCube.cpp +++ b/cocos/3d/CCTextureCube.cpp @@ -26,6 +26,8 @@ #include "platform/CCImage.h" #include "platform/CCFileUtils.h" +#include "renderer/ccGLStateCache.h" + NS_CC_BEGIN unsigned char* getImageData(Image* img, Texture2D::PixelFormat& ePixFmt) @@ -189,7 +191,8 @@ bool TextureCube::init(const std::string& positive_x, const std::string& negativ GLuint handle; glGenTextures(1, &handle); - glBindTexture(GL_TEXTURE_CUBE_MAP, handle); + + GL::bindTextureN(0, handle, GL_TEXTURE_CUBE_MAP); for (int i = 0; i < 6; i++) { @@ -231,7 +234,7 @@ bool TextureCube::init(const std::string& positive_x, const std::string& negativ _name = handle; - glBindTexture(GL_TEXTURE_CUBE_MAP, 0); + GL::bindTextureN(0, 0, GL_TEXTURE_CUBE_MAP); for (auto img: images) { @@ -245,14 +248,14 @@ void TextureCube::setTexParameters(const TexParams& texParams) { CCASSERT(_name != 0, __FUNCTION__); - glBindTexture(GL_TEXTURE_CUBE_MAP, _name); + GL::bindTextureN(0, _name, GL_TEXTURE_CUBE_MAP); - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, texParams.wrapS); - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, texParams.wrapS); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, texParams.minFilter); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, texParams.magFilter); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, texParams.wrapS); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, texParams.wrapT); - glBindTexture(GL_TEXTURE_CUBE_MAP, 0); + GL::bindTextureN(0, 0, GL_TEXTURE_CUBE_MAP); } bool TextureCube::reloadTexture() diff --git a/cocos/3d/CCTextureCube.h b/cocos/3d/CCTextureCube.h index 011c847191..fdba30be2c 100644 --- a/cocos/3d/CCTextureCube.h +++ b/cocos/3d/CCTextureCube.h @@ -33,6 +33,11 @@ NS_CC_BEGIN +/** + * @addtogroup _3d + * @{ + */ + /** TextureCube is a collection of six separate square textures that are put onto the faces of an imaginary cube. @@ -79,6 +84,9 @@ private: std::vector _imgPath; }; +// end of 3d group +/// @} + NS_CC_END #endif // __CCTEXTURECUBE_H__ diff --git a/cocos/audio/apple/AudioCache.mm b/cocos/audio/apple/AudioCache.mm index 9afa0054be..6a4265f9ba 100644 --- a/cocos/audio/apple/AudioCache.mm +++ b/cocos/audio/apple/AudioCache.mm @@ -99,8 +99,10 @@ void AudioCache::readDataTask() AudioBufferList theDataBuffer; ExtAudioFileRef extRef = nullptr; - auto fileURL = (CFURLRef)[[NSURL fileURLWithPath:[NSString stringWithCString:_fileFullPath.c_str() encoding:[NSString defaultCStringEncoding]]] retain]; - + NSString *fileFullPath = [[NSString alloc] initWithCString:_fileFullPath.c_str() encoding:[NSString defaultCStringEncoding]]; + auto fileURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:fileFullPath]; + [fileFullPath release]; + auto error = ExtAudioFileOpenURL(fileURL, &extRef); if(error) { printf("%s: ExtAudioFileOpenURL FAILED, Error = %ld\n", __PRETTY_FUNCTION__, (long)error); diff --git a/cocos/audio/include/AudioEngine.h b/cocos/audio/include/AudioEngine.h index 078075c91b..7cad808f6f 100644 --- a/cocos/audio/include/AudioEngine.h +++ b/cocos/audio/include/AudioEngine.h @@ -64,7 +64,12 @@ public: /* Minimum delay in between sounds */ double minDelay; - + + /** + * Defautl constructor + * + * @lua new + */ AudioProfile() : maxInstances(0) , minDelay(0.0) diff --git a/cocos/audio/include/SimpleAudioEngine.h b/cocos/audio/include/SimpleAudioEngine.h index ac4c9bc450..9508ba1c4e 100644 --- a/cocos/audio/include/SimpleAudioEngine.h +++ b/cocos/audio/include/SimpleAudioEngine.h @@ -73,6 +73,7 @@ public: * Release the shared Engine object. * * @warning It must be called before the application exit, or it will lead to memory leaks. + * @lua destroyInstance */ static void end(); diff --git a/cocos/base/CCAsyncTaskPool.h b/cocos/base/CCAsyncTaskPool.h index 71baf09521..3b700af671 100644 --- a/cocos/base/CCAsyncTaskPool.h +++ b/cocos/base/CCAsyncTaskPool.h @@ -87,6 +87,7 @@ public: * @param callback callback when the task is finished. The callback is called in the main thread instead of task thread. * @param callbackParam parameter used by the callback. * @param f task can be lambda function. + * @lua NA */ template inline void enqueue(TaskType type, const TaskCallBack& callback, void* callbackParam, F&& f); diff --git a/cocos/base/CCConfiguration.cpp b/cocos/base/CCConfiguration.cpp index e862aa3eff..7d5792fd5d 100644 --- a/cocos/base/CCConfiguration.cpp +++ b/cocos/base/CCConfiguration.cpp @@ -50,6 +50,7 @@ Configuration::Configuration() , _maxDirLightInShader(1) , _maxPointLightInShader(1) , _maxSpotLightInShader(1) +, _isAnimate3DHighQuality(true) { } @@ -262,6 +263,11 @@ int Configuration::getMaxSupportSpotLightInShader() const return _maxSpotLightInShader; } +bool Configuration::isHighAnimate3DQuality() const +{ + return _isAnimate3DHighQuality; +} + // // generic getters for properties // @@ -350,6 +356,12 @@ void Configuration::loadConfigFile(const std::string& filename) _maxSpotLightInShader = _valueDict[name].asInt(); else _valueDict[name] = Value(_maxSpotLightInShader); + + name = "cocos2d.x.3d.animate_high_quality"; + if (_valueDict.find(name) != _valueDict.end()) + _isAnimate3DHighQuality = _valueDict[name].asBool(); + else + _valueDict[name] = Value(_isAnimate3DHighQuality); } NS_CC_END diff --git a/cocos/base/CCConfiguration.h b/cocos/base/CCConfiguration.h index e968fb3fc7..4c3f487598 100644 --- a/cocos/base/CCConfiguration.h +++ b/cocos/base/CCConfiguration.h @@ -164,6 +164,12 @@ public: */ int getMaxSupportSpotLightInShader() const; + /** is 3d animate quality? Configure it in the config.plist, the key is cocos2d.x.3d.animate_high_quality, it is true by default. + * Animation quality of created Animate3D is based on the return value. However, animation quality of Animate3D can be modified by calling setHighQuality after it is created. + * @return true: is high quality, false: is low quality + */ + bool isHighAnimate3DQuality() const; + /** Returns whether or not an OpenGL is supported. * * @param searchName A given search name. @@ -230,6 +236,7 @@ protected: int _maxDirLightInShader; //max support directional light in shader int _maxPointLightInShader; // max support point light in shader int _maxSpotLightInShader; // max support spot light in shader + bool _isAnimate3DHighQuality; // animation 3d quality, true: is high quality, false: is low quality ValueMap _valueDict; }; diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp index 6a08b27ae8..fdb9ccffe8 100644 --- a/cocos/base/CCDirector.cpp +++ b/cocos/base/CCDirector.cpp @@ -2,7 +2,7 @@ Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2010-2013 cocos2d-x.org Copyright (c) 2011 Zynga Inc. -Copyright (c) 2013-2014 Chukong Technologies Inc. +Copyright (c) 2013-2015 Chukong Technologies Inc. http://www.cocos2d-x.org @@ -107,6 +107,7 @@ Director* Director::getInstance() } Director::Director() +: _isStatusLabelUpdated(true) { } @@ -386,7 +387,7 @@ void Director::setOpenGLView(GLView *openGLView) // set size _winSizeInPoints = _openGLView->getDesignResolutionSize(); - createStatsLabel(); + _isStatusLabelUpdated = true; if (_openGLView) { @@ -1110,6 +1111,12 @@ void Director::resume() // updates the FPS every frame void Director::showStats() { + if (_isStatusLabelUpdated) + { + createStatsLabel(); + _isStatusLabelUpdated = false; + } + static unsigned long prevCalls = 0; static unsigned long prevVerts = 0; static float prevDeltaTime = 0.016f; // 60FPS @@ -1255,7 +1262,7 @@ void Director::setContentScaleFactor(float scaleFactor) if (scaleFactor != _contentScaleFactor) { _contentScaleFactor = scaleFactor; - createStatsLabel(); + _isStatusLabelUpdated = true; } } diff --git a/cocos/base/CCDirector.h b/cocos/base/CCDirector.h index c54ad53b58..ec05d21950 100644 --- a/cocos/base/CCDirector.h +++ b/cocos/base/CCDirector.h @@ -2,7 +2,7 @@ Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2010-2013 cocos2d-x.org Copyright (c) 2011 Zynga Inc. - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2015 Chukong Technologies Inc. http://www.cocos2d-x.org @@ -597,6 +597,8 @@ protected: /* Console for the director */ Console *_console; + bool _isStatusLabelUpdated; + // GLView will recreate stats labels to fit visible rect friend class GLView; }; diff --git a/cocos/base/CCIMEDelegate.h b/cocos/base/CCIMEDelegate.h index 7f0c57fb16..a88f4eb95e 100644 --- a/cocos/base/CCIMEDelegate.h +++ b/cocos/base/CCIMEDelegate.h @@ -58,15 +58,22 @@ class CC_DLL IMEDelegate { public: /** + * Default constructor. * @js NA * @lua NA */ virtual ~IMEDelegate(); + /** + * Default destructor. + * @js NA * @lua NA */ virtual bool attachWithIME(); + /** + * Determine whether the IME is detached or not. + * @js NA * @lua NA */ virtual bool detachWithIME(); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.h b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.h index ef36a8b4a9..2169762fff 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.h +++ b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.h @@ -72,7 +72,8 @@ public: static void destroyInstance(); CSLoader(); - void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE void purge(); void init(); diff --git a/cocos/editor-support/cocostudio/Android.mk b/cocos/editor-support/cocostudio/Android.mk index 9f07ff1af8..6914cfa01c 100644 --- a/cocos/editor-support/cocostudio/Android.mk +++ b/cocos/editor-support/cocostudio/Android.mk @@ -75,7 +75,8 @@ ActionTimeline/CSLoader.cpp \ FlatBuffersSerialize.cpp \ WidgetCallBackHandlerProtocol.cpp \ WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp \ -CCObjectExtensionData.cpp +CCObjectExtensionData.cpp \ +CocoStudio.cpp LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. diff --git a/cocos/editor-support/cocostudio/CMakeLists.txt b/cocos/editor-support/cocostudio/CMakeLists.txt index 888b4f8146..25f8b80133 100644 --- a/cocos/editor-support/cocostudio/CMakeLists.txt +++ b/cocos/editor-support/cocostudio/CMakeLists.txt @@ -44,6 +44,7 @@ set(COCOS_CS_SRC editor-support/cocostudio/TriggerObj.cpp editor-support/cocostudio/FlatBuffersSerialize.cpp editor-support/cocostudio/CCObjectExtensionData.cpp + editor-support/cocostudio/CocoStudio.cpp editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.cpp editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp diff --git a/cocos/editor-support/cocostudio/CocoStudio.cpp b/cocos/editor-support/cocostudio/CocoStudio.cpp new file mode 100644 index 0000000000..894ecc94a4 --- /dev/null +++ b/cocos/editor-support/cocostudio/CocoStudio.cpp @@ -0,0 +1,67 @@ + +#include "CocoStudio.h" + +#include "cocostudio/WidgetReader/NodeReader/NodeReader.h" +#include "cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.h" +#include "cocostudio/WidgetReader/SpriteReader/SpriteReader.h" +#include "cocostudio/WidgetReader/ParticleReader/ParticleReader.h" +#include "cocostudio/WidgetReader/GameMapReader/GameMapReader.h" +#include "cocostudio/WidgetReader/ProjectNodeReader/ProjectNodeReader.h" +#include "cocostudio/WidgetReader/ComAudioReader/ComAudioReader.h" + +#include "cocostudio/WidgetReader/ButtonReader/ButtonReader.h" +#include "cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.h" +#include "cocostudio/WidgetReader/ImageViewReader/ImageViewReader.h" +#include "cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.h" +#include "cocostudio/WidgetReader/TextReader/TextReader.h" +#include "cocostudio/WidgetReader/TextFieldReader/TextFieldReader.h" +#include "cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.h" +#include "cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.h" +#include "cocostudio/WidgetReader/SliderReader/SliderReader.h" +#include "cocostudio/WidgetReader/LayoutReader/LayoutReader.h" +#include "cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.h" +#include "cocostudio/WidgetReader/PageViewReader/PageViewReader.h" +#include "cocostudio/WidgetReader/ListViewReader/ListViewReader.h" +#include "cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.h" +#include "cocostudio/WidgetReader/Node3DReader/Node3DReader.h" +#include "cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.h" +#include "cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h" +#include "cocostudio/WidgetReader/Particle3DReader/Particle3DReader.h" + + +namespace cocostudio +{ + void destroyCocosStudio() + { + NodeReader::destroyInstance(); + SingleNodeReader::destroyInstance(); + SpriteReader::destroyInstance(); + ParticleReader::destroyInstance(); + GameMapReader::destroyInstance(); + ProjectNodeReader::destroyInstance(); + ComAudioReader::destroyInstance(); + + WidgetReader::destroyInstance(); + ButtonReader::destroyInstance(); + CheckBoxReader::destroyInstance(); + ImageViewReader::destroyInstance(); + TextBMFontReader::destroyInstance(); + TextReader::destroyInstance(); + TextFieldReader::destroyInstance(); + TextAtlasReader::destroyInstance(); + LoadingBarReader::destroyInstance(); + SliderReader::destroyInstance(); + LayoutReader::destroyInstance(); + ScrollViewReader::destroyInstance(); + PageViewReader::destroyInstance(); + ListViewReader::destroyInstance(); + + ArmatureNodeReader::destroyInstance(); + Node3DReader::destroyInstance(); + Sprite3DReader::destroyInstance(); + UserCameraReader::destroyInstance(); + Particle3DReader::destroyInstance(); + + cocos2d::CSLoader::destroyInstance(); + } +} \ No newline at end of file diff --git a/cocos/editor-support/cocostudio/CocoStudio.h b/cocos/editor-support/cocostudio/CocoStudio.h index 76df122596..f82c3eb09a 100644 --- a/cocos/editor-support/cocostudio/CocoStudio.h +++ b/cocos/editor-support/cocostudio/CocoStudio.h @@ -65,4 +65,11 @@ THE SOFTWARE. #include "cocostudio/CocosStudioExport.h" #include "cocostudio/ActionTimeline/CSLoader.h" +#include "cocostudio/CocosStudioExport.h" + +namespace cocostudio +{ + void CC_STUDIO_DLL destroyCocosStudio(); +} + #endif diff --git a/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp b/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp index 7604658117..3e38985e0a 100644 --- a/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp +++ b/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp @@ -111,7 +111,7 @@ FlatBuffersSerialize::FlatBuffersSerialize() FlatBuffersSerialize::~FlatBuffersSerialize() { - purge(); + } FlatBuffersSerialize* FlatBuffersSerialize::getInstance() @@ -123,10 +123,16 @@ FlatBuffersSerialize* FlatBuffersSerialize::getInstance() return _instanceFlatBuffersSerialize; } - + void FlatBuffersSerialize::purge() { CC_SAFE_DELETE(_instanceFlatBuffersSerialize); + +} + +void FlatBuffersSerialize::destroyInstance() +{ + CC_SAFE_DELETE(_instanceFlatBuffersSerialize); } diff --git a/cocos/editor-support/cocostudio/FlatBuffersSerialize.h b/cocos/editor-support/cocostudio/FlatBuffersSerialize.h index 9cd0d804f2..f05c059c58 100644 --- a/cocos/editor-support/cocostudio/FlatBuffersSerialize.h +++ b/cocos/editor-support/cocostudio/FlatBuffersSerialize.h @@ -91,7 +91,9 @@ class CC_STUDIO_DLL FlatBuffersSerialize public: static FlatBuffersSerialize* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); FlatBuffersSerialize(); ~FlatBuffersSerialize(); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp index 6d7189c225..957293280a 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp @@ -34,6 +34,11 @@ ArmatureNodeReader* ArmatureNodeReader::getInstance() return _instanceArmatureNodeReader; } +void ArmatureNodeReader::destroyInstance() +{ + CC_SAFE_DELETE(_instanceArmatureNodeReader); +} + Offset ArmatureNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, flatbuffers::FlatBufferBuilder *builder) { diff --git a/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.h b/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.h index a3930d8ed2..1c0061505d 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.h @@ -26,7 +26,6 @@ THE SOFTWARE. #define __ARMATURENODEREADER_H_ #include "cocos2d.h" -#include "cocostudio/FlatBuffersSerialize.h" #include "cocostudio/WidgetReader/NodeReaderProtocol.h" #include "cocostudio/WidgetReader/NodeReaderDefine.h" @@ -50,7 +49,9 @@ public: ~ArmatureNodeReader(); static ArmatureNodeReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::FlatBufferBuilder* builder) override; diff --git a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp index 6025bea066..fae7bf852b 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp @@ -64,6 +64,11 @@ namespace cocostudio CC_SAFE_DELETE(instanceButtonReader); } + void ButtonReader::destroyInstance() + { + CC_SAFE_DELETE(instanceButtonReader); + } + void ButtonReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) { WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.h b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.h index 2c1c969337..6025e7e741 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.h @@ -39,7 +39,9 @@ namespace cocostudio virtual ~ButtonReader(); static ButtonReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); diff --git a/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp index ae95206b78..09148b143d 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp @@ -45,6 +45,11 @@ namespace cocostudio return instanceCheckBoxReader; } + void CheckBoxReader::destroyInstance() + { + CC_SAFE_DELETE(instanceCheckBoxReader); + } + void CheckBoxReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) { diff --git a/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.h b/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.h index df1b1857cb..c6e9db2e8f 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.h @@ -39,7 +39,9 @@ namespace cocostudio virtual ~CheckBoxReader(); static CheckBoxReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ComAudioReader/ComAudioReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ComAudioReader/ComAudioReader.cpp index 2017f245ee..8142cf3120 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ComAudioReader/ComAudioReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ComAudioReader/ComAudioReader.cpp @@ -63,6 +63,11 @@ namespace cocostudio CC_SAFE_DELETE(_instanceComAudioReader); } + void ComAudioReader::destroyInstance() + { + CC_SAFE_DELETE(_instanceComAudioReader); + } + Offset
ComAudioReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, flatbuffers::FlatBufferBuilder *builder) { diff --git a/cocos/editor-support/cocostudio/WidgetReader/ComAudioReader/ComAudioReader.h b/cocos/editor-support/cocostudio/WidgetReader/ComAudioReader/ComAudioReader.h index 5994b2f659..3296f90ca9 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ComAudioReader/ComAudioReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/ComAudioReader/ComAudioReader.h @@ -40,7 +40,9 @@ namespace cocostudio ~ComAudioReader(); static ComAudioReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::FlatBufferBuilder* builder); diff --git a/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp index 35bede0e21..10d7e0d938 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp @@ -61,7 +61,7 @@ namespace cocostudio return _instanceTMXTiledMapReader; } - void GameMapReader::purge() + void GameMapReader::destroyInstance() { CC_SAFE_DELETE(_instanceTMXTiledMapReader); } diff --git a/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.h b/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.h index 24dfafc367..c17227d446 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.h @@ -42,7 +42,9 @@ namespace cocostudio ~GameMapReader(); static GameMapReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::FlatBufferBuilder* builder); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp index e08bc0c63a..f72f9802ec 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp @@ -49,6 +49,11 @@ namespace cocostudio return instanceImageViewReader; } + void ImageViewReader::destroyInstance() + { + CC_SAFE_DELETE(instanceImageViewReader); + } + void ImageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) { WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.h b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.h index 113276ec64..2539e57e5b 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.h @@ -41,7 +41,9 @@ namespace cocostudio virtual ~ImageViewReader(); static ImageViewReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode); diff --git a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp index bb796b83de..25b1708182 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp @@ -64,6 +64,11 @@ namespace cocostudio return instanceLayoutReader; } + void LayoutReader::destroyInstance() + { + CC_SAFE_DELETE(instanceLayoutReader); + } + void LayoutReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) { WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode); diff --git a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.h b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.h index 4cd08e224c..ba94695d8e 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.h @@ -40,7 +40,9 @@ namespace cocostudio virtual ~LayoutReader(); static LayoutReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; diff --git a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp index 80245ed1a2..6856a4432d 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp @@ -42,6 +42,11 @@ namespace cocostudio return instanceListViewReader; } + void ListViewReader::destroyInstance() + { + CC_SAFE_DELETE(instanceListViewReader); + } + void ListViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode) { ScrollViewReader::setPropsFromBinary(widget, cocoLoader, cocoNode); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.h b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.h index 4f260f4468..a36e4ef1f4 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.h @@ -39,7 +39,9 @@ namespace cocostudio virtual ~ListViewReader(); static ListViewReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; diff --git a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp index 3fe61ee47a..accff552ec 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp @@ -48,6 +48,11 @@ namespace cocostudio return instanceLoadingBar; } + void LoadingBarReader::destroyInstance() + { + CC_SAFE_DELETE(instanceLoadingBar); + } + void LoadingBarReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) { WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode); diff --git a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.h b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.h index 955eb009f4..f51256b082 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.h @@ -39,7 +39,9 @@ namespace cocostudio virtual ~LoadingBarReader(); static LoadingBarReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; diff --git a/cocos/editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp index 640e59cb62..ae39d9f497 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.cpp @@ -67,6 +67,11 @@ namespace cocostudio CC_SAFE_DELETE(_instanceNode3DReader); } + void Node3DReader::destroyInstance() + { + CC_SAFE_DELETE(_instanceNode3DReader); + } + Vec3 Node3DReader::getVec3Attribute(const tinyxml2::XMLAttribute* attribute) const { if(!attribute) diff --git a/cocos/editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.h b/cocos/editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.h index cf12772e5e..6a83b038cd 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/Node3DReader/Node3DReader.h @@ -46,7 +46,9 @@ namespace cocostudio ~Node3DReader(); static Node3DReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::FlatBufferBuilder* builder); diff --git a/cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp index a0ad52d60d..060c9c9ceb 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp @@ -79,7 +79,7 @@ namespace cocostudio return _instanceNodeReader; } - void NodeReader::purge() + void NodeReader::destroyInstance() { CC_SAFE_DELETE(_instanceNodeReader); } diff --git a/cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.h b/cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.h index 84049e6d73..a25df215cb 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.h @@ -41,7 +41,9 @@ namespace cocostudio ~NodeReader(); static NodeReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::FlatBufferBuilder* builder); diff --git a/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp index 2a02d99004..0fde47f3be 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp @@ -40,6 +40,11 @@ namespace cocostudio return instancePageViewReader; } + void PageViewReader::destroyInstance() + { + CC_SAFE_DELETE(instancePageViewReader); + } + void PageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) { LayoutReader::setPropsFromBinary(widget, cocoLoader, cocoNode); diff --git a/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.h b/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.h index d2f90d9d38..4801e11b03 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.h @@ -39,7 +39,9 @@ namespace cocostudio virtual ~PageViewReader(); static PageViewReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* cocoNode) ; diff --git a/cocos/editor-support/cocostudio/WidgetReader/Particle3DReader/Particle3DReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/Particle3DReader/Particle3DReader.cpp index f3a457f53c..0332bf8e2e 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/Particle3DReader/Particle3DReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/Particle3DReader/Particle3DReader.cpp @@ -68,6 +68,11 @@ namespace cocostudio CC_SAFE_DELETE(_instanceParticle3DReader); } + void Particle3DReader::destroyInstance() + { + CC_SAFE_DELETE(_instanceParticle3DReader); + } + Offset
Particle3DReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, flatbuffers::FlatBufferBuilder *builder) { diff --git a/cocos/editor-support/cocostudio/WidgetReader/Particle3DReader/Particle3DReader.h b/cocos/editor-support/cocostudio/WidgetReader/Particle3DReader/Particle3DReader.h index a3a5dfaa28..6be1e73589 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/Particle3DReader/Particle3DReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/Particle3DReader/Particle3DReader.h @@ -41,7 +41,9 @@ namespace cocostudio ~Particle3DReader(); static Particle3DReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::FlatBufferBuilder* builder); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ParticleReader/ParticleReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ParticleReader/ParticleReader.cpp index ffc2190e74..63d3e9ec51 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ParticleReader/ParticleReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ParticleReader/ParticleReader.cpp @@ -64,6 +64,11 @@ namespace cocostudio CC_SAFE_DELETE(_instanceParticleReader); } + void ParticleReader::destroyInstance() + { + CC_SAFE_DELETE(_instanceParticleReader); + } + Offset
ParticleReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, flatbuffers::FlatBufferBuilder *builder) { diff --git a/cocos/editor-support/cocostudio/WidgetReader/ParticleReader/ParticleReader.h b/cocos/editor-support/cocostudio/WidgetReader/ParticleReader/ParticleReader.h index 80841256fb..435ca11877 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ParticleReader/ParticleReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/ParticleReader/ParticleReader.h @@ -42,7 +42,9 @@ namespace cocostudio ~ParticleReader(); static ParticleReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::FlatBufferBuilder* builder); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ProjectNodeReader/ProjectNodeReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ProjectNodeReader/ProjectNodeReader.cpp index 6b0c73a53c..fe9d9cfdfb 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ProjectNodeReader/ProjectNodeReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ProjectNodeReader/ProjectNodeReader.cpp @@ -62,6 +62,11 @@ namespace cocostudio CC_SAFE_DELETE(_instanceProjectNodeReader); } + void ProjectNodeReader::destroyInstance() + { + CC_SAFE_DELETE(_instanceProjectNodeReader); + } + Offset
ProjectNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, flatbuffers::FlatBufferBuilder *builder) { diff --git a/cocos/editor-support/cocostudio/WidgetReader/ProjectNodeReader/ProjectNodeReader.h b/cocos/editor-support/cocostudio/WidgetReader/ProjectNodeReader/ProjectNodeReader.h index 48b2fccd43..73a3a50ca6 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ProjectNodeReader/ProjectNodeReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/ProjectNodeReader/ProjectNodeReader.h @@ -40,7 +40,9 @@ namespace cocostudio ~ProjectNodeReader(); static ProjectNodeReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::FlatBufferBuilder* builder); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp index eb6020f638..12e8a839f3 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp @@ -44,6 +44,11 @@ namespace cocostudio return instanceScrollViewReader; } + void ScrollViewReader::destroyInstance() + { + CC_SAFE_DELETE(instanceScrollViewReader); + } + void ScrollViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode) { //TODO: need to refactor... diff --git a/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.h b/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.h index de6f0e1f8f..fd91e23ea0 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.h @@ -39,7 +39,9 @@ namespace cocostudio virtual ~ScrollViewReader(); static ScrollViewReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; diff --git a/cocos/editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.cpp index 9c26174ae4..b041da0164 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.cpp @@ -67,6 +67,11 @@ namespace cocostudio CC_SAFE_DELETE(_instanceSingleNodeReader); } + void SingleNodeReader::destroyInstance() + { + CC_SAFE_DELETE(_instanceSingleNodeReader); + } + Offset
SingleNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, flatbuffers::FlatBufferBuilder *builder) { diff --git a/cocos/editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.h b/cocos/editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.h index 0a3f0b8c35..b8cf0dabdd 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.h @@ -42,7 +42,9 @@ namespace cocostudio ~SingleNodeReader(); static SingleNodeReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::FlatBufferBuilder* builder); diff --git a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp index 639d626ad6..1a40f4825b 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp @@ -48,6 +48,11 @@ namespace cocostudio return instanceSliderReader; } + void SliderReader::destroyInstance() + { + CC_SAFE_DELETE(instanceSliderReader); + } + void SliderReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode) { this->beginSetBasicProperties(widget); diff --git a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.h b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.h index b24aaa984c..042eac3480 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.h @@ -39,7 +39,9 @@ namespace cocostudio virtual ~SliderReader(); static SliderReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; diff --git a/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp index aa141240d9..28959fcc77 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.cpp @@ -67,6 +67,11 @@ namespace cocostudio CC_SAFE_DELETE(_instanceSprite3DReader); } + void Sprite3DReader::destroyInstance() + { + CC_SAFE_DELETE(_instanceSprite3DReader); + } + Vec2 Sprite3DReader::getVec2Attribute(const tinyxml2::XMLAttribute* attribute) const { if(!attribute) diff --git a/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.h b/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.h index 083310eb4d..1fc66e2116 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/Sprite3DReader/Sprite3DReader.h @@ -46,7 +46,9 @@ namespace cocostudio ~Sprite3DReader(); static Sprite3DReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::FlatBufferBuilder* builder); diff --git a/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp index c03cf73324..56eb65df47 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp @@ -65,6 +65,11 @@ namespace cocostudio CC_SAFE_DELETE(_instanceSpriteReader); } + void SpriteReader::destroyInstance() + { + CC_SAFE_DELETE(_instanceSpriteReader); + } + Offset
SpriteReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, flatbuffers::FlatBufferBuilder *builder) { diff --git a/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.h b/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.h index 8dcc575339..2882eb1d29 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.h @@ -42,7 +42,9 @@ namespace cocostudio ~SpriteReader(); static SpriteReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::FlatBufferBuilder* builder); diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp index 09da4b64f9..6180d8fdda 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp @@ -45,6 +45,11 @@ namespace cocostudio return instanceTextAtalsReader; } + void TextAtlasReader::destroyInstance() + { + CC_SAFE_DELETE(instanceTextAtalsReader); + } + void TextAtlasReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) { this->beginSetBasicProperties(widget); diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.h b/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.h index 98a3421c08..03d416fdc2 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.h @@ -39,6 +39,9 @@ namespace cocostudio virtual ~TextAtlasReader(); static TextAtlasReader* getInstance(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp index c3cc6d2665..8ab76248ab 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp @@ -42,6 +42,11 @@ namespace cocostudio return instanceTextBMFontReader; } + void TextBMFontReader::destroyInstance() + { + CC_SAFE_DELETE(instanceTextBMFontReader); + } + void TextBMFontReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) { this->beginSetBasicProperties(widget); diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.h b/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.h index c489a272a7..34a770b76a 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.h @@ -39,7 +39,9 @@ namespace cocostudio virtual ~TextBMFontReader(); static TextBMFontReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp index 6de6920888..6b808ebf82 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp @@ -49,6 +49,11 @@ namespace cocostudio return instanceTextFieldReader; } + void TextFieldReader::destroyInstance() + { + CC_SAFE_DELETE(instanceTextFieldReader); + } + void TextFieldReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode) { this->beginSetBasicProperties(widget); diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.h b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.h index a51ceb7d3c..4d003e203b 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.h @@ -39,7 +39,9 @@ namespace cocostudio virtual ~TextFieldReader(); static TextFieldReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp index c7c6f908cc..a49119f261 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp @@ -47,6 +47,11 @@ namespace cocostudio return instanceTextReader; } + void TextReader::destroyInstance() + { + CC_SAFE_DELETE(instanceTextReader); + } + void TextReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) { this->beginSetBasicProperties(widget); diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.h b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.h index 70b32551af..de6e2da763 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.h @@ -39,7 +39,9 @@ namespace cocostudio virtual ~TextReader(); static TextReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode); diff --git a/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp index 32e662d4bc..5e5e253259 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp @@ -66,6 +66,11 @@ namespace cocostudio CC_SAFE_DELETE(_instanceUserCameraReader); } + void UserCameraReader::destroyInstance() + { + CC_SAFE_DELETE(_instanceUserCameraReader); + } + Vec2 UserCameraReader::getVec2Attribute(const tinyxml2::XMLAttribute* attribute) const { if(!attribute) diff --git a/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h b/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h index 0028547c93..f1069bb5de 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h @@ -46,7 +46,9 @@ namespace cocostudio ~UserCameraReader(); static UserCameraReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); flatbuffers::Offset createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::FlatBufferBuilder* builder); diff --git a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp index 88ddec98c2..6b868635f7 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp @@ -139,6 +139,11 @@ namespace cocostudio CC_SAFE_DELETE(instanceWidgetReader); } + void WidgetReader::destroyInstance() + { + CC_SAFE_DELETE(instanceWidgetReader); + } + void WidgetReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options) { diff --git a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.h b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.h index 6e0a456753..b25d10566d 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.h @@ -46,7 +46,9 @@ namespace cocostudio virtual ~WidgetReader(); static WidgetReader* getInstance(); - static void purge(); + /** @deprecated Use method destroyInstance() instead */ + CC_DEPRECATED_ATTRIBUTE static void purge(); + static void destroyInstance(); virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options); diff --git a/cocos/physics/CCPhysicsContact.h b/cocos/physics/CCPhysicsContact.h index d67c9bac52..cee52dfc75 100644 --- a/cocos/physics/CCPhysicsContact.h +++ b/cocos/physics/CCPhysicsContact.h @@ -89,13 +89,18 @@ public: /** Get previous contact data */ inline const PhysicsContactData* getPreContactData() const { return _preContactData; } - /** Get data. */ + /** + * Get data. + * @lua NA + */ inline void* getData() const { return _data; } /** * @brief Set data to contact. * You must manage the memory yourself, Generally you can set data at contact begin, and distory it at contact seperate. + * + * @lua NA */ inline void setData(void* data) { _data = data; } diff --git a/cocos/platform/CCFileUtils.cpp b/cocos/platform/CCFileUtils.cpp index a59c2b06f6..738aedb986 100644 --- a/cocos/platform/CCFileUtils.cpp +++ b/cocos/platform/CCFileUtils.cpp @@ -1294,15 +1294,21 @@ bool FileUtils::renameFile(const std::string &path, const std::string &oldname, if(FileUtils::getInstance()->isFileExist(_new)) { - DeleteFileA(_new.c_str()); + if (!DeleteFileA(_new.c_str())) + { + CCLOGERROR("Fail to delete file %s !Error code is 0x%x", newPath.c_str(), GetLastError()); + } } - MoveFileA(_old.c_str(), _new.c_str()); - - if (0 == GetLastError()) + if (MoveFileA(_old.c_str(), _new.c_str())) + { return true; + } else + { + CCLOGERROR("Fail to rename file %s to %s !Error code is 0x%x", oldPath.c_str(), newPath.c_str(), GetLastError()); return false; + } #else int errorCode = rename(oldPath.c_str(), newPath.c_str()); diff --git a/cocos/platform/CCGLView.cpp b/cocos/platform/CCGLView.cpp index 83709f06b8..0e7897a625 100644 --- a/cocos/platform/CCGLView.cpp +++ b/cocos/platform/CCGLView.cpp @@ -1,6 +1,6 @@ /**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2014 Chukong Technologies Inc. +Copyright (c) 2013-2015 Chukong Technologies Inc. http://www.cocos2d-x.org @@ -156,7 +156,7 @@ void GLView::updateDesignResolutionSize() // reset director's member variables to fit visible rect auto director = Director::getInstance(); director->_winSizeInPoints = getDesignResolutionSize(); - director->createStatsLabel(); + director->_isStatusLabelUpdated = true; director->setGLDefaultValues(); } } diff --git a/cocos/platform/winrt/CCDevice.cpp b/cocos/platform/winrt/CCDevice.cpp index 81dcc58a98..08360881dc 100644 --- a/cocos/platform/winrt/CCDevice.cpp +++ b/cocos/platform/winrt/CCDevice.cpp @@ -75,7 +75,9 @@ void Device::setAccelerometerEnabled(bool isEnabled) if(sAccelerometer == nullptr) { - MessageBox("This device does not have an accelerometer.","Alert"); + // It's not a friendly experience and may cause crash. + //MessageBox("This device does not have an accelerometer.","Alert"); + log("This device does not have an accelerometer."); return; } diff --git a/cocos/renderer/CCGLProgramState.h b/cocos/renderer/CCGLProgramState.h index 5e7fb45998..42b0a32b79 100644 --- a/cocos/renderer/CCGLProgramState.h +++ b/cocos/renderer/CCGLProgramState.h @@ -48,7 +48,9 @@ class EventListenerCustom; class EventCustom; /** - Uniform Value, which is used to store to value send to openGL pipe line by glUniformXXX. + * Uniform Value, which is used to store to value send to openGL pipe line by glUniformXXX. + * + * @lua NA */ class CC_DLL UniformValue { @@ -134,7 +136,11 @@ protected: */ }; -/**Vertex Attribute Value, which is an abstraction of VertexAttribute and data pointer.*/ +/** + * Vertex Attribute Value, which is an abstraction of VertexAttribute and data pointer. + * + * @lua NA + */ class CC_DLL VertexAttribValue { friend class GLProgram; diff --git a/cocos/renderer/ccShader_3D_Skybox.frag b/cocos/renderer/ccShader_3D_Skybox.frag index 1fe25805c5..ffeaa24fa0 100644 --- a/cocos/renderer/ccShader_3D_Skybox.frag +++ b/cocos/renderer/ccShader_3D_Skybox.frag @@ -5,9 +5,10 @@ varying mediump vec3 v_reflect; varying vec3 v_reflect; \n#endif\n uniform samplerCube u_Env; +uniform vec4 u_color; void main(void) { - gl_FragColor = textureCube(u_Env, v_reflect); + gl_FragColor = textureCube(u_Env, v_reflect) * u_color; } -); \ No newline at end of file +); diff --git a/cocos/scripting/lua-bindings/auto/api/ActionCamera.lua b/cocos/scripting/lua-bindings/auto/api/ActionCamera.lua index 27a43fe1ed..8cddd76da5 100644 --- a/cocos/scripting/lua-bindings/auto/api/ActionCamera.lua +++ b/cocos/scripting/lua-bindings/auto/api/ActionCamera.lua @@ -66,7 +66,8 @@ -- @return ActionCamera#ActionCamera ret (return value: cc.ActionCamera) -------------------------------- --- js ctor +-- js ctor
+-- lua new -- @function [parent=#ActionCamera] ActionCamera -- @param self -- @return ActionCamera#ActionCamera self (return value: cc.ActionCamera) diff --git a/cocos/scripting/lua-bindings/auto/api/Animate.lua b/cocos/scripting/lua-bindings/auto/api/Animate.lua index 53b00178a5..ebd60bcb0c 100644 --- a/cocos/scripting/lua-bindings/auto/api/Animate.lua +++ b/cocos/scripting/lua-bindings/auto/api/Animate.lua @@ -13,7 +13,7 @@ -------------------------------- -- Sets the Animation object to be animated
--- param A certain animation. +-- param animation certain animation. -- @function [parent=#Animate] setAnimation -- @param self -- @param #cc.Animation animation diff --git a/cocos/scripting/lua-bindings/auto/api/Animate3D.lua b/cocos/scripting/lua-bindings/auto/api/Animate3D.lua index 89055ce4af..c61dbdfebf 100644 --- a/cocos/scripting/lua-bindings/auto/api/Animate3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/Animate3D.lua @@ -10,6 +10,15 @@ -- @param self -- @return float#float ret (return value: float) +-------------------------------- +-- set high quality
+-- The default value is based on Configuration::isHighAnimate3DQuality(). You can configure it in the config.plist. However, you can modify it using the following function
+-- param true: is high quality, false: is low quality. +-- @function [parent=#Animate3D] setHighQuality +-- @param self +-- @param #bool isHighQuality +-- @return Animate3D#Animate3D self (return value: cc.Animate3D) + -------------------------------- -- -- @function [parent=#Animate3D] setWeight @@ -30,6 +39,13 @@ -- @param #float speed -- @return Animate3D#Animate3D self (return value: cc.Animate3D) +-------------------------------- +-- get high quality
+-- is it high quality +-- @function [parent=#Animate3D] isHighQuality +-- @param self +-- @return bool#bool ret (return value: bool) + -------------------------------- -- get & set origin interval -- @function [parent=#Animate3D] setOriginInterval diff --git a/cocos/scripting/lua-bindings/auto/api/AudioProfile.lua b/cocos/scripting/lua-bindings/auto/api/AudioProfile.lua index 210c2a99ec..6ac7bceb48 100644 --- a/cocos/scripting/lua-bindings/auto/api/AudioProfile.lua +++ b/cocos/scripting/lua-bindings/auto/api/AudioProfile.lua @@ -4,7 +4,8 @@ -- @parent_module ccexp -------------------------------- --- +-- Defautl constructor
+-- lua new -- @function [parent=#AudioProfile] AudioProfile -- @param self -- @return experimental::AudioProfile#experimental::AudioProfile self (return value: cc.experimental::AudioProfile) diff --git a/cocos/scripting/lua-bindings/auto/api/CSLoader.lua b/cocos/scripting/lua-bindings/auto/api/CSLoader.lua index 94879ba822..6d3bfd18aa 100644 --- a/cocos/scripting/lua-bindings/auto/api/CSLoader.lua +++ b/cocos/scripting/lua-bindings/auto/api/CSLoader.lua @@ -3,13 +3,6 @@ -- @module CSLoader -- @parent_module cc --------------------------------- --- --- @function [parent=#CSLoader] setJsonPath --- @param self --- @param #string jsonPath --- @return CSLoader#CSLoader self (return value: cc.CSLoader) - -------------------------------- -- -- @function [parent=#CSLoader] createNodeFromJson @@ -43,8 +36,9 @@ -------------------------------- -- --- @function [parent=#CSLoader] purge +-- @function [parent=#CSLoader] setJsonPath -- @param self +-- @param #string jsonPath -- @return CSLoader#CSLoader self (return value: cc.CSLoader) -------------------------------- diff --git a/cocos/scripting/lua-bindings/auto/api/CallFunc.lua b/cocos/scripting/lua-bindings/auto/api/CallFunc.lua index d53bf3019b..6c9d4edbcb 100644 --- a/cocos/scripting/lua-bindings/auto/api/CallFunc.lua +++ b/cocos/scripting/lua-bindings/auto/api/CallFunc.lua @@ -19,7 +19,7 @@ -------------------------------- -- Set the selector target.
--- param The selector target. +-- param sel The selector target. -- @function [parent=#CallFunc] setTargetCallback -- @param self -- @param #cc.Ref sel diff --git a/cocos/scripting/lua-bindings/auto/api/Camera.lua b/cocos/scripting/lua-bindings/auto/api/Camera.lua index cdee2e6022..cd0429362f 100644 --- a/cocos/scripting/lua-bindings/auto/api/Camera.lua +++ b/cocos/scripting/lua-bindings/auto/api/Camera.lua @@ -112,7 +112,6 @@ -- Creates an orthographic camera.
-- param zoomX The zoom factor along the X-axis of the orthographic projection (the width of the ortho projection).
-- param zoomY The zoom factor along the Y-axis of the orthographic projection (the height of the ortho projection).
--- param aspectRatio The aspect ratio of the orthographic projection.
-- param nearPlane The near plane distance.
-- param farPlane The far plane distance. -- @function [parent=#Camera] createOrthographic diff --git a/cocos/scripting/lua-bindings/auto/api/CheckBox.lua b/cocos/scripting/lua-bindings/auto/api/CheckBox.lua index 62ce6f7fcb..50b6f40b3f 100644 --- a/cocos/scripting/lua-bindings/auto/api/CheckBox.lua +++ b/cocos/scripting/lua-bindings/auto/api/CheckBox.lua @@ -43,11 +43,11 @@ -------------------------------- -- Load cross texture for checkbox.
--- param cross The cross texture name.
+-- param crossTextureName The cross texture name.
-- param texType @see `Widget::TextureResType` -- @function [parent=#CheckBox] loadTextureFrontCross -- @param self --- @param #string +-- @param #string crossTextureName -- @param #int texType -- @return CheckBox#CheckBox self (return value: ccui.CheckBox) @@ -60,17 +60,18 @@ -------------------------------- -- Load all textures for initializing a checkbox.
--- param backGround The background image name.
--- param backGroundSelected The background selected image name.
+-- param background The background image name.
+-- param backgroundSelected The background selected image name.
-- param cross The cross image name.
+-- param backgroundDisabled The background disabled state texture.
-- param frontCrossDisabled The front cross disabled state image name.
-- param texType @see `Widget::TextureResType` -- @function [parent=#CheckBox] loadTextures -- @param self --- @param #string backGround --- @param #string backGroundSelected +-- @param #string background +-- @param #string backgroundSelected -- @param #string cross --- @param #string backGroundDisabled +-- @param #string backgroundDisabled -- @param #string frontCrossDisabled -- @param #int texType -- @return CheckBox#CheckBox self (return value: ccui.CheckBox) @@ -86,7 +87,7 @@ -------------------------------- -- Load background texture for checkbox.
-- param backGround The background image name.
--- param texType @see `Widget::TextureResType` +-- param type @see `Widget::TextureResType` -- @function [parent=#CheckBox] loadTextureBackGround -- @param self -- @param #string backGround @@ -119,7 +120,7 @@ -- @function [parent=#CheckBox] create -- @param self -- @param #string backGround --- @param #string backGroundSeleted +-- @param #string backGroundSelected -- @param #string cross -- @param #string backGroundDisabled -- @param #string frontCrossDisabled @@ -151,7 +152,8 @@ -- @return size_table#size_table ret (return value: size_table) -------------------------------- --- Default constructor. +-- Default constructor.
+-- lua new -- @function [parent=#CheckBox] CheckBox -- @param self -- @return CheckBox#CheckBox self (return value: ccui.CheckBox) diff --git a/cocos/scripting/lua-bindings/auto/api/ClippingNode.lua b/cocos/scripting/lua-bindings/auto/api/ClippingNode.lua index 85a2363f4a..ff3e4e82b4 100644 --- a/cocos/scripting/lua-bindings/auto/api/ClippingNode.lua +++ b/cocos/scripting/lua-bindings/auto/api/ClippingNode.lua @@ -11,7 +11,8 @@ -- By default returns true if has any children attached.
-- return If you have custom stencil-based node with stencil drawing mechanics other then children-based,
-- then this method should return true every time you wish stencil to be visited.
--- By default returns true if has any children attached. +-- By default returns true if has any children attached.
+-- js NA -- @function [parent=#ClippingNode] hasContent -- @param self -- @return bool#bool ret (return value: bool) diff --git a/cocos/scripting/lua-bindings/auto/api/ControlColourPicker.lua b/cocos/scripting/lua-bindings/auto/api/ControlColourPicker.lua index b10fc29752..b93c2a77d8 100644 --- a/cocos/scripting/lua-bindings/auto/api/ControlColourPicker.lua +++ b/cocos/scripting/lua-bindings/auto/api/ControlColourPicker.lua @@ -86,7 +86,8 @@ -- @return ControlColourPicker#ControlColourPicker self (return value: cc.ControlColourPicker) -------------------------------- --- js ctor +-- js ctor
+-- lua new -- @function [parent=#ControlColourPicker] ControlColourPicker -- @param self -- @return ControlColourPicker#ControlColourPicker self (return value: cc.ControlColourPicker) diff --git a/cocos/scripting/lua-bindings/auto/api/ControlPotentiometer.lua b/cocos/scripting/lua-bindings/auto/api/ControlPotentiometer.lua index 2ca2721af1..6ec2b83998 100644 --- a/cocos/scripting/lua-bindings/auto/api/ControlPotentiometer.lua +++ b/cocos/scripting/lua-bindings/auto/api/ControlPotentiometer.lua @@ -180,7 +180,8 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- js ctor +-- js ctor
+-- lua new -- @function [parent=#ControlPotentiometer] ControlPotentiometer -- @param self -- @return ControlPotentiometer#ControlPotentiometer self (return value: cc.ControlPotentiometer) diff --git a/cocos/scripting/lua-bindings/auto/api/ControlSlider.lua b/cocos/scripting/lua-bindings/auto/api/ControlSlider.lua index bd91d8d55d..e38924f9c7 100644 --- a/cocos/scripting/lua-bindings/auto/api/ControlSlider.lua +++ b/cocos/scripting/lua-bindings/auto/api/ControlSlider.lua @@ -173,7 +173,8 @@ -- @return ControlSlider#ControlSlider self (return value: cc.ControlSlider) -------------------------------- --- js ctor +-- js ctor
+-- lua new -- @function [parent=#ControlSlider] ControlSlider -- @param self -- @return ControlSlider#ControlSlider self (return value: cc.ControlSlider) diff --git a/cocos/scripting/lua-bindings/auto/api/ControlStepper.lua b/cocos/scripting/lua-bindings/auto/api/ControlStepper.lua index 1d9ea06397..285238c55d 100644 --- a/cocos/scripting/lua-bindings/auto/api/ControlStepper.lua +++ b/cocos/scripting/lua-bindings/auto/api/ControlStepper.lua @@ -178,7 +178,8 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- js ctor +-- js ctor
+-- lua new -- @function [parent=#ControlStepper] ControlStepper -- @param self -- @return ControlStepper#ControlStepper self (return value: cc.ControlStepper) diff --git a/cocos/scripting/lua-bindings/auto/api/ControlSwitch.lua b/cocos/scripting/lua-bindings/auto/api/ControlSwitch.lua index 3d856b0d7e..0b123ff5a8 100644 --- a/cocos/scripting/lua-bindings/auto/api/ControlSwitch.lua +++ b/cocos/scripting/lua-bindings/auto/api/ControlSwitch.lua @@ -98,7 +98,8 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- js ctor +-- js ctor
+-- lua new -- @function [parent=#ControlSwitch] ControlSwitch -- @param self -- @return ControlSwitch#ControlSwitch self (return value: cc.ControlSwitch) diff --git a/cocos/scripting/lua-bindings/auto/api/DrawNode.lua b/cocos/scripting/lua-bindings/auto/api/DrawNode.lua index 78bdaae251..24536f4b5a 100644 --- a/cocos/scripting/lua-bindings/auto/api/DrawNode.lua +++ b/cocos/scripting/lua-bindings/auto/api/DrawNode.lua @@ -8,7 +8,8 @@ -- Draw an line from origin to destination with color.
-- param origin The line origin.
-- param destination The line destination.
--- param color The line color. +-- param color The line color.
+-- js NA -- @function [parent=#DrawNode] drawLine -- @param self -- @param #vec2_table origin @@ -43,7 +44,7 @@ -- @return DrawNode#DrawNode self (return value: cc.DrawNode) -------------------------------- --- +-- js NA -- @function [parent=#DrawNode] onDrawGLPoint -- @param self -- @param #mat4_table transform @@ -78,14 +79,13 @@ -------------------------------- -- Get the color mixed mode.
--- js NA
-- lua NA -- @function [parent=#DrawNode] getBlendFunc -- @param self -- @return BlendFunc#BlendFunc ret (return value: cc.BlendFunc) -------------------------------- --- +-- js NA -- @function [parent=#DrawNode] onDraw -- @param self -- @param #mat4_table transform @@ -124,7 +124,7 @@ -- @return DrawNode#DrawNode self (return value: cc.DrawNode) -------------------------------- --- +-- js NA -- @function [parent=#DrawNode] onDrawGLLine -- @param self -- @param #mat4_table transform @@ -136,7 +136,8 @@ -- param p1 The triangle vertex point.
-- param p2 The triangle vertex point.
-- param p3 The triangle vertex point.
--- param color The triangle color. +-- param color The triangle color.
+-- js NA -- @function [parent=#DrawNode] drawTriangle -- @param self -- @param #vec2_table p1 @@ -168,7 +169,8 @@ -- The origin and the destination can not have the same x and y coordinate.
-- param origin The rectangle origin.
-- param destination The rectangle destination.
--- param color The rectangle color. +-- param color The rectangle color.
+-- js NA -- @function [parent=#DrawNode] drawSolidRect -- @param self -- @param #vec2_table origin @@ -180,7 +182,8 @@ -- Draw a point.
-- param point A Vec2 used to point.
-- param pointSize The point size.
--- param color The point color. +-- param color The point color.
+-- js NA -- @function [parent=#DrawNode] drawPoint -- @param self -- @param #vec2_table point diff --git a/cocos/scripting/lua-bindings/auto/api/EditBox.lua b/cocos/scripting/lua-bindings/auto/api/EditBox.lua index 243a1be548..8a9748b9a7 100644 --- a/cocos/scripting/lua-bindings/auto/api/EditBox.lua +++ b/cocos/scripting/lua-bindings/auto/api/EditBox.lua @@ -284,7 +284,8 @@ -------------------------------- -- Constructor.
--- js ctor +-- js ctor
+-- lua new -- @function [parent=#EditBox] EditBox -- @param self -- @return EditBox#EditBox self (return value: ccui.EditBox) diff --git a/cocos/scripting/lua-bindings/auto/api/Grid3D.lua b/cocos/scripting/lua-bindings/auto/api/Grid3D.lua index d4af659274..cf644694af 100644 --- a/cocos/scripting/lua-bindings/auto/api/Grid3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/Grid3D.lua @@ -12,7 +12,8 @@ -------------------------------- -- @{
--- Getter and Setter for depth test state when blit. +-- Getter and Setter for depth test state when blit.
+-- js NA -- @function [parent=#Grid3D] setNeedDepthTestForBlit -- @param self -- @param #bool neededDepthTest diff --git a/cocos/scripting/lua-bindings/auto/api/GridBase.lua b/cocos/scripting/lua-bindings/auto/api/GridBase.lua index 60bcf145a1..9f356013c6 100644 --- a/cocos/scripting/lua-bindings/auto/api/GridBase.lua +++ b/cocos/scripting/lua-bindings/auto/api/GridBase.lua @@ -106,7 +106,8 @@ -------------------------------- -- @{
--- Interface for custom action when before or after draw. +-- Interface for custom action when before or after draw.
+-- js NA -- @function [parent=#GridBase] beforeBlit -- @param self -- @return GridBase#GridBase self (return value: cc.GridBase) diff --git a/cocos/scripting/lua-bindings/auto/api/HBox.lua b/cocos/scripting/lua-bindings/auto/api/HBox.lua index 5528dc16b4..2270c8036f 100644 --- a/cocos/scripting/lua-bindings/auto/api/HBox.lua +++ b/cocos/scripting/lua-bindings/auto/api/HBox.lua @@ -13,7 +13,9 @@ -- @return HBox#HBox ret (return value: ccui.HBox) -------------------------------- --- Default constructor +-- Default constructor
+-- js ctor
+-- lua new -- @function [parent=#HBox] HBox -- @param self -- @return HBox#HBox self (return value: ccui.HBox) diff --git a/cocos/scripting/lua-bindings/auto/api/Helper.lua b/cocos/scripting/lua-bindings/auto/api/Helper.lua index 518719a936..10cae69cf5 100644 --- a/cocos/scripting/lua-bindings/auto/api/Helper.lua +++ b/cocos/scripting/lua-bindings/auto/api/Helper.lua @@ -6,9 +6,11 @@ -------------------------------- -- brief Get a UTF8 substring from a std::string with a given start position and length
-- Sample: std::string str = "中国中国中国"; substr = getSubStringOfUTF8String(str,0,2) will = "中国"
+-- param str The source string.
-- param start The start position of the substring.
-- param length The length of the substring in UTF8 count
--- return a UTF8 substring +-- return a UTF8 substring
+-- js NA -- @function [parent=#Helper] getSubStringOfUTF8String -- @param self -- @param #string str diff --git a/cocos/scripting/lua-bindings/auto/api/ImageView.lua b/cocos/scripting/lua-bindings/auto/api/ImageView.lua index 0a6bec9a2a..61c84a2538 100644 --- a/cocos/scripting/lua-bindings/auto/api/ImageView.lua +++ b/cocos/scripting/lua-bindings/auto/api/ImageView.lua @@ -16,10 +16,10 @@ -------------------------------- -- Enable scale9 renderer.
--- param enable Set to true will use scale9 renderer, false otherwise. +-- param enabled Set to true will use scale9 renderer, false otherwise. -- @function [parent=#ImageView] setScale9Enabled -- @param self --- @param #bool able +-- @param #bool enabled -- @return ImageView#ImageView self (return value: ccui.ImageView) -------------------------------- @@ -95,7 +95,9 @@ -- @return ImageView#ImageView self (return value: ccui.ImageView) -------------------------------- --- Default constructor +-- Default constructor
+-- js ctor
+-- lua new -- @function [parent=#ImageView] ImageView -- @param self -- @return ImageView#ImageView self (return value: ccui.ImageView) diff --git a/cocos/scripting/lua-bindings/auto/api/LabelAtlas.lua b/cocos/scripting/lua-bindings/auto/api/LabelAtlas.lua index 59e970f112..05555c7610 100644 --- a/cocos/scripting/lua-bindings/auto/api/LabelAtlas.lua +++ b/cocos/scripting/lua-bindings/auto/api/LabelAtlas.lua @@ -50,7 +50,7 @@ -- @return LabelAtlas#LabelAtlas self (return value: cc.LabelAtlas) -------------------------------- --- +-- js NA -- @function [parent=#LabelAtlas] getDescription -- @param self -- @return string#string ret (return value: string) diff --git a/cocos/scripting/lua-bindings/auto/api/Layout.lua b/cocos/scripting/lua-bindings/auto/api/Layout.lua index 891a9362e8..4fd83e3178 100644 --- a/cocos/scripting/lua-bindings/auto/api/Layout.lua +++ b/cocos/scripting/lua-bindings/auto/api/Layout.lua @@ -269,7 +269,7 @@ -- @function [parent=#Layout] addChild -- @param self -- @param #cc.Node child --- @param #int zOrder +-- @param #int localZOrder -- @param #string name -- @return Layout#Layout self (return value: ccui.Layout) @@ -299,7 +299,7 @@ -------------------------------- -- When a widget is in a layout, you could call this method to get the next focused widget within a specified direction.
-- If the widget is not in a layout, it will return itself
--- param dir the direction to look for the next focused widget in a layout
+-- param direction the direction to look for the next focused widget in a layout
-- param current the current focused widget
-- return the next focused widget in a layout -- @function [parent=#Layout] findNextFocusedWidget @@ -317,7 +317,9 @@ -- @return Layout#Layout self (return value: ccui.Layout) -------------------------------- --- Default constructor +-- Default constructor
+-- js ctor
+-- lua new -- @function [parent=#Layout] Layout -- @param self -- @return Layout#Layout self (return value: ccui.Layout) diff --git a/cocos/scripting/lua-bindings/auto/api/LayoutComponent.lua b/cocos/scripting/lua-bindings/auto/api/LayoutComponent.lua index 86d5223fd2..9c969cc2f5 100644 --- a/cocos/scripting/lua-bindings/auto/api/LayoutComponent.lua +++ b/cocos/scripting/lua-bindings/auto/api/LayoutComponent.lua @@ -270,7 +270,7 @@ -------------------------------- -- Percent content size is used to adapt node's content size based on parent's content size.
--- If set to true then node's content size will be changed based on the value setted by @setPercentContentSize
+-- If set to true then node's content size will be changed based on the value setted by @see setPercentContentSize
-- param isUsed True to enable percent content size, false otherwise. -- @function [parent=#LayoutComponent] setUsingPercentContentSize -- @param self @@ -361,7 +361,7 @@ -------------------------------- -- Change the bottom margin of owner relative to its parent.
--- param Margin in float. +-- param margin in float. -- @function [parent=#LayoutComponent] setBottomMargin -- @param self -- @param #float margin @@ -399,7 +399,8 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- Default constructor +-- Default constructor
+-- lua new -- @function [parent=#LayoutComponent] LayoutComponent -- @param self -- @return LayoutComponent#LayoutComponent self (return value: ccui.LayoutComponent) diff --git a/cocos/scripting/lua-bindings/auto/api/LayoutParameter.lua b/cocos/scripting/lua-bindings/auto/api/LayoutParameter.lua index cc712bc405..30f19f152c 100644 --- a/cocos/scripting/lua-bindings/auto/api/LayoutParameter.lua +++ b/cocos/scripting/lua-bindings/auto/api/LayoutParameter.lua @@ -42,7 +42,8 @@ -- @return LayoutParameter#LayoutParameter ret (return value: ccui.LayoutParameter) -------------------------------- --- Default constructor. +-- Default constructor.
+-- lua new -- @function [parent=#LayoutParameter] LayoutParameter -- @param self -- @return LayoutParameter#LayoutParameter self (return value: ccui.LayoutParameter) diff --git a/cocos/scripting/lua-bindings/auto/api/LinearLayoutParameter.lua b/cocos/scripting/lua-bindings/auto/api/LinearLayoutParameter.lua index 2ed776c61c..c0f10cc0a9 100644 --- a/cocos/scripting/lua-bindings/auto/api/LinearLayoutParameter.lua +++ b/cocos/scripting/lua-bindings/auto/api/LinearLayoutParameter.lua @@ -42,7 +42,8 @@ -- @return LinearLayoutParameter#LinearLayoutParameter self (return value: ccui.LinearLayoutParameter) -------------------------------- --- Default constructor. +-- Default constructor.
+-- lua new -- @function [parent=#LinearLayoutParameter] LinearLayoutParameter -- @param self -- @return LinearLayoutParameter#LinearLayoutParameter self (return value: ccui.LinearLayoutParameter) diff --git a/cocos/scripting/lua-bindings/auto/api/ListView.lua b/cocos/scripting/lua-bindings/auto/api/ListView.lua index e1355fa505..039d642788 100644 --- a/cocos/scripting/lua-bindings/auto/api/ListView.lua +++ b/cocos/scripting/lua-bindings/auto/api/ListView.lua @@ -180,8 +180,8 @@ -------------------------------- -- Changes scroll direction of scrollview.
--- Direction Direction::VERTICAL means vertical scroll, Direction::HORIZONTAL means horizontal scroll
--- param dir, set the list view's scroll direction +-- Direction Direction::VERTICAL means vertical scroll, Direction::HORIZONTAL means horizontal scroll.
+-- param dir Set the list view's scroll direction. -- @function [parent=#ListView] setDirection -- @param self -- @param #int dir @@ -215,7 +215,9 @@ -- @return ListView#ListView self (return value: ccui.ListView) -------------------------------- --- Default constructor +-- Default constructor
+-- js ctor
+-- lua new -- @function [parent=#ListView] ListView -- @param self -- @return ListView#ListView self (return value: ccui.ListView) diff --git a/cocos/scripting/lua-bindings/auto/api/LoadingBar.lua b/cocos/scripting/lua-bindings/auto/api/LoadingBar.lua index 37cc143c85..1e4ef4d088 100644 --- a/cocos/scripting/lua-bindings/auto/api/LoadingBar.lua +++ b/cocos/scripting/lua-bindings/auto/api/LoadingBar.lua @@ -120,7 +120,9 @@ -- @return LoadingBar#LoadingBar self (return value: ccui.LoadingBar) -------------------------------- --- Default constructor. +-- Default constructor.
+-- js ctor
+-- lua new -- @function [parent=#LoadingBar] LoadingBar -- @param self -- @return LoadingBar#LoadingBar self (return value: ccui.LoadingBar) diff --git a/cocos/scripting/lua-bindings/auto/api/MenuItem.lua b/cocos/scripting/lua-bindings/auto/api/MenuItem.lua index 7244cca5a6..7d2af73f00 100644 --- a/cocos/scripting/lua-bindings/auto/api/MenuItem.lua +++ b/cocos/scripting/lua-bindings/auto/api/MenuItem.lua @@ -48,7 +48,7 @@ -- @return rect_table#rect_table ret (return value: rect_table) -------------------------------- --- +-- js NA -- @function [parent=#MenuItem] getDescription -- @param self -- @return string#string ret (return value: string) diff --git a/cocos/scripting/lua-bindings/auto/api/MenuItemFont.lua b/cocos/scripting/lua-bindings/auto/api/MenuItemFont.lua index ad05c3cc84..bfe0a7f05c 100644 --- a/cocos/scripting/lua-bindings/auto/api/MenuItemFont.lua +++ b/cocos/scripting/lua-bindings/auto/api/MenuItemFont.lua @@ -6,14 +6,16 @@ -------------------------------- -- get font size .
--- js getFontSize +-- js getFontSize
+-- js NA -- @function [parent=#MenuItemFont] getFontSizeObj -- @param self -- @return int#int ret (return value: int) -------------------------------- -- Returns the name of the Font.
--- js getFontNameObj +-- js getFontNameObj
+-- js NA -- @function [parent=#MenuItemFont] getFontNameObj -- @param self -- @return string#string ret (return value: string) @@ -22,7 +24,8 @@ -- Set font size.
-- c++ can not overload static and non-static member functions with the same parameter types.
-- so change the name to setFontSizeObj.
--- js setFontSize +-- js setFontSize
+-- js NA -- @function [parent=#MenuItemFont] setFontSizeObj -- @param self -- @param #int size @@ -32,7 +35,8 @@ -- Set the font name .
-- c++ can not overload static and non-static member functions with the same parameter types.
-- so change the name to setFontNameObj.
--- js setFontName +-- js setFontName
+-- js NA -- @function [parent=#MenuItemFont] setFontNameObj -- @param self -- @param #string name diff --git a/cocos/scripting/lua-bindings/auto/api/Node.lua b/cocos/scripting/lua-bindings/auto/api/Node.lua index 70586d979f..d44dbf8c9a 100644 --- a/cocos/scripting/lua-bindings/auto/api/Node.lua +++ b/cocos/scripting/lua-bindings/auto/api/Node.lua @@ -567,7 +567,7 @@ -- Executes an action, and returns the action that is executed.
-- This node becomes the action's target. Refer to Action::getTarget().
-- warning Actions don't retain their target.
--- param An Action pointer +-- param action An Action pointer. -- @function [parent=#Node] runAction -- @param self -- @param #cc.Action action diff --git a/cocos/scripting/lua-bindings/auto/api/PageView.lua b/cocos/scripting/lua-bindings/auto/api/PageView.lua index 81c7354f90..1b043cf5fb 100644 --- a/cocos/scripting/lua-bindings/auto/api/PageView.lua +++ b/cocos/scripting/lua-bindings/auto/api/PageView.lua @@ -166,7 +166,9 @@ -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- --- Default constructor +-- Default constructor
+-- js ctor
+-- lua new -- @function [parent=#PageView] PageView -- @param self -- @return PageView#PageView self (return value: ccui.PageView) diff --git a/cocos/scripting/lua-bindings/auto/api/ParticleSystem.lua b/cocos/scripting/lua-bindings/auto/api/ParticleSystem.lua index f1c39cdcae..5041ce11f1 100644 --- a/cocos/scripting/lua-bindings/auto/api/ParticleSystem.lua +++ b/cocos/scripting/lua-bindings/auto/api/ParticleSystem.lua @@ -390,7 +390,7 @@ -------------------------------- -- Sets the source position of the emitter.
--- param The source position of the emitter. +-- param pos The source position of the emitter. -- @function [parent=#ParticleSystem] setSourcePosition -- @param self -- @param #vec2_table pos @@ -713,7 +713,7 @@ -- This plist files can be created manually or with Particle Designer:
-- http:particledesigner.71squared.com/
-- since v2.0
--- param Particle plist file name.
+-- param plistFile Particle plist file name.
-- return An autoreleased ParticleSystem object. -- @function [parent=#ParticleSystem] create -- @param self diff --git a/cocos/scripting/lua-bindings/auto/api/PhysicsJointRatchet.lua b/cocos/scripting/lua-bindings/auto/api/PhysicsJointRatchet.lua index 9fd4eeeb2e..66a9fbce7b 100644 --- a/cocos/scripting/lua-bindings/auto/api/PhysicsJointRatchet.lua +++ b/cocos/scripting/lua-bindings/auto/api/PhysicsJointRatchet.lua @@ -37,14 +37,14 @@ -- @return float#float ret (return value: float) -------------------------------- --- Set the distance between “clicks”. +-- Set the distance between "clicks". -- @function [parent=#PhysicsJointRatchet] setRatchet -- @param self -- @param #float ratchet -- @return PhysicsJointRatchet#PhysicsJointRatchet self (return value: cc.PhysicsJointRatchet) -------------------------------- --- Get the distance between “clicks”. +-- Get the distance between "clicks". -- @function [parent=#PhysicsJointRatchet] getRatchet -- @param self -- @return float#float ret (return value: float) @@ -54,7 +54,7 @@ -- param a A is the body to connect.
-- param b B is the body to connect.
-- param phase Phase is the initial offset to use when deciding where the ratchet angles are.
--- param ratchet Ratchet is the distance between “clicks”.
+-- param ratchet Ratchet is the distance between "clicks".
-- return A object pointer. -- @function [parent=#PhysicsJointRatchet] construct -- @param self diff --git a/cocos/scripting/lua-bindings/auto/api/ProtectedNode.lua b/cocos/scripting/lua-bindings/auto/api/ProtectedNode.lua index 739ff8373c..edd24654f1 100644 --- a/cocos/scripting/lua-bindings/auto/api/ProtectedNode.lua +++ b/cocos/scripting/lua-bindings/auto/api/ProtectedNode.lua @@ -107,7 +107,7 @@ -- @return ProtectedNode#ProtectedNode self (return value: cc.ProtectedNode) -------------------------------- --- / @} end of Children and Parent +-- js NA -- @function [parent=#ProtectedNode] visit -- @param self -- @param #cc.Renderer renderer diff --git a/cocos/scripting/lua-bindings/auto/api/RelativeBox.lua b/cocos/scripting/lua-bindings/auto/api/RelativeBox.lua index 7f29537f61..3cd242fa2c 100644 --- a/cocos/scripting/lua-bindings/auto/api/RelativeBox.lua +++ b/cocos/scripting/lua-bindings/auto/api/RelativeBox.lua @@ -13,7 +13,9 @@ -- @return RelativeBox#RelativeBox ret (return value: ccui.RelativeBox) -------------------------------- --- Default constructor. +-- Default constructor.
+-- js ctor
+-- lua new -- @function [parent=#RelativeBox] RelativeBox -- @param self -- @return RelativeBox#RelativeBox self (return value: ccui.RelativeBox) diff --git a/cocos/scripting/lua-bindings/auto/api/RelativeLayoutParameter.lua b/cocos/scripting/lua-bindings/auto/api/RelativeLayoutParameter.lua index fe89501ce1..ba4c7e2fb1 100644 --- a/cocos/scripting/lua-bindings/auto/api/RelativeLayoutParameter.lua +++ b/cocos/scripting/lua-bindings/auto/api/RelativeLayoutParameter.lua @@ -72,7 +72,8 @@ -- @return RelativeLayoutParameter#RelativeLayoutParameter self (return value: ccui.RelativeLayoutParameter) -------------------------------- --- Default constructor +-- Default constructor
+-- lua new -- @function [parent=#RelativeLayoutParameter] RelativeLayoutParameter -- @param self -- @return RelativeLayoutParameter#RelativeLayoutParameter self (return value: ccui.RelativeLayoutParameter) diff --git a/cocos/scripting/lua-bindings/auto/api/RenderTexture.lua b/cocos/scripting/lua-bindings/auto/api/RenderTexture.lua index 405814eee4..8e57c879c4 100644 --- a/cocos/scripting/lua-bindings/auto/api/RenderTexture.lua +++ b/cocos/scripting/lua-bindings/auto/api/RenderTexture.lua @@ -77,7 +77,8 @@ -------------------------------- -- Flag: Use stack matrix computed from scene hierarchy or generate new modelView and projection matrix.
--- param keepMatrix Wether or not use stack matrix computed from scene hierarchy or generate new modelView and projection matrix. +-- param keepMatrix Wether or not use stack matrix computed from scene hierarchy or generate new modelView and projection matrix.
+-- js NA -- @function [parent=#RenderTexture] setKeepMatrix -- @param self -- @param #bool keepMatrix @@ -125,7 +126,8 @@ -- @return RenderTexture#RenderTexture self (return value: cc.RenderTexture) -------------------------------- --- End is key word of lua, use other name to export to lua. +-- End is key word of lua, use other name to export to lua.
+-- js NA -- @function [parent=#RenderTexture] endToLua -- @param self -- @return RenderTexture#RenderTexture self (return value: cc.RenderTexture) @@ -238,7 +240,8 @@ -------------------------------- -- FIXME: should be procted.
-- but due to a bug in PowerVR + Android,
--- the constructor is public again. +-- the constructor is public again.
+-- js ctor -- @function [parent=#RenderTexture] RenderTexture -- @param self -- @return RenderTexture#RenderTexture self (return value: cc.RenderTexture) diff --git a/cocos/scripting/lua-bindings/auto/api/RichElement.lua b/cocos/scripting/lua-bindings/auto/api/RichElement.lua index 1c80dd940d..e6872d3ac3 100644 --- a/cocos/scripting/lua-bindings/auto/api/RichElement.lua +++ b/cocos/scripting/lua-bindings/auto/api/RichElement.lua @@ -18,7 +18,9 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- brief Default constructor. +-- brief Default constructor.
+-- js ctor
+-- lua new -- @function [parent=#RichElement] RichElement -- @param self -- @return RichElement#RichElement self (return value: ccui.RichElement) diff --git a/cocos/scripting/lua-bindings/auto/api/RichElementCustomNode.lua b/cocos/scripting/lua-bindings/auto/api/RichElementCustomNode.lua index 84785c59ce..88b45423c5 100644 --- a/cocos/scripting/lua-bindings/auto/api/RichElementCustomNode.lua +++ b/cocos/scripting/lua-bindings/auto/api/RichElementCustomNode.lua @@ -35,7 +35,9 @@ -- @return RichElementCustomNode#RichElementCustomNode ret (return value: ccui.RichElementCustomNode) -------------------------------- --- brief Default constructor. +-- brief Default constructor.
+-- js ctor
+-- lua new -- @function [parent=#RichElementCustomNode] RichElementCustomNode -- @param self -- @return RichElementCustomNode#RichElementCustomNode self (return value: ccui.RichElementCustomNode) diff --git a/cocos/scripting/lua-bindings/auto/api/RichElementImage.lua b/cocos/scripting/lua-bindings/auto/api/RichElementImage.lua index 0d1b9fb8d3..89fd4698ac 100644 --- a/cocos/scripting/lua-bindings/auto/api/RichElementImage.lua +++ b/cocos/scripting/lua-bindings/auto/api/RichElementImage.lua @@ -35,7 +35,9 @@ -- @return RichElementImage#RichElementImage ret (return value: ccui.RichElementImage) -------------------------------- --- brief Default constructor. +-- brief Default constructor.
+-- js ctor
+-- lua new -- @function [parent=#RichElementImage] RichElementImage -- @param self -- @return RichElementImage#RichElementImage self (return value: ccui.RichElementImage) diff --git a/cocos/scripting/lua-bindings/auto/api/RichElementText.lua b/cocos/scripting/lua-bindings/auto/api/RichElementText.lua index 7bca93fc4f..68d7587641 100644 --- a/cocos/scripting/lua-bindings/auto/api/RichElementText.lua +++ b/cocos/scripting/lua-bindings/auto/api/RichElementText.lua @@ -43,7 +43,9 @@ -- @return RichElementText#RichElementText ret (return value: ccui.RichElementText) -------------------------------- --- brief Default constructor. +-- brief Default constructor.
+-- js ctor
+-- lua new -- @function [parent=#RichElementText] RichElementText -- @param self -- @return RichElementText#RichElementText self (return value: ccui.RichElementText) diff --git a/cocos/scripting/lua-bindings/auto/api/RichText.lua b/cocos/scripting/lua-bindings/auto/api/RichText.lua index 5d9db788d1..a14053d996 100644 --- a/cocos/scripting/lua-bindings/auto/api/RichText.lua +++ b/cocos/scripting/lua-bindings/auto/api/RichText.lua @@ -79,7 +79,9 @@ -- @return RichText#RichText self (return value: ccui.RichText) -------------------------------- --- brief Default constructor. +-- brief Default constructor.
+-- js ctor
+-- lua new -- @function [parent=#RichText] RichText -- @param self -- @return RichText#RichText self (return value: ccui.RichText) diff --git a/cocos/scripting/lua-bindings/auto/api/RotateTo.lua b/cocos/scripting/lua-bindings/auto/api/RotateTo.lua index cd9e646b14..9ce04ca45f 100644 --- a/cocos/scripting/lua-bindings/auto/api/RotateTo.lua +++ b/cocos/scripting/lua-bindings/auto/api/RotateTo.lua @@ -35,7 +35,7 @@ -- @return RotateTo#RotateTo ret (return value: cc.RotateTo) -------------------------------- --- param dt In seconds. +-- param time In seconds. -- @function [parent=#RotateTo] update -- @param self -- @param #float time diff --git a/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua b/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua index c899f5615a..0796f9f441 100644 --- a/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua +++ b/cocos/scripting/lua-bindings/auto/api/Scale9Sprite.lua @@ -37,7 +37,8 @@ -------------------------------- -- brief Toggle 9-slice feature.
-- If Scale9Sprite is 9-slice disabled, the Scale9Sprite will rendered as a normal sprite.
--- param enabled True to enable 9-slice, false otherwise. +-- param enabled True to enable 9-slice, false otherwise.
+-- js NA -- @function [parent=#Scale9Sprite] setScale9Enabled -- @param self -- @param #bool enabled @@ -177,7 +178,8 @@ -------------------------------- -- brief Query whether the Scale9Sprite is enable 9-slice or not.
--- return True if 9-slice is enabled, false otherwise. +-- return True if 9-slice is enabled, false otherwise.
+-- js NA -- @function [parent=#Scale9Sprite] isScale9Enabled -- @param self -- @return bool#bool ret (return value: bool) @@ -399,7 +401,8 @@ -------------------------------- -- Default constructor.
--- js ctor +-- js ctor
+-- lua new -- @function [parent=#Scale9Sprite] Scale9Sprite -- @param self -- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite) diff --git a/cocos/scripting/lua-bindings/auto/api/ScrollView.lua b/cocos/scripting/lua-bindings/auto/api/ScrollView.lua index 8475087a17..d08fc51673 100644 --- a/cocos/scripting/lua-bindings/auto/api/ScrollView.lua +++ b/cocos/scripting/lua-bindings/auto/api/ScrollView.lua @@ -134,7 +134,7 @@ -------------------------------- -- Move inner container to vertical percent position of scrollview.
--- param A value between 0 and 100. +-- param percent A value between 0 and 100. -- @function [parent=#ScrollView] jumpToPercentVertical -- @param self -- @param #float percent @@ -164,7 +164,7 @@ -------------------------------- -- Move inner container to horizontal percent position of scrollview.
--- param A value between 0 and 100. +-- param percent A value between 0 and 100. -- @function [parent=#ScrollView] jumpToPercentHorizontal -- @param self -- @param #float percent @@ -202,7 +202,7 @@ -------------------------------- -- Move inner container to both direction percent position of scrollview.
--- param A value between 0 and 100. +-- param percent A value between 0 and 100. -- @function [parent=#ScrollView] jumpToPercentBothDirection -- @param self -- @param #vec2_table percent @@ -293,7 +293,7 @@ -- @function [parent=#ScrollView] addChild -- @param self -- @param #cc.Node child --- @param #int zOrder +-- @param #int localZOrder -- @param #string name -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) @@ -341,7 +341,7 @@ -------------------------------- -- When a widget is in a layout, you could call this method to get the next focused widget within a specified direction.
-- If the widget is not in a layout, it will return itself
--- param dir the direction to look for the next focused widget in a layout
+-- param direction the direction to look for the next focused widget in a layout
-- param current the current focused widget
-- return the next focused widget in a layout -- @function [parent=#ScrollView] findNextFocusedWidget @@ -388,7 +388,9 @@ -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) -------------------------------- --- Default constructor +-- Default constructor
+-- js ctor
+-- lua new -- @function [parent=#ScrollView] ScrollView -- @param self -- @return ScrollView#ScrollView self (return value: ccui.ScrollView) diff --git a/cocos/scripting/lua-bindings/auto/api/SimpleAudioEngine.lua b/cocos/scripting/lua-bindings/auto/api/SimpleAudioEngine.lua index 2e39eb2a6a..7c7876b54d 100644 --- a/cocos/scripting/lua-bindings/auto/api/SimpleAudioEngine.lua +++ b/cocos/scripting/lua-bindings/auto/api/SimpleAudioEngine.lua @@ -190,7 +190,8 @@ -------------------------------- -- Release the shared Engine object.
--- warning It must be called before the application exit, or it will lead to memory leaks. +-- warning It must be called before the application exit, or it will lead to memory leaks.
+-- lua destroyInstance -- @function [parent=#SimpleAudioEngine] end -- @param self -- @return SimpleAudioEngine#SimpleAudioEngine self (return value: cc.SimpleAudioEngine) diff --git a/cocos/scripting/lua-bindings/auto/api/Skybox.lua b/cocos/scripting/lua-bindings/auto/api/Skybox.lua new file mode 100644 index 0000000000..4567cd1a15 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/Skybox.lua @@ -0,0 +1,42 @@ + +-------------------------------- +-- @module Skybox +-- @extend Node +-- @parent_module cc + +-------------------------------- +-- reload sky box after GLESContext reconstructed. +-- @function [parent=#Skybox] reload +-- @param self +-- @return Skybox#Skybox self (return value: cc.Skybox) + +-------------------------------- +-- texture getter and setter +-- @function [parent=#Skybox] setTexture +-- @param self +-- @param #cc.TextureCube +-- @return Skybox#Skybox self (return value: cc.Skybox) + +-------------------------------- +-- @overload self, string, string, string, string, string, string +-- @overload self +-- @function [parent=#Skybox] create +-- @param self +-- @param #string positive_x +-- @param #string negative_x +-- @param #string positive_y +-- @param #string negative_y +-- @param #string positive_z +-- @param #string negative_z +-- @return Skybox#Skybox ret (return value: cc.Skybox) + +-------------------------------- +-- draw Skybox object +-- @function [parent=#Skybox] draw +-- @param self +-- @param #cc.Renderer renderer +-- @param #mat4_table transform +-- @param #unsigned int flags +-- @return Skybox#Skybox self (return value: cc.Skybox) + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/Slider.lua b/cocos/scripting/lua-bindings/auto/api/Slider.lua index def104a552..a99d8f2025 100644 --- a/cocos/scripting/lua-bindings/auto/api/Slider.lua +++ b/cocos/scripting/lua-bindings/auto/api/Slider.lua @@ -68,7 +68,8 @@ -------------------------------- -- Sets capinsets for progress bar slider, if slider is using scale9 renderer.
--- param capInsets Capinsets for progress bar slider. +-- param capInsets Capinsets for progress bar slider.
+-- js NA -- @function [parent=#Slider] setCapInsetProgressBarRebderer -- @param self -- @param #rect_table capInsets @@ -84,7 +85,8 @@ -------------------------------- -- Gets capinsets for progress bar slider, if slider is using scale9 renderer.
--- return Capinsets for progress bar slider. +-- return Capinsets for progress bar slider.
+-- js NA -- @function [parent=#Slider] getCapInsetsProgressBarRebderer -- @param self -- @return rect_table#rect_table ret (return value: rect_table) @@ -122,7 +124,8 @@ -- @return float#float ret (return value: float) -------------------------------- --- +-- Add call back function called when slider's percent has changed to slider.
+-- param callback An given call back function called when slider's percent has changed to slider. -- @function [parent=#Slider] addEventListener -- @param self -- @param #function callback @@ -208,7 +211,9 @@ -- @return size_table#size_table ret (return value: size_table) -------------------------------- --- Default constructor. +-- Default constructor.
+-- js ctor
+-- lua new -- @function [parent=#Slider] Slider -- @param self -- @return Slider#Slider self (return value: ccui.Slider) diff --git a/cocos/scripting/lua-bindings/auto/api/Spawn.lua b/cocos/scripting/lua-bindings/auto/api/Spawn.lua index 99efefbfa8..8d347ba025 100644 --- a/cocos/scripting/lua-bindings/auto/api/Spawn.lua +++ b/cocos/scripting/lua-bindings/auto/api/Spawn.lua @@ -30,7 +30,7 @@ -- @return Spawn#Spawn ret (return value: cc.Spawn) -------------------------------- --- param dt In seconds. +-- param time In seconds. -- @function [parent=#Spawn] update -- @param self -- @param #float time diff --git a/cocos/scripting/lua-bindings/auto/api/Sprite.lua b/cocos/scripting/lua-bindings/auto/api/Sprite.lua index 62bf4447d5..28e025956e 100644 --- a/cocos/scripting/lua-bindings/auto/api/Sprite.lua +++ b/cocos/scripting/lua-bindings/auto/api/Sprite.lua @@ -331,7 +331,7 @@ -- @return Sprite#Sprite self (return value: cc.Sprite) -------------------------------- --- / @} +-- js NA -- @function [parent=#Sprite] getDescription -- @param self -- @return string#string ret (return value: string) diff --git a/cocos/scripting/lua-bindings/auto/api/SpriteBatchNode.lua b/cocos/scripting/lua-bindings/auto/api/SpriteBatchNode.lua index 6c5b2bad10..7f915f5ccf 100644 --- a/cocos/scripting/lua-bindings/auto/api/SpriteBatchNode.lua +++ b/cocos/scripting/lua-bindings/auto/api/SpriteBatchNode.lua @@ -29,14 +29,13 @@ -- @return SpriteBatchNode#SpriteBatchNode self (return value: cc.SpriteBatchNode) -------------------------------- --- +-- js NA -- @function [parent=#SpriteBatchNode] removeAllChildrenWithCleanup -- @param self -- @param #bool cleanup -- @return SpriteBatchNode#SpriteBatchNode self (return value: cc.SpriteBatchNode) -------------------------------- --- js NA
-- lua NA -- @function [parent=#SpriteBatchNode] getBlendFunc -- @param self @@ -192,7 +191,7 @@ -- @return SpriteBatchNode#SpriteBatchNode self (return value: cc.SpriteBatchNode) -------------------------------- --- +-- js NA -- @function [parent=#SpriteBatchNode] draw -- @param self -- @param #cc.Renderer renderer @@ -201,13 +200,13 @@ -- @return SpriteBatchNode#SpriteBatchNode self (return value: cc.SpriteBatchNode) -------------------------------- --- +-- js NA -- @function [parent=#SpriteBatchNode] getDescription -- @param self -- @return string#string ret (return value: string) -------------------------------- --- +-- js NA -- @function [parent=#SpriteBatchNode] visit -- @param self -- @param #cc.Renderer renderer diff --git a/cocos/scripting/lua-bindings/auto/api/SpriteFrame.lua b/cocos/scripting/lua-bindings/auto/api/SpriteFrame.lua index 68acc861d4..a7b9dc0f9a 100644 --- a/cocos/scripting/lua-bindings/auto/api/SpriteFrame.lua +++ b/cocos/scripting/lua-bindings/auto/api/SpriteFrame.lua @@ -110,7 +110,7 @@ -------------------------------- -- Set rect of the frame.
--- param The rect of the sprite. +-- param rect The rect of the sprite. -- @function [parent=#SpriteFrame] setRect -- @param self -- @param #rect_table rect diff --git a/cocos/scripting/lua-bindings/auto/api/TMXObjectGroup.lua b/cocos/scripting/lua-bindings/auto/api/TMXObjectGroup.lua index 988021b4cd..4e2d4073a1 100644 --- a/cocos/scripting/lua-bindings/auto/api/TMXObjectGroup.lua +++ b/cocos/scripting/lua-bindings/auto/api/TMXObjectGroup.lua @@ -15,7 +15,8 @@ -------------------------------- -- Return the value for the specific property name.
-- param propertyName The specific property name.
--- return Return the value for the specific property name. +-- return Return the value for the specific property name.
+-- js NA -- @function [parent=#TMXObjectGroup] getProperty -- @param self -- @param #string propertyName diff --git a/cocos/scripting/lua-bindings/auto/api/TableView.lua b/cocos/scripting/lua-bindings/auto/api/TableView.lua index 6d9ee2d8dd..06af430bec 100644 --- a/cocos/scripting/lua-bindings/auto/api/TableView.lua +++ b/cocos/scripting/lua-bindings/auto/api/TableView.lua @@ -124,7 +124,8 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- js ctor +-- js ctor
+-- lua new -- @function [parent=#TableView] TableView -- @param self -- @return TableView#TableView self (return value: cc.TableView) diff --git a/cocos/scripting/lua-bindings/auto/api/Text.lua b/cocos/scripting/lua-bindings/auto/api/Text.lua index dd6a6f6d0f..13a927f33b 100644 --- a/cocos/scripting/lua-bindings/auto/api/Text.lua +++ b/cocos/scripting/lua-bindings/auto/api/Text.lua @@ -222,7 +222,9 @@ -- @return size_table#size_table ret (return value: size_table) -------------------------------- --- Default constructor. +-- Default constructor.
+-- js ctor
+-- lua new -- @function [parent=#Text] Text -- @param self -- @return Text#Text self (return value: ccui.Text) diff --git a/cocos/scripting/lua-bindings/auto/api/TextAtlas.lua b/cocos/scripting/lua-bindings/auto/api/TextAtlas.lua index 45b6ace787..a1b2c1e83b 100644 --- a/cocos/scripting/lua-bindings/auto/api/TextAtlas.lua +++ b/cocos/scripting/lua-bindings/auto/api/TextAtlas.lua @@ -43,7 +43,7 @@ -- @return TextAtlas#TextAtlas self (return value: ccui.TextAtlas) -------------------------------- --- +-- js NA -- @function [parent=#TextAtlas] adaptRenderers -- @param self -- @return TextAtlas#TextAtlas self (return value: ccui.TextAtlas) @@ -85,7 +85,8 @@ -- @return size_table#size_table ret (return value: size_table) -------------------------------- --- Default constructor. +-- Default constructor.
+-- lua new -- @function [parent=#TextAtlas] TextAtlas -- @param self -- @return TextAtlas#TextAtlas self (return value: ccui.TextAtlas) diff --git a/cocos/scripting/lua-bindings/auto/api/TextBMFont.lua b/cocos/scripting/lua-bindings/auto/api/TextBMFont.lua index bd60f4ccb1..0d65d3eeb3 100644 --- a/cocos/scripting/lua-bindings/auto/api/TextBMFont.lua +++ b/cocos/scripting/lua-bindings/auto/api/TextBMFont.lua @@ -67,7 +67,9 @@ -- @return size_table#size_table ret (return value: size_table) -------------------------------- --- Default constructor +-- Default constructor
+-- js ctor
+-- lua new -- @function [parent=#TextBMFont] TextBMFont -- @param self -- @return TextBMFont#TextBMFont self (return value: ccui.TextBMFont) diff --git a/cocos/scripting/lua-bindings/auto/api/TextureCube.lua b/cocos/scripting/lua-bindings/auto/api/TextureCube.lua new file mode 100644 index 0000000000..1430554d79 --- /dev/null +++ b/cocos/scripting/lua-bindings/auto/api/TextureCube.lua @@ -0,0 +1,40 @@ + +-------------------------------- +-- @module TextureCube +-- @extend Texture2D +-- @parent_module cc + +-------------------------------- +-- reload texture cube after GLESContext reconstructed. +-- @function [parent=#TextureCube] reloadTexture +-- @param self +-- @return bool#bool ret (return value: bool) + +-------------------------------- +-- Sets the min filter, mag filter, wrap s and wrap t texture parameters.
+-- If the texture size is NPOT (non power of 2), then in can only use GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}. +-- @function [parent=#TextureCube] setTexParameters +-- @param self +-- @param #cc.Texture2D::_TexParams +-- @return TextureCube#TextureCube self (return value: cc.TextureCube) + +-------------------------------- +-- create cube texture from 6 textures.
+-- param positive_x texture for the right side of the texture cube face.
+-- param negative_x texture for the up side of the texture cube face.
+-- param positive_y texture for the top side of the texture cube face
+-- param negative_y texture for the bottom side of the texture cube face
+-- param positive_z texture for the forward side of the texture cube face.
+-- param negative_z texture for the rear side of the texture cube face.
+-- return A new texture cube inited with given parameters. +-- @function [parent=#TextureCube] create +-- @param self +-- @param #string positive_x +-- @param #string negative_x +-- @param #string positive_y +-- @param #string negative_y +-- @param #string positive_z +-- @param #string negative_z +-- @return TextureCube#TextureCube ret (return value: cc.TextureCube) + +return nil diff --git a/cocos/scripting/lua-bindings/auto/api/TransitionPageTurn.lua b/cocos/scripting/lua-bindings/auto/api/TransitionPageTurn.lua index 5677033f1b..59185cd4a1 100644 --- a/cocos/scripting/lua-bindings/auto/api/TransitionPageTurn.lua +++ b/cocos/scripting/lua-bindings/auto/api/TransitionPageTurn.lua @@ -6,7 +6,7 @@ -------------------------------- -- Returns the action that will be performed with size.
--- param size A given size.
+-- param vector A given size.
-- return The action that will be performed. -- @function [parent=#TransitionPageTurn] actionWithSize -- @param self diff --git a/cocos/scripting/lua-bindings/auto/api/VBox.lua b/cocos/scripting/lua-bindings/auto/api/VBox.lua index a822f31d03..6829e59e47 100644 --- a/cocos/scripting/lua-bindings/auto/api/VBox.lua +++ b/cocos/scripting/lua-bindings/auto/api/VBox.lua @@ -13,7 +13,9 @@ -- @return VBox#VBox ret (return value: ccui.VBox) -------------------------------- --- Default constructor +-- Default constructor
+-- js ctor
+-- lua new -- @function [parent=#VBox] VBox -- @param self -- @return VBox#VBox self (return value: ccui.VBox) diff --git a/cocos/scripting/lua-bindings/auto/api/VideoPlayer.lua b/cocos/scripting/lua-bindings/auto/api/VideoPlayer.lua index 2e8c702abc..58eda612c5 100644 --- a/cocos/scripting/lua-bindings/auto/api/VideoPlayer.lua +++ b/cocos/scripting/lua-bindings/auto/api/VideoPlayer.lua @@ -5,13 +5,15 @@ -- @parent_module ccexp -------------------------------- --- +-- brief Get the local video filie name.
+-- return The video file name. -- @function [parent=#VideoPlayer] getFileName -- @param self -- @return string#string ret (return value: string) -------------------------------- --- +-- brief Get the URL of remoting video source.
+-- return A remoting URL address. -- @function [parent=#VideoPlayer] getURL -- @param self -- @return string#string ret (return value: string) @@ -78,7 +80,8 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- +-- brief A function which will be called when video is playing.
+-- param event @see VideoPlayer::EventType. -- @function [parent=#VideoPlayer] onPlayEvent -- @param self -- @param #int event diff --git a/cocos/scripting/lua-bindings/auto/api/Widget.lua b/cocos/scripting/lua-bindings/auto/api/Widget.lua index dfecd58342..09c7d76a4d 100644 --- a/cocos/scripting/lua-bindings/auto/api/Widget.lua +++ b/cocos/scripting/lua-bindings/auto/api/Widget.lua @@ -37,7 +37,7 @@ -------------------------------- -- Sets whether the widget should be flipped horizontally or not.
--- param bFlippedX true if the widget should be flipped horizaontally, false otherwise. +-- param flippedX true if the widget should be flipped horizaontally, false otherwise. -- @function [parent=#Widget] setFlippedX -- @param self -- @param #bool flippedX @@ -150,7 +150,6 @@ -------------------------------- -- Gets LayoutParameter of widget.
-- see LayoutParameter
--- param type Relative or Linear
-- return LayoutParameter -- @function [parent=#Widget] getLayoutParameter -- @param self @@ -175,7 +174,7 @@ -- Toggle whether ignore user defined content size for widget.
-- Set true will ignore user defined content size which means
-- the widget size is always equal to the return value of `getVirtualRendererSize`.
--- param ignore, set member variabl _ignoreSize to ignore +-- param ignore set member variabl _ignoreSize to ignore -- @function [parent=#Widget] ignoreContentAdaptWithSize -- @param self -- @param #bool ignore @@ -184,7 +183,7 @@ -------------------------------- -- When a widget is in a layout, you could call this method to get the next focused widget within a specified direction.
-- If the widget is not in a layout, it will return itself
--- param dir the direction to look for the next focused widget in a layout
+-- param direction the direction to look for the next focused widget in a layout
-- param current the current focused widget
-- return the next focused widget in a layout -- @function [parent=#Widget] findNextFocusedWidget @@ -267,9 +266,9 @@ -- @return Widget#Widget self (return value: ccui.Widget) -------------------------------- --- Sets whether the widget is touch enabled
--- The default value is false, a widget is default to touch disabled
--- param visible true if the widget is touch enabled, false if the widget is touch disabled. +-- Sets whether the widget is touch enabled.
+-- The default value is false, a widget is default to touch disabled.
+-- param enabled True if the widget is touch enabled, false if the widget is touch disabled. -- @function [parent=#Widget] setTouchEnabled -- @param self -- @param #bool enabled @@ -277,7 +276,7 @@ -------------------------------- -- Sets whether the widget should be flipped vertically or not.
--- param bFlippedY true if the widget should be flipped vertically, flase otherwise. +-- param flippedY true if the widget should be flipped vertically, flase otherwise. -- @function [parent=#Widget] setFlippedY -- @param self -- @param #bool flippedY @@ -313,8 +312,7 @@ -------------------------------- -- Sets a LayoutParameter to widget.
-- see LayoutParameter
--- param LayoutParameter pointer
--- param type Relative or Linear +-- param parameter LayoutParameter pointer -- @function [parent=#Widget] setLayoutParameter -- @param self -- @param #ccui.LayoutParameter parameter @@ -413,8 +411,7 @@ -------------------------------- -- Gets the size type of widget.
--- see `SizeType`
--- param type that is widget's size type +-- see `SizeType` -- @function [parent=#Widget] getSizeType -- @param self -- @return int#int ret (return value: int) @@ -462,7 +459,7 @@ -------------------------------- -- Checks a point if in parent's area.
--- param point A point in `Vec2`.
+-- param pt A point in `Vec2`.
-- return true if the point is in parent's area, flase otherwise. -- @function [parent=#Widget] isClippingParentContainsPoint -- @param self @@ -481,7 +478,7 @@ -------------------------------- -- Sets whether the widget is bright
-- The default value is true, a widget is default to bright
--- param visible true if the widget is bright, false if the widget is dark. +-- param bright true if the widget is bright, false if the widget is dark. -- @function [parent=#Widget] setBright -- @param self -- @param #bool bright @@ -562,7 +559,7 @@ -- Changes the position (x,y) of the widget in OpenGL coordinates
-- Usually we use p(x,y) to compose a Vec2 object.
-- The original point (0,0) is at the left-bottom corner of screen.
--- param position The position (x,y) of the widget in OpenGL coordinates +-- param pos The position (x,y) of the widget in OpenGL coordinates -- @function [parent=#Widget] setPosition -- @param self -- @param #vec2_table pos @@ -583,7 +580,9 @@ -- @return float#float ret (return value: float) -------------------------------- --- Default constructor +-- Default constructor
+-- js ctor
+-- lua new -- @function [parent=#Widget] Widget -- @param self -- @return Widget#Widget self (return value: ccui.Widget) diff --git a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_3d_auto_api.lua b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_3d_auto_api.lua index 355592bcc8..2c5598932b 100644 --- a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_3d_auto_api.lua +++ b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_3d_auto_api.lua @@ -41,4 +41,14 @@ -- @field [parent=#cc] BillBoard#BillBoard BillBoard preloaded module +-------------------------------------------------------- +-- the cc TextureCube +-- @field [parent=#cc] TextureCube#TextureCube TextureCube preloaded module + + +-------------------------------------------------------- +-- the cc Skybox +-- @field [parent=#cc] Skybox#Skybox Skybox preloaded module + + return nil 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 173d11db24..f98a0d603c 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp @@ -2174,6 +2174,56 @@ int lua_cocos2dx_3d_Animate3D_getSpeed(lua_State* tolua_S) return 0; } +int lua_cocos2dx_3d_Animate3D_setHighQuality(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Animate3D_setHighQuality'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Animate3D:setHighQuality"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Animate3D_setHighQuality'", nullptr); + return 0; + } + cobj->setHighQuality(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Animate3D:setHighQuality",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Animate3D_setHighQuality'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_3d_Animate3D_setWeight(lua_State* tolua_S) { int argc = 0; @@ -2321,6 +2371,53 @@ int lua_cocos2dx_3d_Animate3D_setSpeed(lua_State* tolua_S) return 0; } +int lua_cocos2dx_3d_Animate3D_isHighQuality(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Animate3D* 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.Animate3D",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Animate3D_isHighQuality'", 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_Animate3D_isHighQuality'", nullptr); + return 0; + } + bool ret = cobj->isHighQuality(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Animate3D:isHighQuality",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Animate3D_isHighQuality'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_3d_Animate3D_setOriginInterval(lua_State* tolua_S) { int argc = 0; @@ -2614,9 +2711,11 @@ int lua_register_cocos2dx_3d_Animate3D(lua_State* tolua_S) tolua_beginmodule(tolua_S,"Animate3D"); tolua_function(tolua_S,"getSpeed",lua_cocos2dx_3d_Animate3D_getSpeed); + tolua_function(tolua_S,"setHighQuality",lua_cocos2dx_3d_Animate3D_setHighQuality); tolua_function(tolua_S,"setWeight",lua_cocos2dx_3d_Animate3D_setWeight); tolua_function(tolua_S,"getOriginInterval",lua_cocos2dx_3d_Animate3D_getOriginInterval); tolua_function(tolua_S,"setSpeed",lua_cocos2dx_3d_Animate3D_setSpeed); + tolua_function(tolua_S,"isHighQuality",lua_cocos2dx_3d_Animate3D_isHighQuality); tolua_function(tolua_S,"setOriginInterval",lua_cocos2dx_3d_Animate3D_setOriginInterval); tolua_function(tolua_S,"getWeight",lua_cocos2dx_3d_Animate3D_getWeight); tolua_function(tolua_S,"create", lua_cocos2dx_3d_Animate3D_create); @@ -2965,6 +3064,350 @@ int lua_register_cocos2dx_3d_BillBoard(lua_State* tolua_S) g_typeCast["BillBoard"] = "cc.BillBoard"; return 1; } + +int lua_cocos2dx_3d_TextureCube_reloadTexture(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TextureCube* 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.TextureCube",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::TextureCube*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_TextureCube_reloadTexture'", 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_TextureCube_reloadTexture'", nullptr); + return 0; + } + bool ret = cobj->reloadTexture(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TextureCube:reloadTexture",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_TextureCube_reloadTexture'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_3d_TextureCube_setTexParameters(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TextureCube* 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.TextureCube",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::TextureCube*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_TextureCube_setTexParameters'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::Texture2D::TexParams arg0; + + ok &= luaval_to_texparams(tolua_S, 2, &arg0, "cc.TextureCube:setTexParameters"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_TextureCube_setTexParameters'", nullptr); + return 0; + } + cobj->setTexParameters(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TextureCube:setTexParameters",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_TextureCube_setTexParameters'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_3d_TextureCube_create(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"cc.TextureCube",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 6) + { + std::string arg0; + std::string arg1; + std::string arg2; + std::string arg3; + std::string arg4; + std::string arg5; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.TextureCube:create"); + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.TextureCube:create"); + ok &= luaval_to_std_string(tolua_S, 4,&arg2, "cc.TextureCube:create"); + ok &= luaval_to_std_string(tolua_S, 5,&arg3, "cc.TextureCube:create"); + ok &= luaval_to_std_string(tolua_S, 6,&arg4, "cc.TextureCube:create"); + ok &= luaval_to_std_string(tolua_S, 7,&arg5, "cc.TextureCube:create"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_TextureCube_create'", nullptr); + return 0; + } + cocos2d::TextureCube* ret = cocos2d::TextureCube::create(arg0, arg1, arg2, arg3, arg4, arg5); + object_to_luaval(tolua_S, "cc.TextureCube",(cocos2d::TextureCube*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.TextureCube:create",argc, 6); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_TextureCube_create'.",&tolua_err); +#endif + return 0; +} +static int lua_cocos2dx_3d_TextureCube_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (TextureCube)"); + return 0; +} + +int lua_register_cocos2dx_3d_TextureCube(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.TextureCube"); + tolua_cclass(tolua_S,"TextureCube","cc.TextureCube","cc.Texture2D",nullptr); + + tolua_beginmodule(tolua_S,"TextureCube"); + tolua_function(tolua_S,"reloadTexture",lua_cocos2dx_3d_TextureCube_reloadTexture); + tolua_function(tolua_S,"setTexParameters",lua_cocos2dx_3d_TextureCube_setTexParameters); + tolua_function(tolua_S,"create", lua_cocos2dx_3d_TextureCube_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::TextureCube).name(); + g_luaType[typeName] = "cc.TextureCube"; + g_typeCast["TextureCube"] = "cc.TextureCube"; + return 1; +} + +int lua_cocos2dx_3d_Skybox_reload(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Skybox* 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.Skybox",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Skybox*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Skybox_reload'", 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_Skybox_reload'", nullptr); + return 0; + } + cobj->reload(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Skybox:reload",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Skybox_reload'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_3d_Skybox_setTexture(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Skybox* 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.Skybox",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Skybox*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Skybox_setTexture'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::TextureCube* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.TextureCube",&arg0); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Skybox_setTexture'", nullptr); + return 0; + } + cobj->setTexture(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Skybox:setTexture",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Skybox_setTexture'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_3d_Skybox_create(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"cc.Skybox",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S)-1; + + do + { + if (argc == 6) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Skybox:create"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Skybox:create"); + if (!ok) { break; } + std::string arg2; + ok &= luaval_to_std_string(tolua_S, 4,&arg2, "cc.Skybox:create"); + if (!ok) { break; } + std::string arg3; + ok &= luaval_to_std_string(tolua_S, 5,&arg3, "cc.Skybox:create"); + if (!ok) { break; } + std::string arg4; + ok &= luaval_to_std_string(tolua_S, 6,&arg4, "cc.Skybox:create"); + if (!ok) { break; } + std::string arg5; + ok &= luaval_to_std_string(tolua_S, 7,&arg5, "cc.Skybox:create"); + if (!ok) { break; } + cocos2d::Skybox* ret = cocos2d::Skybox::create(arg0, arg1, arg2, arg3, arg4, arg5); + object_to_luaval(tolua_S, "cc.Skybox",(cocos2d::Skybox*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 0) + { + cocos2d::Skybox* ret = cocos2d::Skybox::create(); + object_to_luaval(tolua_S, "cc.Skybox",(cocos2d::Skybox*)ret); + return 1; + } + } while (0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.Skybox:create",argc, 0); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Skybox_create'.",&tolua_err); +#endif + return 0; +} +static int lua_cocos2dx_3d_Skybox_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (Skybox)"); + return 0; +} + +int lua_register_cocos2dx_3d_Skybox(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.Skybox"); + tolua_cclass(tolua_S,"Skybox","cc.Skybox","cc.Node",nullptr); + + tolua_beginmodule(tolua_S,"Skybox"); + tolua_function(tolua_S,"reload",lua_cocos2dx_3d_Skybox_reload); + tolua_function(tolua_S,"setTexture",lua_cocos2dx_3d_Skybox_setTexture); + tolua_function(tolua_S,"create", lua_cocos2dx_3d_Skybox_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::Skybox).name(); + g_luaType[typeName] = "cc.Skybox"; + g_typeCast["Skybox"] = "cc.Skybox"; + return 1; +} TOLUA_API int register_all_cocos2dx_3d(lua_State* tolua_S) { tolua_open(tolua_S); @@ -2975,7 +3418,9 @@ TOLUA_API int register_all_cocos2dx_3d(lua_State* tolua_S) lua_register_cocos2dx_3d_Animate3D(tolua_S); lua_register_cocos2dx_3d_Sprite3D(tolua_S); lua_register_cocos2dx_3d_AttachNode(tolua_S); + lua_register_cocos2dx_3d_TextureCube(tolua_S); lua_register_cocos2dx_3d_Sprite3DCache(tolua_S); + lua_register_cocos2dx_3d_Skybox(tolua_S); lua_register_cocos2dx_3d_BillBoard(tolua_S); lua_register_cocos2dx_3d_Animation3D(tolua_S); lua_register_cocos2dx_3d_Skeleton3D(tolua_S); 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 3963c71800..91b8d97322 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.hpp @@ -65,6 +65,16 @@ int register_all_cocos2dx_3d(lua_State* tolua_S); + + + + + + + + + + diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.cpp index 7df5575069..c9243e813b 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.cpp @@ -5,56 +5,6 @@ -int lua_cocos2dx_csloader_CSLoader_setJsonPath(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::CSLoader* 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.CSLoader",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::CSLoader*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_setJsonPath'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::string arg0; - - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:setJsonPath"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_setJsonPath'", nullptr); - return 0; - } - cobj->setJsonPath(arg0); - lua_settop(tolua_S, 1); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:setJsonPath",argc, 1); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_setJsonPath'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_csloader_CSLoader_createNodeFromJson(lua_State* tolua_S) { int argc = 0; @@ -264,7 +214,7 @@ int lua_cocos2dx_csloader_CSLoader_bindCallback(lua_State* tolua_S) return 0; } -int lua_cocos2dx_csloader_CSLoader_purge(lua_State* tolua_S) +int lua_cocos2dx_csloader_CSLoader_setJsonPath(lua_State* tolua_S) { int argc = 0; cocos2d::CSLoader* cobj = nullptr; @@ -284,29 +234,32 @@ int lua_cocos2dx_csloader_CSLoader_purge(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_purge'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_csloader_CSLoader_setJsonPath'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; - if (argc == 0) + if (argc == 1) { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.CSLoader:setJsonPath"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_purge'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_csloader_CSLoader_setJsonPath'", nullptr); return 0; } - cobj->purge(); + cobj->setJsonPath(arg0); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:purge",argc, 0); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.CSLoader:setJsonPath",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_purge'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_csloader_CSLoader_setJsonPath'.",&tolua_err); #endif return 0; @@ -773,12 +726,11 @@ int lua_register_cocos2dx_csloader_CSLoader(lua_State* tolua_S) tolua_beginmodule(tolua_S,"CSLoader"); tolua_function(tolua_S,"new",lua_cocos2dx_csloader_CSLoader_constructor); - tolua_function(tolua_S,"setJsonPath",lua_cocos2dx_csloader_CSLoader_setJsonPath); tolua_function(tolua_S,"createNodeFromJson",lua_cocos2dx_csloader_CSLoader_createNodeFromJson); tolua_function(tolua_S,"createNodeWithFlatBuffersFile",lua_cocos2dx_csloader_CSLoader_createNodeWithFlatBuffersFile); tolua_function(tolua_S,"loadNodeWithFile",lua_cocos2dx_csloader_CSLoader_loadNodeWithFile); tolua_function(tolua_S,"bindCallback",lua_cocos2dx_csloader_CSLoader_bindCallback); - tolua_function(tolua_S,"purge",lua_cocos2dx_csloader_CSLoader_purge); + tolua_function(tolua_S,"setJsonPath",lua_cocos2dx_csloader_CSLoader_setJsonPath); tolua_function(tolua_S,"init",lua_cocos2dx_csloader_CSLoader_init); tolua_function(tolua_S,"loadNodeWithContent",lua_cocos2dx_csloader_CSLoader_loadNodeWithContent); tolua_function(tolua_S,"isRecordJsonPath",lua_cocos2dx_csloader_CSLoader_isRecordJsonPath); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.hpp index 4c4e5bc666..bdedab007e 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_csloader_auto.hpp @@ -28,5 +28,4 @@ int register_all_cocos2dx_csloader(lua_State* tolua_S); - #endif // __cocos2dx_csloader_h__ diff --git a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp index 73001af2c9..db22dc8a22 100644 --- a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp +++ b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.cpp @@ -2056,6 +2056,47 @@ bool luaval_to_quaternion(lua_State* L,int lo,cocos2d::Quaternion* outValue, con return ok; } +bool luaval_to_texparams(lua_State* L,int lo,cocos2d::Texture2D::TexParams* outValue, const char* funcName) +{ + if (nullptr == L || nullptr == outValue) + return false; + + bool ok = true; + + tolua_Error tolua_err; + if (!tolua_istable(L, lo, 0, &tolua_err) ) + { +#if COCOS2D_DEBUG >=1 + luaval_to_native_err(L,"#ferror:",&tolua_err,funcName); +#endif + ok = false; + } + + if (ok) + { + lua_pushstring(L, "minFilter"); + lua_gettable(L, lo); + outValue->minFilter = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1); + lua_pop(L, 1); + + lua_pushstring(L, "magFilter"); + lua_gettable(L, lo); + outValue->magFilter = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1); + lua_pop(L, 1); + + lua_pushstring(L, "wrapS"); + lua_gettable(L, lo); + outValue->wrapS = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1); + lua_pop(L, 1); + + lua_pushstring(L, "wrapT"); + lua_gettable(L, lo); + outValue->wrapT = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1); + lua_pop(L, 1); + } + return ok; +} + void vec2_array_to_luaval(lua_State* L,const cocos2d::Vec2* points, int count) { if (NULL == L) @@ -3020,3 +3061,24 @@ void quaternion_to_luaval(lua_State* L,const cocos2d::Quaternion& inValue) lua_pushnumber(L, (lua_Number) inValue.w); /* L: table key value*/ lua_rawset(L, -3); } + +void texParams_to_luaval(lua_State* L, const cocos2d::Texture2D::TexParams& inValue) +{ + if (nullptr == L) + return; + + lua_newtable(L); /* L: table */ + + lua_pushstring(L, "minFilter"); /* L: table key */ + lua_pushnumber(L, (lua_Number) inValue.minFilter); /* L: table key value*/ + lua_rawset(L, -3); /* table[key] = value, L: table */ + lua_pushstring(L, "magFilter"); /* L: table key */ + lua_pushnumber(L, (lua_Number) inValue.magFilter); /* L: table key value*/ + lua_rawset(L, -3); + lua_pushstring(L, "wrapS"); /* L: table key */ + lua_pushnumber(L, (lua_Number) inValue.wrapS); /* L: table key value*/ + lua_rawset(L, -3); + lua_pushstring(L, "wrapT"); /* L: table key */ + lua_pushnumber(L, (lua_Number) inValue.wrapT); /* L: table key value*/ + lua_rawset(L, -3); +} diff --git a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.h b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.h index 7517187cbe..32c0f117b7 100644 --- a/cocos/scripting/lua-bindings/manual/LuaBasicConversions.h +++ b/cocos/scripting/lua-bindings/manual/LuaBasicConversions.h @@ -759,6 +759,18 @@ extern bool luaval_to_std_vector_ushort(lua_State* L, int lo, std::vector& */ void quaternion_to_luaval(lua_State* L,const cocos2d::Quaternion& inValue); +/** + * Push a table converted from a cocos2d::Texture2D::TexParams object into the Lua stack. + * The format of table as follows: {minFilter=numberValue1, magFilter=numberValue2, wrapS=numberValue3, wrapT=numberValue4} + * + * @param L the current lua_State. + * @param inValue a cocos2d::Texture2D::TexParams object. + */ +void texParams_to_luaval(lua_State* L, const cocos2d::Texture2D::TexParams& inValue); + // end group /// @} #endif //__COCOS2DX_SCRIPTING_LUA_COCOS2DXSUPPORT_LUABAISCCONVERSIONS_H__ diff --git a/cocos/ui/UIButton.h b/cocos/ui/UIButton.h index eecb09f348..17e2e87ebb 100644 --- a/cocos/ui/UIButton.h +++ b/cocos/ui/UIButton.h @@ -56,6 +56,8 @@ public: /** * Default destructor. + * + * @lua NA */ virtual ~Button(); diff --git a/cocos/ui/UICheckBox.h b/cocos/ui/UICheckBox.h index 427d7587f6..31c080c796 100644 --- a/cocos/ui/UICheckBox.h +++ b/cocos/ui/UICheckBox.h @@ -82,11 +82,15 @@ public: /** * Default constructor. + * + * @lua new */ CheckBox(); /** * Default destructor. + * + * @lua NA */ virtual ~CheckBox(); diff --git a/cocos/ui/UIEditBox/UIEditBox.h b/cocos/ui/UIEditBox/UIEditBox.h index 20dfbb908c..580bec1ad7 100644 --- a/cocos/ui/UIEditBox/UIEditBox.h +++ b/cocos/ui/UIEditBox/UIEditBox.h @@ -45,21 +45,18 @@ namespace ui { /** *@brief Editbox delgate class. * It's useful when you want to do some customization duing Editbox input event + * + * @js NA + * @lua NA */ class CC_GUI_DLL EditBoxDelegate { public: - /** - * @js NA - * @lua NA - */ virtual ~EditBoxDelegate() {}; /** * This method is called when an edit box gains focus after keyboard is shown. * @param editBox The edit box object that generated the event. - * @js NA - * @lua NA */ virtual void editBoxEditingDidBegin(EditBox* editBox) {}; @@ -67,8 +64,6 @@ namespace ui { /** * This method is called when an edit box loses focus after keyboard is hidden. * @param editBox The edit box object that generated the event. - * @js NA - * @lua NA */ virtual void editBoxEditingDidEnd(EditBox* editBox) {}; @@ -76,16 +71,12 @@ namespace ui { * This method is called when the edit box text was changed. * @param editBox The edit box object that generated the event. * @param text The new text. - * @js NA - * @lua NA */ virtual void editBoxTextChanged(EditBox* editBox, const std::string& text) {}; /** * This method is called when the return button was pressed or the outside area of keyboard was touched. * @param editBox The edit box object that generated the event. - * @js NA - * @lua NA */ virtual void editBoxReturn(EditBox* editBox) = 0; @@ -217,6 +208,7 @@ namespace ui { /** * Constructor. * @js ctor + * @lua new */ EditBox(void); diff --git a/cocos/ui/UIHBox.h b/cocos/ui/UIHBox.h index a2bdf0da9f..62a62cb169 100644 --- a/cocos/ui/UIHBox.h +++ b/cocos/ui/UIHBox.h @@ -45,11 +45,15 @@ public: /** * Default constructor + * @js ctor + * @lua new */ HBox(); /** * Default destructor + * @js NA + * @lua NA */ virtual ~HBox(); diff --git a/cocos/ui/UIHelper.h b/cocos/ui/UIHelper.h index c5ee5e298e..51573e8b69 100644 --- a/cocos/ui/UIHelper.h +++ b/cocos/ui/UIHelper.h @@ -83,6 +83,7 @@ public: * @param start The start position of the substring. * @param length The length of the substring in UTF8 count * @return a UTF8 substring + * @js NA */ static std::string getSubStringOfUTF8String(const std::string& str, std::string::size_type start, diff --git a/cocos/ui/UIImageView.h b/cocos/ui/UIImageView.h index 18ea52480d..24313e32c3 100644 --- a/cocos/ui/UIImageView.h +++ b/cocos/ui/UIImageView.h @@ -47,11 +47,15 @@ class CC_GUI_DLL ImageView : public Widget public: /** * Default constructor + * @js ctor + * @lua new */ ImageView(); /** * Default destructor + * @js NA + * @lua NA */ virtual ~ImageView(); diff --git a/cocos/ui/UILayout.h b/cocos/ui/UILayout.h index d2c1c8396b..e457019a6b 100644 --- a/cocos/ui/UILayout.h +++ b/cocos/ui/UILayout.h @@ -48,16 +48,47 @@ class Scale9Sprite; /** *@brief Layout interface for creating LayoutManger and do actual layout. + * @js NA */ class CC_GUI_DLL LayoutProtocol { public: + /** + *@brief Default constructor. + */ LayoutProtocol(){} + /** + *@brief Default destructor. + */ virtual ~LayoutProtocol(){} + + /** + * @brief Create a custom layout manager. + * + * @return A LayoutManager descendants instance. + */ virtual LayoutManager* createLayoutManager() = 0; + + /** + * @brief Return the content size of layout. + * + * @return A content size in Size. + */ virtual Size getLayoutContentSize()const = 0; + + /** + * @brief Get all elements of the layout. + * + * @return A vector of Node pointers. + */ virtual const Vector& getLayoutElements()const = 0; + + /** + * @brief The main function to do the layout job. + * Different layout manager should implement its own layout algorithm. + * + */ virtual void doLayout() = 0; }; @@ -117,11 +148,15 @@ public: /** * Default constructor + * @js ctor + * @lua new */ Layout(); /** * Default destructor + * @js NA + * @lua NA */ virtual ~Layout(); @@ -368,7 +403,14 @@ public: */ void requestDoLayout(); + /** + * @lua NA + */ virtual void onEnter() override; + + /** + * @lua NA + */ virtual void onExit() override; /** diff --git a/cocos/ui/UILayoutComponent.h b/cocos/ui/UILayoutComponent.h index 195dca0b03..051cb2221f 100644 --- a/cocos/ui/UILayoutComponent.h +++ b/cocos/ui/UILayoutComponent.h @@ -43,11 +43,15 @@ namespace ui { public: /** * Default constructor + * + * @lua new */ LayoutComponent(); /** * Default destructor + * + * @lua NA */ ~LayoutComponent(); diff --git a/cocos/ui/UILayoutParameter.h b/cocos/ui/UILayoutParameter.h index bec11ca3e1..b9262ba23f 100644 --- a/cocos/ui/UILayoutParameter.h +++ b/cocos/ui/UILayoutParameter.h @@ -39,6 +39,7 @@ namespace ui { /** *@brief Margin of widget's in point. Margin value should be positive. + *@lua NA */ class CC_GUI_DLL Margin { @@ -135,6 +136,8 @@ public: }; /** * Default constructor. + * + * @lua new */ LayoutParameter() : _margin(Margin()) { @@ -143,6 +146,7 @@ public: /** * Default destructor. + * @lua NA */ virtual ~LayoutParameter(){}; @@ -241,6 +245,8 @@ public: /** * Default constructor. + * + * @lua new */ LinearLayoutParameter() : _linearGravity(LinearGravity::NONE) @@ -250,6 +256,8 @@ public: /** * Default destructor. + * + * @lua NA */ virtual ~LinearLayoutParameter(){}; @@ -326,6 +334,8 @@ public: /** * Default constructor + * + * @lua new */ RelativeLayoutParameter() : _relativeAlign(RelativeAlign::NONE), @@ -338,6 +348,8 @@ public: /** * Default destructor + * + * @lua NA */ virtual ~RelativeLayoutParameter(){}; diff --git a/cocos/ui/UIListView.h b/cocos/ui/UIListView.h index eb94bca674..379cb1b9bd 100644 --- a/cocos/ui/UIListView.h +++ b/cocos/ui/UIListView.h @@ -94,12 +94,14 @@ public: /** * Default constructor * @js ctor + * @lua new */ ListView(); /** * Default destructor * @js NA + * @lua NA */ virtual ~ListView(); diff --git a/cocos/ui/UILoadingBar.h b/cocos/ui/UILoadingBar.h index 29238d29ce..4117b4d8a4 100644 --- a/cocos/ui/UILoadingBar.h +++ b/cocos/ui/UILoadingBar.h @@ -60,12 +60,14 @@ public: /** * Default constructor. * @js ctor + * @lua new */ LoadingBar(); /** * Default destructor. * @js NA + * @lua NA */ virtual ~LoadingBar(); diff --git a/cocos/ui/UIPageView.h b/cocos/ui/UIPageView.h index e6fbb01ed8..8a1278b1bd 100644 --- a/cocos/ui/UIPageView.h +++ b/cocos/ui/UIPageView.h @@ -87,12 +87,14 @@ public: /** * Default constructor * @js ctor + * @lua new */ PageView(); /** * Default destructor * @js NA + * @lua NA */ virtual ~PageView(); @@ -200,6 +202,9 @@ public: virtual void setLayoutType(Type type) override{}; virtual Type getLayoutType() const override{return Type::ABSOLUTE;}; virtual std::string getDescription() const override; + /** + * @lua NA + */ virtual void onEnter() override; /** diff --git a/cocos/ui/UIRelativeBox.h b/cocos/ui/UIRelativeBox.h index af9b528a51..4f8b5b617f 100644 --- a/cocos/ui/UIRelativeBox.h +++ b/cocos/ui/UIRelativeBox.h @@ -48,12 +48,14 @@ public: /** * Default constructor. * @js ctor + * @lua new */ RelativeBox(); /** * Default destructor. * @js NA + * @lua NA */ virtual ~RelativeBox(); diff --git a/cocos/ui/UIRichText.h b/cocos/ui/UIRichText.h index 55a132a6f4..591ef8d7f9 100644 --- a/cocos/ui/UIRichText.h +++ b/cocos/ui/UIRichText.h @@ -56,12 +56,14 @@ public: /** * @brief Default constructor. * @js ctor + * @lua new */ RichElement(){}; /** * @brief Default destructor. * @js NA + * @lua NA */ virtual ~RichElement(){}; @@ -93,6 +95,7 @@ public: /** *@brief Default constructor. * @js ctor + * @lua new */ RichElementText(){_type = Type::TEXT;}; @@ -100,6 +103,7 @@ public: /** *@brief Default destructor. * @js NA + * @lua NA */ virtual ~RichElementText(){}; @@ -147,6 +151,7 @@ public: /** * @brief Default constructor. * @js ctor + * @lua new * */ RichElementImage(){_type = Type::IMAGE;}; @@ -155,6 +160,7 @@ public: /** * @brief Default destructor. * @js NA + * @lua NA */ virtual ~RichElementImage(){}; @@ -198,6 +204,7 @@ public: /** * @brief Default constructor. * @js ctor + * @lua new */ RichElementCustomNode(){_type = Type::CUSTOM;}; @@ -205,6 +212,7 @@ public: /** * @brief Default destructor. * @js NA + * @lua NA */ virtual ~RichElementCustomNode(){CC_SAFE_RELEASE(_customNode);}; @@ -246,12 +254,14 @@ public: /** * @brief Default constructor. * @js ctor + * @lua new */ RichText(); /** * @brief Default destructor. * @js NA + * @lua NA */ virtual ~RichText(); diff --git a/cocos/ui/UIScale9Sprite.h b/cocos/ui/UIScale9Sprite.h index 93b4fee475..1a90a725cd 100644 --- a/cocos/ui/UIScale9Sprite.h +++ b/cocos/ui/UIScale9Sprite.h @@ -56,6 +56,7 @@ namespace ui { /** * Default constructor. * @js ctor + * @lua new */ Scale9Sprite(); @@ -577,6 +578,10 @@ namespace ui { virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override; virtual void cleanup() override; + + /** + * @lua NA + */ virtual void onEnter() override; /** Event callback that is invoked when the Node enters in the 'stage'. diff --git a/cocos/ui/UIScrollView.h b/cocos/ui/UIScrollView.h index c32aeb591f..1195a30d06 100644 --- a/cocos/ui/UIScrollView.h +++ b/cocos/ui/UIScrollView.h @@ -107,12 +107,14 @@ public: /** * Default constructor * @js ctor + * @lua new */ ScrollView(); /** * Default destructor * @js NA + * @lua NA */ virtual ~ScrollView(); @@ -387,6 +389,10 @@ public: * Return the "class name" of widget. */ virtual std::string getDescription() const override; + + /** + * @lua NA + */ virtual void onEnter() override; /** diff --git a/cocos/ui/UISlider.h b/cocos/ui/UISlider.h index 603550743e..882dfec14c 100644 --- a/cocos/ui/UISlider.h +++ b/cocos/ui/UISlider.h @@ -67,12 +67,14 @@ public: /** * Default constructor. * @js ctor + * @lua new */ Slider(); /** * Default destructor. * @js NA + * @lua NA */ virtual ~Slider(); diff --git a/cocos/ui/UIText.h b/cocos/ui/UIText.h index f5fd85560d..4bd36c5a4f 100644 --- a/cocos/ui/UIText.h +++ b/cocos/ui/UIText.h @@ -57,11 +57,15 @@ public: }; /** * Default constructor. + * @js ctor + * @lua new */ Text(); /** * Default destructor. + * @js NA + * @lua NA */ virtual ~Text(); diff --git a/cocos/ui/UITextAtlas.h b/cocos/ui/UITextAtlas.h index 750ebb651e..ca3b3e3a48 100644 --- a/cocos/ui/UITextAtlas.h +++ b/cocos/ui/UITextAtlas.h @@ -50,11 +50,15 @@ class CC_GUI_DLL TextAtlas : public Widget public: /** * Default constructor. + * + * @lua new */ TextAtlas(); /** * Default destructor. + * + * @lua NA */ virtual ~TextAtlas(); @@ -130,6 +134,9 @@ public: */ virtual std::string getDescription() const override; + /** + * @js NA + */ virtual void adaptRenderers() override; protected: virtual void initRenderer() override; diff --git a/cocos/ui/UITextBMFont.h b/cocos/ui/UITextBMFont.h index 303f7b8a9b..179884cb9d 100644 --- a/cocos/ui/UITextBMFont.h +++ b/cocos/ui/UITextBMFont.h @@ -49,11 +49,15 @@ class CC_GUI_DLL TextBMFont : public Widget public: /** * Default constructor + * @js ctor + * @lua new */ TextBMFont(); /** * Default destructor + * @js NA + * @lua NA */ virtual ~TextBMFont(); diff --git a/cocos/ui/UITextField.h b/cocos/ui/UITextField.h index ea96bb8abf..0932a9c90f 100644 --- a/cocos/ui/UITextField.h +++ b/cocos/ui/UITextField.h @@ -40,6 +40,8 @@ namespace ui { /** * @brief A helper class which inherit from @see `TextFieldTTF` and implements the @see `TextFieldDelegate` protocol. * It is mainly be used internally by @see `UITextField` class. + * @js NA + * @lua NA */ class CC_GUI_DLL UICCTextField: public TextFieldTTF, public TextFieldDelegate { diff --git a/cocos/ui/UIVBox.h b/cocos/ui/UIVBox.h index f8a1e53dcf..65e069f9f3 100644 --- a/cocos/ui/UIVBox.h +++ b/cocos/ui/UIVBox.h @@ -45,11 +45,15 @@ public: /** * Default constructor + * @js ctor + * @lua new */ VBox(); /** * Default destructor + * @js NA + * @lua NA */ virtual ~VBox(); diff --git a/cocos/ui/UIVideoPlayer.h b/cocos/ui/UIVideoPlayer.h index 9a6a43afc5..81b688a22a 100644 --- a/cocos/ui/UIVideoPlayer.h +++ b/cocos/ui/UIVideoPlayer.h @@ -44,10 +44,14 @@ namespace experimental{ * * @note VideoPlayer displays a video file base on system widget. * It's mean VideoPlayer displays a video file above all graphical elements of cocos2d-x. + * @js NA */ class VideoPlayer : public cocos2d::ui::Widget { public: + /** + * Videoplayer play event type. + */ enum class EventType { PLAYING = 0, @@ -55,15 +59,27 @@ namespace experimental{ STOPPED, COMPLETED }; + + /** + * A callback which will be called after specific VideoPlayer event happens. + */ typedef std::function ccVideoPlayerCallback; + /** + *Static create method for instancing a VideoPlayer. + */ CREATE_FUNC(VideoPlayer); /** * Sets a file path as a video source for VideoPlayer. */ virtual void setFileName(const std::string& videoPath); - + + /** + * @brief Get the local video filie name. + * + * @return The video file name. + */ virtual const std::string& getFileName() const { return _videoURL;} /** @@ -71,6 +87,12 @@ namespace experimental{ */ virtual void setURL(const std::string& _videoURL); + + /** + * @brief Get the URL of remoting video source. + * + * @return A remoting URL address. + */ virtual const std::string& getURL() const { return _videoURL;} /** @@ -140,7 +162,13 @@ namespace experimental{ * @param callback The callback that will be run. */ virtual void addEventListener(const VideoPlayer::ccVideoPlayerCallback& callback); - + + /** + * @brief A function which will be called when video is playing. + * + * @param event @see VideoPlayer::EventType. + + */ virtual void onPlayEvent(int event); virtual void setVisible(bool visible) override; virtual void draw(Renderer *renderer, const Mat4& transform, uint32_t flags) override; diff --git a/cocos/ui/UIWebView.h b/cocos/ui/UIWebView.h index e6d520daf9..4ebc9e5dae 100644 --- a/cocos/ui/UIWebView.h +++ b/cocos/ui/UIWebView.h @@ -50,6 +50,7 @@ class WebViewImpl; * * @note WebView displays web pages base on system widget. * It's mean WebView displays web pages above all graphical elements of cocos2d-x. + * @js NA */ class CC_GUI_DLL WebView : public cocos2d::ui::Widget { public: @@ -152,6 +153,9 @@ public: */ void setOnShouldStartLoading(const std::function& callback); + /** + * A callback which will be called when a WebView event happens. + */ typedef std::function ccWebViewCallback; /** @@ -173,13 +177,31 @@ public: */ void setOnJSCallback(const ccWebViewCallback& callback); + /** + * Get the callback when WebView is about to start. + */ std::function getOnShouldStartLoading()const; + + /** + * Get the callback when WebView has finished loading. + */ ccWebViewCallback getOnDidFinishLoading()const; + + /** + * Get the callback when WebView has failed loading. + */ ccWebViewCallback getOnDidFailLoading()const; + + /** + *Get the Javascript callback. + */ ccWebViewCallback getOnJSCallback()const; virtual void draw(cocos2d::Renderer *renderer, cocos2d::Mat4 const &transform, uint32_t flags) override; + /** + * Toggle visibility of WebView. + */ virtual void setVisible(bool visible) override; protected: diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index 2323b65bae..9cce4156bf 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -154,11 +154,15 @@ public: typedef std::function ccWidgetEventCallback; /** * Default constructor + * @js ctor + * @lua new */ Widget(void); /** * Default destructor + * @js NA + * @lua NA */ virtual ~Widget(); /** @@ -292,6 +296,9 @@ public: */ float getTopBoundary() const; + /** + * @js NA + */ virtual void visit(cocos2d::Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override; /** @@ -312,6 +319,7 @@ public: /** * Set a event handler to the widget in order to use cocostudio editor and framework * @param callback The callback in `ccWidgetEventCallback`. + * @lua NA */ virtual void addCCSEventListener(const ccWidgetEventCallback& callback); /**/ @@ -646,8 +654,14 @@ public: * @return A cloned widget copy of original. */ Widget* clone(); - + /** + * @lua NA + */ virtual void onEnter() override; + + /** + * @lua NA + */ virtual void onExit() override; /** diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index ef57af755f..dca3cf3535 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -13,17 +13,12 @@ - [Windows](#windows) - [Linux](#linux) - [How to start a new game](#how-to-start-a-new-game) -- [v3.5](#v35) -- [v3.5rc0](#v35rc0) - - [Highlights of v3.5rc0](#highlights-of-v35rc0) - - [Features in detail](#features-in-detail) - - [More 3D particle features of (PU) supported](#more-3d-particle-features-of-pu-supported) -- [v3.5beta0](#v35beta0) - - [Highlights of v3.5beta0](#highlights-of-v35beta0) +- [v3.6beta0](#v36beta0) + - [Highlights of v3.6beta0](#highlights-of-v36beta0) - [Features in detail](#features-in-detail-1) - - [3D Particles](#3d-particles) - - [Supported PU features](#supported-pu-features) - - [Particle usage](#particle-usage) + - [3D TextureCube](#3d-texturecube) + - [3D Skybox](#3d-skybox) + - [Animate3D Quality Control](#animate3d-quality-control) @@ -114,64 +109,85 @@ Run ## How to start a new game Please refer to this document: [ReadMe](../README.md) -# v3.5 -There are only some minor changes and bug fixes in this verison. -* EditBox: Color4B font color is supported -* Fix memory leak in AutoReleasePool -* Fix FileUtils:getWritablePath() return wrong path on Mac&Windows +# v3.6beta0 -# v3.5rc0 -## Highlights of v3.5rc0 -* More features of Particle(PU) is supported -* Disable reverse of MoveTo -* CsLoader: add callback when loading a CSB file -* Fix transparent Billboard and Sprite3D rendering error -* Fix Motionstreak does not work with MoveTo and MoveBy -* More bugs fixed - -## Features in detail -###More 3D particle features of (PU) supported -* Observer: On Count Observer, On Emission Observer, On Expire Observer, On Position observer, On Clear Observer, On Time Observer, On Quota Observer, On Velocity Observer, On Collision Observer, On Event Flag Observer, On Random Observer. - -* Event Handler: Do Enable Component Event Handler, Do Expire Event Handler, Do Placement Particle Event Handler, Do Stop System Event Handler, Do Affector Event Handler, Do Freeze Event Handler, Do Scale Event Handler. - -* Behavior: Slave Behavior - -Observer and Event Handler allow you to listen to the particle system and trigger some events. The Event handler can do something when the event happens. For example, there is a observer on the particle system, and it listens to the particle number when the number is greater than 100, it tirggers an event to stop the particle system. This allows you to create more complex particles. For more details, please refer to the Particle Universe User's Guide. - -# v3.5beta0 - -## Highlights of v3.5beta0 +## Highlights of v3.6beta0 ## Features in detail -### 3D Particles +### 3D TextureCube -#### Supported PU features +TextureCube is useful for skybox and environment mapping. It uses 6 faces of a cube as map shape, and 6 pictures are projected onto the sides of a cube and stored as six square textures. -* Render: Billboard Renderer, Box Renderer, Sphere Renderer, Entity Renderer, Ribbon Trail Renderer. - -* Emitter: Point Emitter, Box Emitter, Sphere Surface Emitter, Line Emitter, Circle Emitter, Position Emitter, Slave Emitter. - -* Affector: Gravity Affector, Linear Force Affector, Scale Affector, Sine Force Affector, Color Affector, Randomiser, Line Affector, Align Affector, Jet Affector, Vortex Affector, Geometry Rotator, Texture Rotator, Texture Animator, Particle Follower, Sphere Collider, Plane Collider, box Collider, Path Follower, Flock Centering Affector, Velocity Matching Affector. - -#### Particle usage - -It allows to import particles from Particle Universe (http://www.fxpression.com). The usage of particles is as follow, - -Option 1, create 3D particle with particle (.pu) file and material file +#### TexturesCube usage ```c++ -auto rootps = PUParticleSystem3D::create("lineStreak.pu", "pu_mediapack_01.material"); -addChild(rootps); -rootps->startParticleSystem(); +auto texturecube = TextureCube::create("left.jpg", "right.jpg", "top.jpg", "bottom.jpg","front.jpg", "back.jpg"); +//set texture parameters +Texture2D::TexParams tRepeatParams; +tRepeatParams.magFilter = GL_NEAREST; +tRepeatParams.minFilter = GL_NEAREST; +tRepeatParams.wrapS = GL_MIRRORED_REPEAT; +tRepeatParams.wrapT = GL_MIRRORED_REPEAT; +texturecube->setTexParameters(tRepeatParams); + +//create a GLProgramState using custom shader +auto shader = GLProgram::createWithFilenames("cube_map.vert", "cube_map.frag"); +auto state = GLProgramState::create(shader); +// pass the texture sampler to our custom shader, state is a pointer of GLProgramState, u_cubeTex is a uniform in shader +state->setUniformTexture("u_cubeTex", texturecube); ``` -Option 2, you can also create 3d particle with particle (.pu) file only, it will load all the material files in the material path +Then the shader cube_map.frag can be something like this, + ```c++ -auto rootps = PUParticleSystem3D::create("advancedLodSystem.pu"); -addChild(rootps); -rootps->startParticleSystem(); +varying vec3 v_reflect; //reflect direction +uniform samplerCube u_cubeTex; + +void main(void) +{ + gl_FragColor = textureCube(u_cubeTex, v_reflect); //sample the color of reflection direction +} ``` -For more information, please refer to `cpp-tests/Particle3DTest` +For more information please refer to cpp-tests/Sprite3DTest/Sprite3DCubeMapTest. + +### 3D Skybox + +Skybox is a common component in 3D game. It is based on TextureCube. + +Usage of skybox + +```c++ +// create a texture cube +auto textureCube = TextureCube::create("left.jpg", "right.jpg","top.jpg", "bottom.jpg","front.jpg", "back.jpg"); +//create a skybox +auto skyBox = Skybox::create(); +skyBox->retain(); +//set cube texture to the skybox +skyBox->setTexture(textureCube); +addChild(_skyBox); +``` + +For more information please refer to cpp-tests/Sprite3DTest/Sprite3DCubeMapTest. + +### Animate3D Quality Control + +In order to make `Animate3D` run fast, you can use low quality animation. + +```c++ +std::string fileName = "Sprite3DTest/orc.c3b"; +auto sprite = Sprite3D::create(fileName); +addChild(sprite); + +auto animation = Animation3D::create(fileName); +if (animation) +{ + auto animate = Animate3D::create(animation); + //use low quality animation + animate->setHighQuality(false); + sprite->runAction(RepeatForever::create(animate)); +} +``` + +The animation quality is also configurable in config.plist, the key is cocos2d.x.3d.animate_high_quality. All the created `Animate3D` base on this key if exist. You can modify it using the above method. diff --git a/extensions/GUI/CCControlExtension/CCControlColourPicker.h b/extensions/GUI/CCControlExtension/CCControlColourPicker.h index 1a6a146170..a124cc37cc 100644 --- a/extensions/GUI/CCControlExtension/CCControlColourPicker.h +++ b/extensions/GUI/CCControlExtension/CCControlColourPicker.h @@ -54,6 +54,7 @@ public: static ControlColourPicker* create(); /** * @js ctor + * @lua new */ ControlColourPicker(); /** diff --git a/extensions/GUI/CCControlExtension/CCControlPotentiometer.h b/extensions/GUI/CCControlExtension/CCControlPotentiometer.h index c70ec15e06..68c91d7a51 100644 --- a/extensions/GUI/CCControlExtension/CCControlPotentiometer.h +++ b/extensions/GUI/CCControlExtension/CCControlPotentiometer.h @@ -50,6 +50,7 @@ public: static ControlPotentiometer* create(const char* backgroundFile, const char* progressFile, const char* thumbFile); /** * @js ctor + * @lua new */ ControlPotentiometer(); /** diff --git a/extensions/GUI/CCControlExtension/CCControlSlider.h b/extensions/GUI/CCControlExtension/CCControlSlider.h index 500c660a17..e2196c6b8f 100644 --- a/extensions/GUI/CCControlExtension/CCControlSlider.h +++ b/extensions/GUI/CCControlExtension/CCControlSlider.h @@ -77,6 +77,7 @@ public: Sprite* selectedThumbSprite); /** * @js ctor + * @lua new */ ControlSlider(); /** diff --git a/extensions/GUI/CCControlExtension/CCControlStepper.h b/extensions/GUI/CCControlExtension/CCControlStepper.h index bd61ee2f1b..5a9c6800f5 100644 --- a/extensions/GUI/CCControlExtension/CCControlStepper.h +++ b/extensions/GUI/CCControlExtension/CCControlStepper.h @@ -54,6 +54,7 @@ public: static ControlStepper* create(Sprite *minusSprite, Sprite *plusSprite); /** * @js ctor + * @lua new */ ControlStepper(); /** diff --git a/extensions/GUI/CCControlExtension/CCControlSwitch.h b/extensions/GUI/CCControlExtension/CCControlSwitch.h index d77067303c..75f48e8d46 100644 --- a/extensions/GUI/CCControlExtension/CCControlSwitch.h +++ b/extensions/GUI/CCControlExtension/CCControlSwitch.h @@ -55,6 +55,7 @@ public: static ControlSwitch* create(Sprite *maskSprite, Sprite * onSprite, Sprite * offSprite, Sprite * thumbSprite); /** * @js ctor + * @lua new */ ControlSwitch(); /** diff --git a/extensions/GUI/CCScrollView/CCScrollView.h b/extensions/GUI/CCScrollView/CCScrollView.h index 08b328d894..b080dba8f3 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.h +++ b/extensions/GUI/CCScrollView/CCScrollView.h @@ -93,6 +93,7 @@ public: static ScrollView* create(); /** * @js ctor + * @lua new */ ScrollView(); /** diff --git a/extensions/GUI/CCScrollView/CCTableView.h b/extensions/GUI/CCScrollView/CCTableView.h index d9fccb46f2..a3f58728db 100644 --- a/extensions/GUI/CCScrollView/CCTableView.h +++ b/extensions/GUI/CCScrollView/CCTableView.h @@ -188,6 +188,7 @@ public: static TableView* create(TableViewDataSource* dataSource, Size size, Node *container); /** * @js ctor + * @lua new */ TableView(); /** diff --git a/extensions/assets-manager/AssetsManager.h b/extensions/assets-manager/AssetsManager.h index f8221883b7..8cb4e48017 100644 --- a/extensions/assets-manager/AssetsManager.h +++ b/extensions/assets-manager/AssetsManager.h @@ -74,6 +74,7 @@ public: * @param versionFileUrl URL of version file. It should contain version code of new package. * @param storagePath The path to store downloaded resources. * @js NA + * @lua new */ AssetsManager(const char* packageUrl = NULL, const char* versionFileUrl = NULL, const char* storagePath = NULL); /** diff --git a/extensions/assets-manager/Manifest.h b/extensions/assets-manager/Manifest.h index 34700040a2..32657d49b4 100644 --- a/extensions/assets-manager/Manifest.h +++ b/extensions/assets-manager/Manifest.h @@ -163,7 +163,9 @@ protected: */ const std::string& getGroupVersion(const std::string &group) const; - /** @brief Gets assets. + /** + * @brief Gets assets. + * @lua NA */ const std::unordered_map& getAssets() const; diff --git a/extensions/physics-nodes/CCPhysicsDebugNode.h b/extensions/physics-nodes/CCPhysicsDebugNode.h index 16c0f56400..bdb4a8aaf6 100644 --- a/extensions/physics-nodes/CCPhysicsDebugNode.h +++ b/extensions/physics-nodes/CCPhysicsDebugNode.h @@ -32,13 +32,13 @@ struct cpSpace; NS_CC_EXT_BEGIN /** - A BaseData that draws the components of a physics engine. + * A BaseData that draws the components of a physics engine. - Supported physics engines: - - Chipmunk - - Objective-Chipmunk - - @since v2.1 + * Supported physics engines: + * - Chipmunk + * - Objective-Chipmunk + * @since v2.1 + * @lua NA */ class CC_EX_DLL PhysicsDebugNode : public DrawNode @@ -53,7 +53,6 @@ public: PhysicsDebugNode(); /** * @js NA - * @lua NA */ virtual ~PhysicsDebugNode(); diff --git a/extensions/physics-nodes/CCPhysicsSprite.h b/extensions/physics-nodes/CCPhysicsSprite.h index 1113354b7b..6dd88562f9 100644 --- a/extensions/physics-nodes/CCPhysicsSprite.h +++ b/extensions/physics-nodes/CCPhysicsSprite.h @@ -45,6 +45,7 @@ NS_CC_EXT_BEGIN - Position and rotation are going to updated from the physics body - If you update the rotation or position manually, the physics body will be updated - You can't enble both Chipmunk support and Box2d support at the same time. Only one can be enabled at compile time + * @lua NA */ class CC_EX_DLL PhysicsSprite : public Sprite { diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 6e33851a89..fc4c6c8c95 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -633,6 +633,7 @@ "cocos/editor-support/cocostudio/CSParseBinary_generated.h", "cocos/editor-support/cocostudio/CocoLoader.cpp", "cocos/editor-support/cocostudio/CocoLoader.h", + "cocos/editor-support/cocostudio/CocoStudio.cpp", "cocos/editor-support/cocostudio/CocoStudio.h", "cocos/editor-support/cocostudio/CocosStudioExport.h", "cocos/editor-support/cocostudio/DictionaryHelper.cpp", @@ -5351,6 +5352,7 @@ "cocos/scripting/lua-bindings/auto/api/SkewFrame.lua", "cocos/scripting/lua-bindings/auto/api/SkewTo.lua", "cocos/scripting/lua-bindings/auto/api/Skin.lua", + "cocos/scripting/lua-bindings/auto/api/Skybox.lua", "cocos/scripting/lua-bindings/auto/api/Slider.lua", "cocos/scripting/lua-bindings/auto/api/Spawn.lua", "cocos/scripting/lua-bindings/auto/api/Speed.lua", @@ -5380,6 +5382,7 @@ "cocos/scripting/lua-bindings/auto/api/TextField.lua", "cocos/scripting/lua-bindings/auto/api/Texture2D.lua", "cocos/scripting/lua-bindings/auto/api/TextureCache.lua", + "cocos/scripting/lua-bindings/auto/api/TextureCube.lua", "cocos/scripting/lua-bindings/auto/api/TextureData.lua", "cocos/scripting/lua-bindings/auto/api/TextureFrame.lua", "cocos/scripting/lua-bindings/auto/api/TileMapAtlas.lua", diff --git a/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.cpp b/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.cpp index fa07c703a5..a0da56794f 100644 --- a/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.cpp +++ b/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.cpp @@ -102,6 +102,13 @@ void CocosStudio3DTestDemo::onEnter() BaseTest::onEnter(); } +void CocosStudio3DTestDemo::onExit() +{ + cocostudio::destroyCocosStudio(); + + BaseTest::onExit(); +} + void CocosStudio3DTestDemo::restartCallback(Ref* sender) { auto s = new (std::nothrow) CS3DTestScene(); diff --git a/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.h b/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.h index 9f25baf360..0a4597ed38 100644 --- a/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.h +++ b/tests/cpp-tests/Classes/CocosStudio3DTest/CocosStudio3DTest.h @@ -47,6 +47,7 @@ public: virtual std::string title() const override; virtual std::string subtitle() const override; virtual void onEnter() override; + virtual void onExit() override; }; class CSNode3DTest : public CocosStudio3DTestDemo diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp index 74249dd5cf..83289698df 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp @@ -164,9 +164,8 @@ void ActionTimelineTestLayer::onExit() removeAllChildren(); backItem = restartItem = nextItem = nullptr; - - ActionTimelineCache::getInstance()->purge(); - CSLoader::getInstance()->purge(); + + cocostudio::destroyCocosStudio(); Layer::onExit(); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index 012e4500c4..4ff27404f6 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp @@ -199,6 +199,8 @@ void ArmatureTestLayer::onExit() removeAllChildren(); backItem = restartItem = nextItem = nullptr; + + cocostudio::destroyCocosStudio(); Layer::onExit(); } diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index fc6dfcf068..7e1206c41c 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -1348,6 +1348,19 @@ Sprite3DWithSkinTest::Sprite3DWithSkinTest() listener->onTouchesEnded = CC_CALLBACK_2(Sprite3DWithSkinTest::onTouchesEnded, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); + // swich camera + MenuItemFont::setFontName("fonts/arial.ttf"); + MenuItemFont::setFontSize(15); + _menuItem = MenuItemFont::create("High Quality", CC_CALLBACK_1(Sprite3DWithSkinTest::switchAnimationQualityCallback,this)); + _menuItem->setColor(Color3B(0,200,20)); + auto menu = Menu::create(_menuItem,NULL); + menu->setPosition(Vec2::ZERO); + _menuItem->setPosition(VisibleRect::left().x + 50, VisibleRect::top().y -70); + addChild(menu, 1); + + _highQuality = true; + _sprits.clear(); + auto s = Director::getInstance()->getWinSize(); addNewSpriteWithCoords( Vec2(s.width/2, s.height/2) ); } @@ -1366,9 +1379,10 @@ void Sprite3DWithSkinTest::addNewSpriteWithCoords(Vec2 p) auto sprite = EffectSprite3D::create(fileName); sprite->setScale(3); sprite->setRotation3D(Vec3(0,180,0)); - addChild(sprite); sprite->setPosition( Vec2( p.x, p.y) ); - + addChild(sprite); + _sprits.push_back(sprite); + auto animation = Animation3D::create(fileName); if (animation) { @@ -1386,8 +1400,28 @@ void Sprite3DWithSkinTest::addNewSpriteWithCoords(Vec2 p) speed = animate->getSpeed() - 0.5 * CCRANDOM_0_1(); } animate->setSpeed(inverse ? -speed : speed); + animate->setTag(110); + animate->setHighQuality(_highQuality); + auto repeate = RepeatForever::create(animate); + repeate->setTag(110); + sprite->runAction(repeate); + } +} - sprite->runAction(RepeatForever::create(animate)); +void Sprite3DWithSkinTest::switchAnimationQualityCallback(Ref* sender) +{ + _highQuality = !_highQuality; + + if (_highQuality) + _menuItem->setString("High Quality"); + else + _menuItem->setString("Low Quality"); + + for (auto iter: _sprits) + { + RepeatForever* repAction = dynamic_cast(iter->getActionByTag(110)); + Animate3D* animate3D = dynamic_cast(repAction->getInnerAction()); + animate3D->setHighQuality(_highQuality); } } @@ -2354,7 +2388,7 @@ NodeAnimationTest::NodeAnimationTest() int tIndex = _vectorIndex - 1; if(tIndex < 0) - _vectorIndex = _sprites.size()-1; + _vectorIndex = (int)_sprites.size()-1; else _vectorIndex--; @@ -2560,6 +2594,6 @@ void Sprite3DCubeMapTest::addNewSpriteWithCoords(Vec2 p) _skyBox->reload(); _skyBox->setTexture(_textureCube); }); - Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1); + Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, 1); #endif } diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h index 1ece434a00..c9b1d32b0a 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h @@ -293,7 +293,12 @@ public: void addNewSpriteWithCoords(Vec2 p); + void switchAnimationQualityCallback(Ref* sender); void onTouchesEnded(const std::vector& touches, Event* event) override; +private: + std::vector _sprits; + bool _highQuality; + MenuItemFont* _menuItem; }; class Sprite3DWithSkinOutlineTest : public Sprite3DTestDemo diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomWidgetCallbackBindTest/CustomWidgetCallbackBindTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomWidgetCallbackBindTest/CustomWidgetCallbackBindTest.cpp index 7159c5fe27..7e963fc9c8 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomWidgetCallbackBindTest/CustomWidgetCallbackBindTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomWidgetCallbackBindTest/CustomWidgetCallbackBindTest.cpp @@ -4,6 +4,7 @@ #include "../../CustomGUIScene.h" #include "cocostudio/ActionTimeline/CSLoader.h" +#include "cocostudio/CocoStudio.h" #include "base/ObjectFactory.h" @@ -31,6 +32,13 @@ void CustomWidgetCallbackBindScene::onEnter() addChild(pMenu, 1); } +void CustomWidgetCallbackBindScene::onExit() +{ + cocostudio::destroyCocosStudio(); + + Scene::onExit(); +} + void CustomWidgetCallbackBindScene::runThisTest() { CSLoader* instance = CSLoader::getInstance(); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomWidgetCallbackBindTest/CustomWidgetCallbackBindTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomWidgetCallbackBindTest/CustomWidgetCallbackBindTest.h index a7c54b0729..74f551e1ab 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomWidgetCallbackBindTest/CustomWidgetCallbackBindTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomWidgetCallbackBindTest/CustomWidgetCallbackBindTest.h @@ -10,6 +10,7 @@ class CustomWidgetCallbackBindScene : public TestScene { public: virtual void onEnter() override; + virtual void onExit() override; virtual void runThisTest(); void BackCallback(cocos2d::Ref* pSender); }; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp index 3167007133..8f0dcb94e6 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp @@ -19,6 +19,13 @@ UIScene_Editor::~UIScene_Editor() } +void UIScene_Editor::onExit() +{ + cocostudio::destroyCocosStudio(); + + Layer::onExit(); +} + bool UIScene_Editor::init() { if (CCLayer::init()) diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.h index 15f80cfd2f..a650d5f1e7 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.h @@ -59,6 +59,8 @@ public: UIScene_Editor(); ~UIScene_Editor(); + virtual void onExit() override; + bool init(); virtual void previousCallback(Ref* sender, Widget::TouchEventType event); virtual void nextCallback(Ref* sender, Widget::TouchEventType event); diff --git a/tests/cpp-tests/Resources/Sprite3DTest/cube_map.frag b/tests/cpp-tests/Resources/Sprite3DTest/cube_map.frag index 69f05b6cdb..0ba884df3d 100644 --- a/tests/cpp-tests/Resources/Sprite3DTest/cube_map.frag +++ b/tests/cpp-tests/Resources/Sprite3DTest/cube_map.frag @@ -1,8 +1,12 @@ +#ifdef GL_ES +precision mediump float; +#endif -varying vec3 v_reflect; +varying vec3 v_reflect; uniform samplerCube u_cubeTex; +uniform vec4 u_color; void main(void) { - gl_FragColor = textureCube(u_cubeTex, v_reflect); -} \ No newline at end of file + gl_FragColor = textureCube(u_cubeTex, v_reflect) * u_color; +} diff --git a/tests/cpp-tests/Resources/configs/config-example.plist b/tests/cpp-tests/Resources/configs/config-example.plist index 9065fd2e08..5f7e5c0023 100755 --- a/tests/cpp-tests/Resources/configs/config-example.plist +++ b/tests/cpp-tests/Resources/configs/config-example.plist @@ -22,6 +22,8 @@ 1 cocos2d.x.3d.max_spot_light_in_shader 1 + cocos2d.x.3d.animate_high_quality + metadata diff --git a/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua b/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua index 36f376e040..e977c54df8 100644 --- a/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua +++ b/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua @@ -1025,70 +1025,147 @@ function AsyncLoadSprite3DTest:onEnter() end function AsyncLoadSprite3DTest:onExit() +end ---------------------------------------- ----Sprite3DCubeTexture ---------------------------------------- -local Sprite3DCubeMap = {} -Sprite3DCubeMap.__index = Sprite3DCubeMap +local Sprite3DCubeMapTest = class("Sprite3DCubeMapTest", function () + local layer = cc.Layer:create() + Helper.initWithLayer(layer) + return layer +end) -function Sprite3DCubeMap.create() -local layer = cc.Layer:create() -Helper.initWithLayer(layer) -Helper.titleLabel:setString("Sprite3D CubeMap/Skybox Test") - -local visSize = cc.Director:getInstance():getVisibleSize() -local camera = cc.Camera:createPerspective(68, visSize.width / visSize.height, 0.1, 200) -camera:setCameraFlag(2) -layer:addChild(camera) - -local fileName = "Sprite3DTest/teapot.c3b" -local teapot = cc.Sprite3D:create(fileName) -teapot:setPosition3D({x = 0, y = -5, z = -20}) -teapot:setRotation3D({x = -90, y = 180, z = 0}) - -local texCube = cc.TextureCube:create("Sprite3DTest/skybox/left.jpg", "Sprite3DTest/skybox/right.jpg", - "Sprite3DTest/skybox/top.jpg", "Sprite3DTest/skybox/bottom.jpg", - "Sprite3DTest/skybox/front.jpg", "Sprite3DTest/skybox/back.jpg"); - -local program = cc.GLProgram:createWithFilenames("Sprite3DTest/cube_map.vert", "Sprite3DTest/cube_map.frag") -local state = cc.GLProgramState:create(program) - -attriNames = { - "a_position", "a_color", - "a_texCoord", "a_texCoord1", "a_texCoord2", "a_texCoord3", - "a_normal", "a_blendWeight", "a_blendIndex" - } - ---pass mesh's attribute to shader -local offset = 0 -local attributeCount = teapot:getMesh():getMeshVertexAttribCount() -for i = 0, attributeCount-1 do - local meshattribute = teapot:getMesh():getMeshVertexAttribute(i) - state:setVertexAttribPointer(attriNames[meshattribute.vertexAttrib+1], - meshattribute.size, - meshattribute.type, - false, - teapot:getMesh():getVertexSizeInBytes(), - offset); - offset = offset + meshattribute.attribSizeBytes +function Sprite3DCubeMapTest:ctor() + -- body + self:init() + self._textureCube = nil + self._skyBox = nil + self._teapot = nil end -state:setUniformTexture("u_cubeTex", texCube:getName()) +function Sprite3DCubeMapTest:init() + Helper.titleLabel:setString(self:title()) + Helper.subtitleLabel:setString(self:subtitle()) -teapot:setGLProgramState(state) -teapot:setCameraMask(2) + self:registerScriptHandler(function (event) + if event == "enter" then + self:onEnter() + elseif event == "exit" then + self:onExit() + end + end) +end -local rotate_action = cc.RotateBy:create(1.5, { x = 0.0, y = 30.0, z = 0.0}) -teapot:runAction(cc.RepeatForever:create(rotate_action)); -layer:addChild(teapot) +function Sprite3DCubeMapTest:title() + return "CubeMap & Skybox Test" +end -local skybox = cc.Skybox:create() -skybox:setTexture(texCube) -layer:addChild(skybox) +function Sprite3DCubeMapTest:subtitle() + return "" +end -return layer ->>>>>>> 4ea27173daf6b04cf0b917faa7911dde448cbdca +function Sprite3DCubeMapTest:onEnter() + local s = cc.Director:getInstance():getWinSize() + self:addNewSpriteWithCoords(cc.p(s.width / 2, s.height / 2)) +end + +function Sprite3DCubeMapTest:onExit() + local targetPlatform = cc.Application:getInstance():getTargetPlatform() + if targetPlatform == cc.PLATFORM_OS_ANDROID or targetPlatform == cc.PLATFORM_OS_WINRT or targetPlatform == cc.PLATFORM_OS_WP8 then + cc.Director:getInstance():getEventDispatcher():removeEventListener(self._backToForegroundListener) + end +end + +function Sprite3DCubeMapTest:addNewSpriteWithCoords(pos) + local visibleSize = cc.Director:getInstance():getVisibleSize() + local camera = cc.Camera:createPerspective(60, visibleSize.width / visibleSize.height, 0.1, 200) + camera:setCameraFlag(cc.CameraFlag.USER1) + --create a teapot + self._teapot = cc.Sprite3D:create("Sprite3DTest/teapot.c3b") + + local shader = cc.GLProgram:createWithFilenames("Sprite3DTest/cube_map.vert", "Sprite3DTest/cube_map.frag") + local state = cc.GLProgramState:create(shader) + + self._textureCube = cc.TextureCube:create("Sprite3DTest/skybox/left.jpg", "Sprite3DTest/skybox/right.jpg", + "Sprite3DTest/skybox/top.jpg", "Sprite3DTest/skybox/bottom.jpg", + "Sprite3DTest/skybox/front.jpg", "Sprite3DTest/skybox/back.jpg") + + --set texture parameters + local tRepeatParams = { magFilter=gl.NEAREST , minFilter=gl.NEAREST , wrapS=gl.MIRRORED_REPEAT , wrapT=gl.MIRRORED_REPEAT } + self._textureCube:setTexParameters(tRepeatParams) + + --pass the texture sampler to our custom shader + state:setUniformTexture("u_cubeTex", self._textureCube) + + self._teapot:setGLProgramState(state) + self._teapot:setPosition3D(cc.vec3(0, -5, -20)) + self._teapot:setRotation3D(cc.vec3(-90, 180, 0)) + + local rotate_action = cc.RotateBy:create(1.5, cc.vec3(0, 30, 0)) + self._teapot:runAction(cc.RepeatForever:create(rotate_action)) + + --pass mesh's attribute to shader + + local attributeNames = + { + "a_position", + "a_color", + "a_texCoord", + "a_texCoord1", + "a_texCoord2", + "a_texCoord3", + "a_normal", + "a_blendWeight", + "a_blendIndex", + } + + local offset = 0 + local attributeCount = self._teapot:getMesh():getMeshVertexAttribCount() + for i = 1, attributeCount do + local meshattribute = self._teapot:getMesh():getMeshVertexAttribute(i - 1) + state:setVertexAttribPointer(attributeNames[meshattribute.vertexAttrib+1], + meshattribute.size, + meshattribute.type, + false, + self._teapot:getMesh():getVertexSizeInBytes(), + offset) + offset = offset + meshattribute.attribSizeBytes + end + + self:addChild(self._teapot) + self:addChild(camera) + + self:setCameraMask(2) + + --config skybox + self._skyBox = cc.Skybox:create() + + self._skyBox:setTexture(self._textureCube) + self:addChild(self._skyBox) + + local targetPlatform = cc.Application:getInstance():getTargetPlatform() + if targetPlatform == cc.PLATFORM_OS_ANDROID or targetPlatform == cc.PLATFORM_OS_WINRT or targetPlatform == cc.PLATFORM_OS_WP8 then + self._backToForegroundListener = cc.EventListenerCustom:create("event_renderer_recreated", function (eventCustom) + + local state = self._teapot:getGLProgramState() + local glProgram = state:getGLProgram() + glProgramreset() + glProgram:initWithFilenames("Sprite3DTest/cube_map.vert", "Sprite3DTest/cube_map.frag") + glProgram:link() + glProgram:updateUniforms() + + self._textureCube:reloadTexture() + + local tRepeatParams = { magFilter=gl.NEAREST , minFilter=gl.NEAREST , wrapS=gl.MIRRORED_REPEAT , wrapT=gl.MIRRORED_REPEAT } + self._textureCube:setTexParameters(tRepeatParams) + state:setUniformTexture("u_cubeTex", self._textureCube) + + self._skyBox:reload() + self._skyBox:setTexture(self._textureCube) + end) + cc.Director:getInstance():getEventDispatcher():addEventListenerWithFixedPriority(self._backToForegroundListener, -1) + end end function Sprite3DTest() @@ -1105,7 +1182,7 @@ function Sprite3DTest() Sprite3DWithOBBPerfromanceTest.create, Sprite3DMirrorTest.create, AsyncLoadSprite3DTest.create, - Sprite3DCubeMap.create, + Sprite3DCubeMapTest.create, } scene:addChild(Sprite3DBasicTest.create()) diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index 06a3865007..4f6789c6e7 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -45,7 +45,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS Layer.*::[didAccelerate keyPressed keyReleased], Menu.*::[.*Target getSubItems create initWithItems alignItemsInRows alignItemsInColumns], MenuItem.*::[create setCallback initWithCallback], - Label::[getLettersInfo createWithTTF listenToBackground listenToFontAtlasPurge], + Label::[createWithTTF], Copying::[*], LabelProtocol::[*], LabelTextFormatProtocol::[*], @@ -136,12 +136,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS Bone3D::[*], Device::[getTextureDataForText], BillBoard::[*], - Camera::[unproject], - BaseLight3D::[*], - DirectionLight3D::[*], - PointLight3D::[*], - SpotLight3D::[*], - AmbientLight3D::[*] + Camera::[unproject] rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame], ProgressTimer::[setReverseProgress=setReverseDirection], diff --git a/tools/tolua/cocos2dx_3d.ini b/tools/tolua/cocos2dx_3d.ini index d5d143d4c6..15aada2fbc 100644 --- a/tools/tolua/cocos2dx_3d.ini +++ b/tools/tolua/cocos2dx_3d.ini @@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos/cocos2d.h # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". -classes = Animate3D Sprite3D Animation3D Skeleton3D ^Mesh$ AttachNode BillBoard Sprite3DCache +classes = Animate3D Sprite3D Animation3D Skeleton3D ^Mesh$ AttachNode BillBoard Sprite3DCache TextureCube Skybox # 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 diff --git a/tools/tolua/cocos2dx_extension.ini b/tools/tolua/cocos2dx_extension.ini index 0d9b3e748a..f0be7cde17 100644 --- a/tools/tolua/cocos2dx_extension.ini +++ b/tools/tolua/cocos2dx_extension.ini @@ -40,12 +40,11 @@ skip = .*Delegate::[*], .*Loader.*::[*], *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate .*HSV], EditBox::[(g|s)etDelegate ^keyboard.* touchDownAction getScriptEditBoxHandler registerScriptEditBoxHandler unregisterScriptEditBoxHandler], - Control::[removeHandleOfControlEvent addHandleOfControlEvent], ControlUtils::[*], ControlSwitchSprite::[*], ScrollView::[(g|s)etDelegate$], TableView::[create (g|s)etDataSource$ (g|s)etDelegate], - Manifest::[getAssets getAsset], + Manifest::[getAssets], EventListenerAssetsManagerEx::[create], PUParticleSystem3D::[getDerivedOrientation getEmittedEmitterParticlePool getEmittedSystemParticlePool getAffector getEmitter getObserver], ParticlePool::[getActiveParticleList createParticle getNext getFirst], diff --git a/tools/tolua/cocos2dx_ui.ini b/tools/tolua/cocos2dx_ui.ini index e56f7f4852..d6b7c70c90 100644 --- a/tools/tolua/cocos2dx_ui.ini +++ b/tools/tolua/cocos2dx_ui.ini @@ -30,7 +30,7 @@ headers = %(cocosdir)s/cocos/ui/CocosGUI.h # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". -classes = Helper Widget Layer Layout RootWidget Button CheckBox ImageView Text TextAtlas TextBMFont LoadingBar Slider Switch TextField ScrollView ListView PageView LayoutParameter LinearLayoutParameter RelativeLayoutParameter Rich.* HBox VBox RelativeBox Scale9Sprite EditBox LayoutComponent +classes = Helper Widget Layout Button CheckBox ImageView Text TextAtlas TextBMFont LoadingBar Slider TextField ScrollView ListView PageView LayoutParameter LinearLayoutParameter RelativeLayoutParameter Rich.* HBox VBox RelativeBox Scale9Sprite EditBox LayoutComponent # 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 @@ -40,11 +40,8 @@ classes = Helper Widget Layer Layout RootWidget Button CheckBox ImageView Text T # functions from all classes. skip = *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType .*HSV onTouch.* onAcc.* onKey.* onRegisterTouchListener ccTouch.* (g|s)etDelegate], - Widget::[(s|g)etUserObject addTouchEventListener addClickEventListener addCCSEventListener], - Layer::[getInputManager], - LayoutParameter::[(s|g)etMargin], - Helper::[init], - ImageView::[doubleClickEvent checkDoubleClick] + Widget::[addTouchEventListener addClickEventListener addCCSEventListener], + LayoutParameter::[(s|g)etMargin] rename_functions =