Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into terrain

Resovle Conflicts:
	cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters
This commit is contained in:
tangziwen 2015-04-03 15:45:51 +08:00
commit 0193420dfc
242 changed files with 2135 additions and 576 deletions

View File

@ -540,6 +540,7 @@ Developers:
hawkwood (Justin Hawkwood) hawkwood (Justin Hawkwood)
Fixing a bug that EditBox doesn't show any text if it's initialized with text. 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) wtyqm (zhang peng)
Fixing a bug that ccbRootPath wasn't passed to sub ccb nodes. Fixing a bug that ccbRootPath wasn't passed to sub ccb nodes.

View File

@ -1,6 +1,8 @@
cocos2d-x-3.6beta0 Apr.14 2015 cocos2d-x-3.6beta0 Apr.14 2015
[NEW] 3D: added texturecub supported [NEW] 3D: added texturecub supported
[NEW] Animate3D: added `Animate3D::setHighQuality()` to set animation quality
[FIX] Audio: memory leak
[FIX] Sprite3D: memory leak [FIX] Sprite3D: memory leak
cocos2d-x-3.5 Mar.23 2015 cocos2d-x-3.5 Mar.23 2015

View File

@ -157,7 +157,7 @@ Select the test you want from Xcode Scheme chooser.
``` ```
$ cd cocos2d-x/build $ cd cocos2d-x/build
$ open cocos_tests.xcodeproj $ open cocos2d_tests.xcodeproj
``` ```
* For Linux * For Linux

View File

@ -1282,6 +1282,8 @@
38B8E2E219E671D2002D7CE7 /* UILayoutComponent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38B8E2DF19E671D2002D7CE7 /* UILayoutComponent.cpp */; }; 38B8E2E219E671D2002D7CE7 /* UILayoutComponent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38B8E2DF19E671D2002D7CE7 /* UILayoutComponent.cpp */; };
38B8E2E319E671D2002D7CE7 /* UILayoutComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */; }; 38B8E2E319E671D2002D7CE7 /* UILayoutComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */; };
38B8E2E419E671D2002D7CE7 /* 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 */; }; 38F5263E1A48363B000DB7F7 /* ArmatureNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */; };
38F5263F1A48363B000DB7F7 /* 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 */; }; 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 = "<group>"; }; 38B8E2D419E66581002D7CE7 /* CSLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSLoader.h; sourceTree = "<group>"; };
38B8E2DF19E671D2002D7CE7 /* UILayoutComponent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UILayoutComponent.cpp; sourceTree = "<group>"; }; 38B8E2DF19E671D2002D7CE7 /* UILayoutComponent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UILayoutComponent.cpp; sourceTree = "<group>"; };
38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILayoutComponent.h; sourceTree = "<group>"; }; 38B8E2E019E671D2002D7CE7 /* UILayoutComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILayoutComponent.h; sourceTree = "<group>"; };
38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CocoStudio.cpp; sourceTree = "<group>"; };
38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArmatureNodeReader.cpp; sourceTree = "<group>"; }; 38F5263B1A48363B000DB7F7 /* ArmatureNodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArmatureNodeReader.cpp; sourceTree = "<group>"; };
38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArmatureNodeReader.h; sourceTree = "<group>"; }; 38F5263C1A48363B000DB7F7 /* ArmatureNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArmatureNodeReader.h; sourceTree = "<group>"; };
38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSArmatureNode_generated.h; sourceTree = "<group>"; }; 38F5263D1A48363B000DB7F7 /* CSArmatureNode_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSArmatureNode_generated.h; sourceTree = "<group>"; };
@ -4876,6 +4879,7 @@
1A8C5984180E930E00EF57C3 /* CCUtilMath.cpp */, 1A8C5984180E930E00EF57C3 /* CCUtilMath.cpp */,
1A8C5985180E930E00EF57C3 /* CCUtilMath.h */, 1A8C5985180E930E00EF57C3 /* CCUtilMath.h */,
1A8C5986180E930E00EF57C3 /* CocoStudio.h */, 1A8C5986180E930E00EF57C3 /* CocoStudio.h */,
38D9629C1ACA9721007C6FAF /* CocoStudio.cpp */,
1A8C5989180E930E00EF57C3 /* DictionaryHelper.cpp */, 1A8C5989180E930E00EF57C3 /* DictionaryHelper.cpp */,
1A8C598A180E930E00EF57C3 /* DictionaryHelper.h */, 1A8C598A180E930E00EF57C3 /* DictionaryHelper.h */,
); );
@ -8617,6 +8621,7 @@
B665E2561AA80A6500DDB1C5 /* CCPUDoAffectorEventHandlerTranslator.cpp in Sources */, B665E2561AA80A6500DDB1C5 /* CCPUDoAffectorEventHandlerTranslator.cpp in Sources */,
15AE18A419AAD33D00C27E9E /* CCScale9SpriteLoader.cpp in Sources */, 15AE18A419AAD33D00C27E9E /* CCScale9SpriteLoader.cpp in Sources */,
182C5CD61A98F30500C30D34 /* Sprite3DReader.cpp in Sources */, 182C5CD61A98F30500C30D34 /* Sprite3DReader.cpp in Sources */,
38D9629D1ACA9721007C6FAF /* CocoStudio.cpp in Sources */,
B665E3D61AA80A6600DDB1C5 /* CCPUScriptParser.cpp in Sources */, B665E3D61AA80A6600DDB1C5 /* CCPUScriptParser.cpp in Sources */,
15AE1B5719AADA9900C27E9E /* UISlider.cpp in Sources */, 15AE1B5719AADA9900C27E9E /* UISlider.cpp in Sources */,
B665E2F61AA80A6500DDB1C5 /* CCPUListener.cpp in Sources */, B665E2F61AA80A6500DDB1C5 /* CCPUListener.cpp in Sources */,
@ -9060,6 +9065,7 @@
B665E3AF1AA80A6500DDB1C5 /* CCPURender.cpp in Sources */, B665E3AF1AA80A6500DDB1C5 /* CCPURender.cpp in Sources */,
382383FB1A258FA7002C4610 /* idl_gen_go.cpp in Sources */, 382383FB1A258FA7002C4610 /* idl_gen_go.cpp in Sources */,
B665E2EF1AA80A6500DDB1C5 /* CCPULineEmitter.cpp in Sources */, B665E2EF1AA80A6500DDB1C5 /* CCPULineEmitter.cpp in Sources */,
38D9629E1ACA9721007C6FAF /* CocoStudio.cpp in Sources */,
50ABBDBA1925AB4100A911A9 /* CCTextureAtlas.cpp in Sources */, 50ABBDBA1925AB4100A911A9 /* CCTextureAtlas.cpp in Sources */,
1A5702FB180BCE750088DEC7 /* CCTMXXMLParser.cpp in Sources */, 1A5702FB180BCE750088DEC7 /* CCTMXXMLParser.cpp in Sources */,
B665E40B1AA80A6600DDB1C5 /* CCPUSphereSurfaceEmitterTranslator.cpp in Sources */, B665E40B1AA80A6600DDB1C5 /* CCPUSphereSurfaceEmitterTranslator.cpp in Sources */,

View File

@ -49,6 +49,7 @@ class CC_DLL ActionCamera : public ActionInterval //<NSCopying>
public: public:
/** /**
* @js ctor * @js ctor
* @lua new
*/ */
ActionCamera(); ActionCamera();
/** /**

View File

@ -2,7 +2,7 @@
Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc. Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -33,13 +33,6 @@ THE SOFTWARE.
#include "deprecated/CCString.h" #include "deprecated/CCString.h"
#include <stdarg.h> #include <stdarg.h>
#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 NS_CC_BEGIN
static int _globalFontSize = kItemSize; static int _globalFontSize = kItemSize;
@ -65,7 +58,7 @@ MenuItem* MenuItem::create()
MenuItem* MenuItem::create(Ref *target, SEL_MenuHandler selector) MenuItem* MenuItem::create(Ref *target, SEL_MenuHandler selector)
{ {
MenuItem *ret = new (std::nothrow) MenuItem(); MenuItem *ret = new (std::nothrow) MenuItem();
ret->initWithTarget(target, selector); ret->initWithCallback(std::bind(selector, target, std::placeholders::_1));
ret->autorelease(); ret->autorelease();
return ret; return ret;
} }
@ -81,8 +74,6 @@ MenuItem* MenuItem::create( const ccMenuCallback& callback)
// FIXME: deprecated // FIXME: deprecated
bool MenuItem::initWithTarget(cocos2d::Ref *target, SEL_MenuHandler selector ) bool MenuItem::initWithTarget(cocos2d::Ref *target, SEL_MenuHandler selector )
{ {
_target = target;
CC_SAFE_RETAIN(_target);
return initWithCallback( std::bind(selector,target, std::placeholders::_1) ); return initWithCallback( std::bind(selector,target, std::placeholders::_1) );
} }
@ -102,7 +93,6 @@ MenuItem::~MenuItem()
void MenuItem::onExit() void MenuItem::onExit()
{ {
Node::onExit(); Node::onExit();
CC_SAFE_RELEASE(_target);
} }
void MenuItem::selected() void MenuItem::selected()
@ -159,8 +149,6 @@ bool MenuItem::isSelected() const
// FIXME: deprecated // FIXME: deprecated
void MenuItem::setTarget(Ref *target, SEL_MenuHandler selector) void MenuItem::setTarget(Ref *target, SEL_MenuHandler selector)
{ {
_target = target;
CC_SAFE_RETAIN(_target);
setCallback( std::bind( selector, target, std::placeholders::_1) ); 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 * MenuItemLabel::create(Node*label, Ref* target, SEL_MenuHandler selector)
{ {
MenuItemLabel *ret = new (std::nothrow) MenuItemLabel(); MenuItemLabel *ret = new (std::nothrow) MenuItemLabel();
ret->initWithLabel(label, target, selector); ret->initWithLabel(label, std::bind(selector, target, std::placeholders::_1));
ret->autorelease(); ret->autorelease();
return ret; return ret;
} }
@ -223,8 +211,6 @@ MenuItemLabel* MenuItemLabel::create(Node *label)
// FIXME:: deprecated // FIXME:: deprecated
bool MenuItemLabel::initWithLabel(Node* label, Ref* target, SEL_MenuHandler selector) 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) ); 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 * 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(); 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(); ret->autorelease();
return ret; return ret;
} }
@ -345,8 +331,6 @@ MenuItemAtlasFont * MenuItemAtlasFont::create(const std::string& value, const st
// FIXME:: deprecated // FIXME:: deprecated
bool MenuItemAtlasFont::initWithString(const std::string& value, const std::string& charMapFile, int itemWidth, int itemHeight, char startCharMap, Ref* target, SEL_MenuHandler selector) 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) ); 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 * MenuItemFont::create(const std::string& value, Ref* target, SEL_MenuHandler selector)
{ {
MenuItemFont *ret = new (std::nothrow) MenuItemFont(); MenuItemFont *ret = new (std::nothrow) MenuItemFont();
ret->initWithString(value, target, selector); ret->initWithString(value, std::bind(selector, target, std::placeholders::_1));
ret->autorelease(); ret->autorelease();
return ret; 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"); 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) ); return initWithString(value, std::bind(selector,target, std::placeholders::_1) );
} }
@ -552,7 +534,7 @@ MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite
// FIXME: deprecated // FIXME: deprecated
MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite, Ref* target, SEL_MenuHandler selector) 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) 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 * MenuItemSprite::create(Node *normalSprite, Node *selectedSprite, Node *disabledSprite, Ref *target, SEL_MenuHandler selector)
{ {
MenuItemSprite *ret = new (std::nothrow) MenuItemSprite(); 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(); ret->autorelease();
return ret; return ret;
} }
@ -580,8 +562,6 @@ MenuItemSprite * MenuItemSprite::create(Node *normalSprite, Node *selectedSprite
// FIXME: deprecated // FIXME: deprecated
bool MenuItemSprite::initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, Ref* target, SEL_MenuHandler selector) 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) ); 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 // FIXME: deprecated
MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std::string& selectedImage, Ref* target, SEL_MenuHandler selector) 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) 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 * 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(); 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(); ret->autorelease();
return ret; return ret;
@ -760,8 +740,6 @@ MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std:
// FIXME:: deprecated // FIXME:: deprecated
bool MenuItemImage::initWithNormalImage(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, Ref* target, SEL_MenuHandler selector) 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) ); 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) 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<MenuItem*>& menuItems) MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler selector, const Vector<MenuItem*>& menuItems)
{ {
MenuItemToggle *ret = new (std::nothrow) MenuItemToggle(); 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->_subItems = menuItems;
ret->_selectedIndex = UINT_MAX; ret->_selectedIndex = UINT_MAX;
ret->setSelectedIndex(0); ret->setSelectedIndex(0);
@ -836,7 +814,7 @@ MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler s
va_list args; va_list args;
va_start(args, item); va_start(args, item);
MenuItemToggle *ret = new (std::nothrow) MenuItemToggle(); 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(); ret->autorelease();
va_end(args); va_end(args);
return ret; return ret;
@ -877,8 +855,6 @@ MenuItemToggle * MenuItemToggle::create()
// FIXME:: deprecated // FIXME:: deprecated
bool MenuItemToggle::initWithTarget(Ref* target, SEL_MenuHandler selector, MenuItem* item, va_list args) 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); return initWithCallback(std::bind( selector, target, std::placeholders::_1), item, args);
} }
@ -995,9 +971,3 @@ MenuItem* MenuItemToggle::getSelectedItem()
} }
NS_CC_END 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

View File

@ -110,7 +110,6 @@ CC_CONSTRUCTOR_ACCESS:
: _selected(false) : _selected(false)
, _enabled(false) , _enabled(false)
, _callback(nullptr) , _callback(nullptr)
, _target(nullptr)
{} {}
/** /**
* @js NA * @js NA
@ -133,8 +132,6 @@ protected:
bool _enabled; bool _enabled;
// callback // callback
ccMenuCallback _callback; ccMenuCallback _callback;
// If using the old API, the _target needs to be retained / released
Ref *_target;
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(MenuItem); CC_DISALLOW_COPY_AND_ASSIGN(MenuItem);

View File

@ -51,7 +51,7 @@ TMXLayerInfo::TMXLayerInfo()
TMXLayerInfo::~TMXLayerInfo() TMXLayerInfo::~TMXLayerInfo()
{ {
CCLOGINFO("deallocing TMXLayerInfo: %p", this); CCLOGINFO("deallocing TMXLayerInfo: %p", this);
if( _ownTiles && _tiles ) if (_ownTiles && _tiles)
{ {
free(_tiles); free(_tiles);
_tiles = nullptr; _tiles = nullptr;
@ -62,6 +62,7 @@ ValueMap& TMXLayerInfo::getProperties()
{ {
return _properties; return _properties;
} }
void TMXLayerInfo::setProperties(ValueMap var) void TMXLayerInfo::setProperties(ValueMap var)
{ {
_properties = var; _properties = var;
@ -100,7 +101,7 @@ Rect TMXTilesetInfo::getRectForGID(uint32_t gid)
TMXMapInfo * TMXMapInfo::create(const std::string& tmxFile) TMXMapInfo * TMXMapInfo::create(const std::string& tmxFile)
{ {
TMXMapInfo *ret = new (std::nothrow) TMXMapInfo(); TMXMapInfo *ret = new (std::nothrow) TMXMapInfo();
if(ret->initWithTMXFile(tmxFile)) if (ret->initWithTMXFile(tmxFile))
{ {
ret->autorelease(); ret->autorelease();
return ret; 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 * TMXMapInfo::createWithXML(const std::string& tmxString, const std::string& resourcePath)
{ {
TMXMapInfo *ret = new (std::nothrow) TMXMapInfo(); TMXMapInfo *ret = new (std::nothrow) TMXMapInfo();
if(ret->initWithXML(tmxString, resourcePath)) if (ret->initWithXML(tmxString, resourcePath))
{ {
ret->autorelease(); ret->autorelease();
return ret; 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) void TMXMapInfo::internalInit(const std::string& tmxFileName, const std::string& resourcePath)
{ {
if (tmxFileName.size() > 0) if (!tmxFileName.empty())
{ {
_TMXFileName = FileUtils::getInstance()->fullPathForFilename(tmxFileName); _TMXFileName = FileUtils::getInstance()->fullPathForFilename(tmxFileName);
} }
if (resourcePath.size() > 0) if (!resourcePath.empty())
{ {
_resources = resourcePath; _resources = resourcePath;
} }
@ -142,6 +143,7 @@ void TMXMapInfo::internalInit(const std::string& tmxFileName, const std::string&
_parentElement = TMXPropertyNone; _parentElement = TMXPropertyNone;
_currentFirstGID = -1; _currentFirstGID = -1;
} }
bool TMXMapInfo::initWithXML(const std::string& tmxString, const std::string& resourcePath) bool TMXMapInfo::initWithXML(const std::string& tmxString, const std::string& resourcePath)
{ {
internalInit("", resourcePath); internalInit("", resourcePath);
@ -202,20 +204,19 @@ bool TMXMapInfo::parseXMLFile(const std::string& xmlFilename)
return parser.parse(FileUtils::getInstance()->fullPathForFilename(xmlFilename).c_str()); return parser.parse(FileUtils::getInstance()->fullPathForFilename(xmlFilename).c_str());
} }
// the XML parser calls here with all the elements // the XML parser calls here with all the elements
void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts) void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
{ {
CC_UNUSED_PARAM(ctx); CC_UNUSED_PARAM(ctx);
TMXMapInfo *tmxMapInfo = this; TMXMapInfo *tmxMapInfo = this;
std::string elementName = (char*)name; std::string elementName = name;
ValueMap attributeDict; ValueMap attributeDict;
if (atts && atts[0]) 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 key = atts[i];
std::string value = (char*)atts[i+1]; std::string value = atts[i+1];
attributeDict.insert(std::make_pair(key, Value(value))); 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()); CCLOG("cocos2d: TMXFormat: Unsupported TMX version: %s", version.c_str());
} }
std::string orientationStr = attributeDict["orientation"].asString(); std::string orientationStr = attributeDict["orientation"].asString();
if (orientationStr == "orthogonal") if (orientationStr == "orthogonal") {
tmxMapInfo->setOrientation(TMXOrientationOrtho); tmxMapInfo->setOrientation(TMXOrientationOrtho);
else if (orientationStr == "isometric") }
else if (orientationStr == "isometric") {
tmxMapInfo->setOrientation(TMXOrientationIso); tmxMapInfo->setOrientation(TMXOrientationIso);
else if(orientationStr == "hexagonal") }
else if (orientationStr == "hexagonal") {
tmxMapInfo->setOrientation(TMXOrientationHex); tmxMapInfo->setOrientation(TMXOrientationHex);
else if(orientationStr == "staggered") }
else if (orientationStr == "staggered") {
tmxMapInfo->setOrientation(TMXOrientationStaggered); tmxMapInfo->setOrientation(TMXOrientationStaggered);
else }
else {
CCLOG("cocos2d: TMXFomat: Unsupported orientation: %d", tmxMapInfo->getOrientation()); CCLOG("cocos2d: TMXFomat: Unsupported orientation: %d", tmxMapInfo->getOrientation());
}
Size s; Size s;
s.width = attributeDict["width"].asFloat(); 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" // The parent element is now "layer"
tmxMapInfo->setParentElement(TMXPropertyLayer); tmxMapInfo->setParentElement(TMXPropertyLayer);
} }
else if (elementName == "objectgroup") 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" // The parent element is now "objectgroup"
tmxMapInfo->setParentElement(TMXPropertyObjectGroup); tmxMapInfo->setParentElement(TMXPropertyObjectGroup);
} }
else if (elementName == "image") else if (elementName == "image")
{ {
@ -416,7 +420,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
tmxMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribBase64); tmxMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribBase64);
tmxMapInfo->setStoringCharacters(true); tmxMapInfo->setStoringCharacters(true);
if( compression == "gzip" ) if (compression == "gzip")
{ {
layerAttribs = tmxMapInfo->getLayerAttribs(); layerAttribs = tmxMapInfo->getLayerAttribs();
tmxMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribGzip); 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" ); CCASSERT( compression == "" || compression == "gzip" || compression == "zlib", "TMX: unsupported compression method" );
} }
} }
else if (elementName == "object") 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 // Create an instance of TMXObjectInfo to store the object and its properties
ValueMap dict; ValueMap dict;
// Parse everything automatically // 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]; Value value = attributeDict[key];
dict[key] = value; dict[key] = value;
} }
@ -468,9 +470,8 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
// Add the object to the objectGroup // Add the object to the objectGroup
objectGroup->getObjects().push_back(Value(dict)); objectGroup->getObjects().push_back(Value(dict));
// The parent element is now "object" // The parent element is now "object"
tmxMapInfo->setParentElement(TMXPropertyObject); tmxMapInfo->setParentElement(TMXPropertyObject);
} }
else if (elementName == "property") 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 // parse points string into a space-separated set of points
stringstream pointsStream(value); stringstream pointsStream(value);
string pointPair; string pointPair;
while(std::getline(pointsStream, pointPair, ' ')) while (std::getline(pointsStream, pointPair, ' '))
{ {
// parse each point combo into a comma-separated x,y point // parse each point combo into a comma-separated x,y point
stringstream pointStream(pointPair); stringstream pointStream(pointPair);
string xStr,yStr; string xStr, yStr;
ValueMap pointDict; ValueMap pointDict;
// set x // set x
if(std::getline(pointStream, xStr, ',')) if (std::getline(pointStream, xStr, ','))
{ {
int x = atoi(xStr.c_str()) + (int)objectGroup->getPositionOffset().x; int x = atoi(xStr.c_str()) + (int)objectGroup->getPositionOffset().x;
pointDict["x"] = Value(x); pointDict["x"] = Value(x);
} }
// set y // set y
if(std::getline(pointStream, yStr, ',')) if (std::getline(pointStream, yStr, ','))
{ {
int y = atoi(yStr.c_str()) + (int)objectGroup->getPositionOffset().y; int y = atoi(yStr.c_str()) + (int)objectGroup->getPositionOffset().y;
pointDict["y"] = Value(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 // parse points string into a space-separated set of points
stringstream pointsStream(value); stringstream pointsStream(value);
string pointPair; string pointPair;
while(std::getline(pointsStream, pointPair, ' ')) while (std::getline(pointsStream, pointPair, ' '))
{ {
// parse each point combo into a comma-separated x,y point // parse each point combo into a comma-separated x,y point
stringstream pointStream(pointPair); stringstream pointStream(pointPair);
string xStr,yStr; string xStr, yStr;
ValueMap pointDict; ValueMap pointDict;
// set x // set x
if(std::getline(pointStream, xStr, ',')) if (std::getline(pointStream, xStr, ','))
{ {
int x = atoi(xStr.c_str()) + (int)objectGroup->getPositionOffset().x; int x = atoi(xStr.c_str()) + (int)objectGroup->getPositionOffset().x;
pointDict["x"] = Value(x); pointDict["x"] = Value(x);
} }
// set y // set y
if(std::getline(pointStream, yStr, ',')) if (std::getline(pointStream, yStr, ','))
{ {
int y = atoi(yStr.c_str()) + (int)objectGroup->getPositionOffset().y; int y = atoi(yStr.c_str()) + (int)objectGroup->getPositionOffset().y;
pointDict["y"] = Value(y); pointDict["y"] = Value(y);
@ -616,11 +617,9 @@ void TMXMapInfo::endElement(void *ctx, const char *name)
{ {
CC_UNUSED_PARAM(ctx); CC_UNUSED_PARAM(ctx);
TMXMapInfo *tmxMapInfo = this; 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) if (tmxMapInfo->getLayerAttribs() & TMXLayerAttribBase64)
{ {
@ -630,14 +629,14 @@ void TMXMapInfo::endElement(void *ctx, const char *name)
std::string currentString = tmxMapInfo->getCurrentString(); std::string currentString = tmxMapInfo->getCurrentString();
unsigned char *buffer; unsigned char *buffer;
len = base64Decode((unsigned char*)currentString.c_str(), (unsigned int)currentString.length(), &buffer); auto len = base64Decode((unsigned char*)currentString.c_str(), (unsigned int)currentString.length(), &buffer);
if( ! buffer ) if (!buffer)
{ {
CCLOG("cocos2d: TiledMap: decode data error"); CCLOG("cocos2d: TiledMap: decode data error");
return; return;
} }
if( tmxMapInfo->getLayerAttribs() & (TMXLayerAttribGzip | TMXLayerAttribZlib) ) if (tmxMapInfo->getLayerAttribs() & (TMXLayerAttribGzip | TMXLayerAttribZlib))
{ {
unsigned char *deflated = nullptr; unsigned char *deflated = nullptr;
Size s = layer->_layerSize; Size s = layer->_layerSize;
@ -650,7 +649,7 @@ void TMXMapInfo::endElement(void *ctx, const char *name)
free(buffer); free(buffer);
buffer = nullptr; buffer = nullptr;
if( ! deflated ) if (!deflated)
{ {
CCLOG("cocos2d: TiledMap: inflate data error"); CCLOG("cocos2d: TiledMap: inflate data error");
return; return;
@ -669,7 +668,6 @@ void TMXMapInfo::endElement(void *ctx, const char *name)
{ {
_xmlTileIndex = 0; _xmlTileIndex = 0;
} }
} }
else if (elementName == "map") else if (elementName == "map")
{ {
@ -701,7 +699,7 @@ void TMXMapInfo::textHandler(void *ctx, const char *ch, int len)
{ {
CC_UNUSED_PARAM(ctx); CC_UNUSED_PARAM(ctx);
TMXMapInfo *tmxMapInfo = this; TMXMapInfo *tmxMapInfo = this;
std::string text((char*)ch,0,len); std::string text(ch, 0, len);
if (tmxMapInfo->isStoringCharacters()) if (tmxMapInfo->isStoringCharacters())
{ {

View File

@ -108,10 +108,13 @@ class CC_DLL TextFieldTTF : public Label, public IMEDelegate
{ {
public: public:
/** /**
* Default constructor.
* @js ctor * @js ctor
*/ */
TextFieldTTF(); TextFieldTTF();
/** /**
* Default destructor.
* @js NA * @js NA
* @lua NA * @lua NA
*/ */

View File

@ -102,6 +102,8 @@ public:
*/ */
void hideOutShowIn(void); void hideOutShowIn(void);
Scene* getInScene() const{ return _inScene; }
float getDuration() const { return _duration; }
// //
// Overrides // Overrides
// //

View File

@ -515,6 +515,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClCompile Include="..\editor-support\cocostudio\CCTween.cpp" /> <ClCompile Include="..\editor-support\cocostudio\CCTween.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCUtilMath.cpp" /> <ClCompile Include="..\editor-support\cocostudio\CCUtilMath.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CocoLoader.cpp" /> <ClCompile Include="..\editor-support\cocostudio\CocoLoader.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp" />
<ClCompile Include="..\editor-support\cocostudio\DictionaryHelper.cpp" /> <ClCompile Include="..\editor-support\cocostudio\DictionaryHelper.cpp" />
<ClCompile Include="..\editor-support\cocostudio\FlatBuffersSerialize.cpp" /> <ClCompile Include="..\editor-support\cocostudio\FlatBuffersSerialize.cpp" />
<ClCompile Include="..\editor-support\cocostudio\TriggerBase.cpp" /> <ClCompile Include="..\editor-support\cocostudio\TriggerBase.cpp" />

View File

@ -1798,6 +1798,9 @@
<ClCompile Include="..\editor-support\cocostudio\CCObjectExtensionData.cpp"> <ClCompile Include="..\editor-support\cocostudio\CCObjectExtensionData.cpp">
<Filter>cocostudio\json</Filter> <Filter>cocostudio\json</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h"> <ClInclude Include="..\physics\CCPhysicsBody.h">

View File

@ -949,6 +949,7 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CCTween.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CCTween.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CCUtilMath.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CCUtilMath.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoLoader.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoLoader.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoStudio.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\DictionaryHelper.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\DictionaryHelper.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\FlatBuffersSerialize.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\FlatBuffersSerialize.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\TriggerBase.cpp" /> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\TriggerBase.cpp" />

View File

@ -3318,6 +3318,9 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTerrain.cpp"> <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\3d\CCTerrain.cpp">
<Filter>3d</Filter> <Filter>3d</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\CocoStudio.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="2d"> <Filter Include="2d">

View File

@ -538,6 +538,7 @@
<ClInclude Include="..\editor-support\cocostudio\CCTween.h" /> <ClInclude Include="..\editor-support\cocostudio\CCTween.h" />
<ClInclude Include="..\editor-support\cocostudio\CCUtilMath.h" /> <ClInclude Include="..\editor-support\cocostudio\CCUtilMath.h" />
<ClInclude Include="..\editor-support\cocostudio\CocoLoader.h" /> <ClInclude Include="..\editor-support\cocostudio\CocoLoader.h" />
<ClInclude Include="..\editor-support\cocostudio\CocoStudio.h" />
<ClInclude Include="..\editor-support\cocostudio\CSParseBinary_generated.h" /> <ClInclude Include="..\editor-support\cocostudio\CSParseBinary_generated.h" />
<ClInclude Include="..\editor-support\cocostudio\CSParse3DBinary_generated.h" /> <ClInclude Include="..\editor-support\cocostudio\CSParse3DBinary_generated.h" />
<ClInclude Include="..\editor-support\cocostudio\DictionaryHelper.h" /> <ClInclude Include="..\editor-support\cocostudio\DictionaryHelper.h" />
@ -1179,6 +1180,7 @@
<ClCompile Include="..\editor-support\cocostudio\CCTween.cpp" /> <ClCompile Include="..\editor-support\cocostudio\CCTween.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCUtilMath.cpp" /> <ClCompile Include="..\editor-support\cocostudio\CCUtilMath.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CocoLoader.cpp" /> <ClCompile Include="..\editor-support\cocostudio\CocoLoader.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp" />
<ClCompile Include="..\editor-support\cocostudio\DictionaryHelper.cpp" /> <ClCompile Include="..\editor-support\cocostudio\DictionaryHelper.cpp" />
<ClCompile Include="..\editor-support\cocostudio\FlatBuffersSerialize.cpp" /> <ClCompile Include="..\editor-support\cocostudio\FlatBuffersSerialize.cpp" />
<ClCompile Include="..\editor-support\cocostudio\TriggerBase.cpp" /> <ClCompile Include="..\editor-support\cocostudio\TriggerBase.cpp" />

View File

@ -1815,6 +1815,9 @@
<ClCompile Include="..\3d\CCTextureCube.cpp"> <ClCompile Include="..\3d\CCTextureCube.cpp">
<Filter>3d</Filter> <Filter>3d</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="CCAction.h"> <ClInclude Include="CCAction.h">
@ -3528,6 +3531,9 @@
<ClInclude Include="..\3d\CCTextureCube.h"> <ClInclude Include="..\3d\CCTextureCube.h">
<Filter>3d</Filter> <Filter>3d</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CocoStudio.h">
<Filter>cocostudio\json</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\math\Mat4.inl"> <None Include="..\math\Mat4.inl">

View File

@ -44,11 +44,13 @@ class CC_DLL AABB
public: public:
/** /**
* Constructor. * Constructor.
* @lua new
*/ */
AABB(); AABB();
/** /**
* Constructor. * Constructor.
* @lua new
*/ */
AABB(const Vec3& min, const Vec3& max); AABB(const Vec3& min, const Vec3& max);
@ -122,7 +124,7 @@ public:
Vec3 _max; Vec3 _max;
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -26,6 +26,7 @@
#include "3d/CCSprite3D.h" #include "3d/CCSprite3D.h"
#include "3d/CCSkeleton3D.h" #include "3d/CCSkeleton3D.h"
#include "platform/CCFileUtils.h" #include "platform/CCFileUtils.h"
#include "base/CCConfiguration.h"
NS_CC_BEGIN NS_CC_BEGIN
@ -68,6 +69,7 @@ bool Animate3D::init(Animation3D* animation)
animation->retain(); animation->retain();
setDuration(animation->getDuration()); setDuration(animation->getDuration());
setOriginInterval(animation->getDuration()); setOriginInterval(animation->getDuration());
setHighQuality(Configuration::getInstance()->isHighAnimate3DQuality());
return true; return true;
} }
@ -83,6 +85,7 @@ bool Animate3D::init(Animation3D* animation, float fromTime, float duration)
setOriginInterval(duration); setOriginInterval(duration);
_animation = animation; _animation = animation;
animation->retain(); animation->retain();
setHighQuality(Configuration::getInstance()->isHighAnimate3DQuality());
return true; return true;
} }
@ -310,28 +313,26 @@ void Animate3D::update(float t)
t = 1 - t; t = 1 - t;
t = _start + t * _last; t = _start + t * _last;
for (const auto& it : _boneCurves)
{ for (const auto& it : _boneCurves) {
for (const auto& it : _boneCurves) { auto bone = it.first;
auto bone = it.first; auto curve = it.second;
auto curve = it.second; if (curve->translateCurve)
if (curve->translateCurve) {
{ curve->translateCurve->evaluate(t, transDst, _translateEvaluate);
curve->translateCurve->evaluate(t, transDst, EvaluateType::INT_LINEAR); trans = &transDst[0];
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);
} }
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) for (const auto& it : _nodeCurves)
@ -341,18 +342,18 @@ void Animate3D::update(float t)
Mat4 transform; Mat4 transform;
if (curve->translateCurve) 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]); transform.translate(transDst[0], transDst[1], transDst[2]);
} }
if (curve->rotCurve) 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]); Quaternion qua(rotDst[0], rotDst[1], rotDst[2], rotDst[3]);
transform.rotate(qua); transform.rotate(qua);
} }
if (curve->scaleCurve) 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]); transform.scale(scaleDst[0], scaleDst[1], scaleDst[2]);
} }
node->setAdditionalTransform(&transform); node->setAdditionalTransform(&transform);
@ -383,6 +384,28 @@ void Animate3D::setOriginInterval(float interval)
_originInterval = 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() Animate3D::Animate3D()
: _state(Animate3D::Animate3DState::Running) : _state(Animate3D::Animate3DState::Running)
, _animation(nullptr) , _animation(nullptr)
@ -395,7 +418,7 @@ Animate3D::Animate3D()
, _lastTime(0.0f) , _lastTime(0.0f)
, _originInterval(0.0f) , _originInterval(0.0f)
{ {
setHighQuality(true);
} }
Animate3D::~Animate3D() Animate3D::~Animate3D()
{ {
@ -410,12 +433,9 @@ void Animate3D::removeFromMap()
if (_target) if (_target)
{ {
Sprite3D* sprite = static_cast<Sprite3D*>(_target); Sprite3D* sprite = static_cast<Sprite3D*>(_target);
if (_state == Animate3D::Animate3DState::FadeIn) s_fadeInAnimates.erase(sprite);
s_fadeInAnimates.erase(sprite); s_fadeOutAnimates.erase(sprite);
else if (_state == Animate3D::Animate3DState::FadeOut) s_runningAnimates.erase(sprite);
s_fadeOutAnimates.erase(sprite);
else
s_runningAnimates.erase(sprite);
} }
} }

View File

@ -105,6 +105,17 @@ public:
CC_DEPRECATED_ATTRIBUTE bool getPlayBack() const { return _playReverse; } CC_DEPRECATED_ATTRIBUTE bool getPlayBack() const { return _playReverse; }
CC_DEPRECATED_ATTRIBUTE void setPlayBack(bool reverse) { _playReverse = reverse; } 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: CC_CONSTRUCTOR_ACCESS:
Animate3D(); Animate3D();
@ -137,6 +148,13 @@ protected:
float _accTransTime; // acculate transition time float _accTransTime; // acculate transition time
float _lastTime; // last t (0 - 1) float _lastTime; // last t (0 - 1)
float _originInterval;// save origin interval time 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<Bone3D*, Animation3D::Curve*> _boneCurves; //weak ref std::unordered_map<Bone3D*, Animation3D::Curve*> _boneCurves; //weak ref
std::unordered_map<Node*, Animation3D::Curve*> _nodeCurves; std::unordered_map<Node*, Animation3D::Curve*> _nodeCurves;
@ -146,7 +164,7 @@ protected:
static std::unordered_map<Node*, Animate3D*> s_runningAnimates; static std::unordered_map<Node*, Animate3D*> s_runningAnimates;
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -54,25 +54,36 @@ public:
public: public:
typedef AnimationCurve<3> AnimationCurveVec3; typedef AnimationCurve<3> AnimationCurveVec3;
typedef AnimationCurve<4> AnimationCurveQuat; typedef AnimationCurve<4> AnimationCurveQuat;
AnimationCurveVec3* translateCurve; //translate curve /**translation curve*/
AnimationCurveQuat* rotCurve;//rotation curve AnimationCurveVec3* translateCurve;
AnimationCurveVec3* scaleCurve;//scale curve /**rotation curve*/
AnimationCurveQuat* rotCurve;
/**scaling curve*/
AnimationCurveVec3* scaleCurve;
/**constructor */
Curve(); Curve();
/**constructor */
~Curve(); ~Curve();
}; };
/**read all animation or only the animation with given animationName? animationName == "" read the first.*/ /**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 = ""); 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); } CC_DEPRECATED_ATTRIBUTE static Animation3D* getOrCreate(const std::string& filename, const std::string& animationName = ""){ return create(filename, animationName); }
/**get duration*/ /**get duration*/
float getDuration() const { return _duration; } float getDuration() const { return _duration; }
/**get bone curve*/ /**
* get bone curve
*
* @lua NA
*/
Curve* getBoneCurveByName(const std::string& name) const; Curve* getBoneCurveByName(const std::string& name) const;
/**get the bone Curves set*/
const std::unordered_map<std::string, Curve*>& getBoneCurves() const {return _boneCurves;} const std::unordered_map<std::string, Curve*>& getBoneCurves() const {return _boneCurves;}
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
@ -120,7 +131,7 @@ protected:
std::unordered_map<std::string, Animation3D*> _animations; //cached animations std::unordered_map<std::string, Animation3D*> _animations; //cached animations
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -54,6 +54,8 @@ enum class EvaluateType
/** /**
* @brief curve of bone's position, rotation or scale * @brief curve of bone's position, rotation or scale
*
* @lua NA
*/ */
template <int componentSize> template <int componentSize>
class AnimationCurve: public Ref class AnimationCurve: public Ref
@ -100,7 +102,7 @@ protected:
std::function<void(float time, float* dst)> _evaluateFun; //user defined function std::function<void(float time, float* dst)> _evaluateFun; //user defined function
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -68,7 +68,7 @@ protected:
mutable Mat4 _transformToParent; mutable Mat4 _transformToParent;
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -45,7 +45,7 @@ public:
VIEW_POINT_ORIENTED, // orient to the camera VIEW_POINT_ORIENTED, // orient to the camera
VIEW_PLANE_ORIENTED // orient to the XOY plane of camera VIEW_PLANE_ORIENTED // orient to the XOY plane of camera
}; };
/// @{
/// @name Creators /// @name Creators
/** /**
@ -96,7 +96,11 @@ public:
/** update billboard's transform and turn it towards camera */ /** update billboard's transform and turn it towards camera */
virtual void visit(Renderer *renderer, const Mat4& parentTransform, uint32_t parentFlags) override; 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; 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 NS_CC_END

View File

@ -874,9 +874,11 @@ bool Bundle3D::loadMaterialsBinary(MaterialDatas& materialdatas)
{ {
NMaterialData materialData; NMaterialData materialData;
materialData.id = _binaryReader.readString(); materialData.id = _binaryReader.readString();
// skip: diffuse(3), ambient(3), emissive(3), opacity(1), specular(3), shininess(1)
float data[14]; float data[14];
_binaryReader.read(&data,sizeof(float), 14); _binaryReader.read(&data,sizeof(float), 14);
unsigned int textruenum = 1; unsigned int textruenum = 1;
_binaryReader.read(&textruenum, 4, 1); _binaryReader.read(&textruenum, 4, 1);
for(unsigned int j = 0; j < textruenum ; j++ ) for(unsigned int j = 0; j < textruenum ; j++ )

View File

@ -45,6 +45,7 @@ class Data;
* c3t text file * c3t text file
* c3b binary file * c3b binary file
* @js NA * @js NA
* @lua NA
*/ */
class CC_DLL Bundle3D class CC_DLL Bundle3D
{ {
@ -181,7 +182,7 @@ protected:
bool _isBinary; bool _isBinary;
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -37,6 +37,7 @@ NS_CC_BEGIN
/**mesh vertex attribute /**mesh vertex attribute
* @js NA * @js NA
* @lua NA
*/ */
struct MeshVertexAttrib struct MeshVertexAttrib
{ {
@ -53,6 +54,7 @@ struct MeshVertexAttrib
/** model node data, since 3.3 /** model node data, since 3.3
* @js NA * @js NA
* @lua NA
*/ */
struct ModelData struct ModelData
{ {
@ -74,6 +76,7 @@ struct ModelData
/** Node data, since 3.3 /** Node data, since 3.3
* @js NA * @js NA
* @lua NA
*/ */
struct NodeData struct NodeData
{ {
@ -107,6 +110,7 @@ struct NodeData
/** node datas, since 3.3 /** node datas, since 3.3
* @js NA * @js NA
* @lua NA
*/ */
struct NodeDatas struct NodeDatas
{ {
@ -130,6 +134,7 @@ struct NodeDatas
/**mesh data /**mesh data
* @js NA * @js NA
* @lua NA
*/ */
struct MeshData struct MeshData
{ {
@ -185,6 +190,7 @@ public:
/** mesh datas /** mesh datas
* @js NA * @js NA
* @lua NA
*/ */
struct MeshDatas struct MeshDatas
{ {
@ -206,6 +212,7 @@ struct MeshDatas
/**skin data /**skin data
* @js NA * @js NA
* @lua NA
*/ */
struct SkinData struct SkinData
{ {
@ -277,6 +284,7 @@ struct SkinData
/**material data, /**material data,
* @js NA * @js NA
* @lua NA
*/ */
struct MaterialData struct MaterialData
{ {
@ -290,6 +298,7 @@ struct MaterialData
/**new material, since 3.3 /**new material, since 3.3
* @js NA * @js NA
* @lua NA
*/ */
struct NTextureData struct NTextureData
{ {
@ -328,6 +337,7 @@ struct NMaterialData
}; };
/** material datas, since 3.3 /** material datas, since 3.3
* @js NA * @js NA
* @lua NA
*/ */
struct MaterialDatas struct MaterialDatas
{ {
@ -348,6 +358,7 @@ struct MaterialDatas
}; };
/**animation data /**animation data
* @js NA * @js NA
* @lua NA
*/ */
struct Animation3DData struct Animation3DData
{ {
@ -420,6 +431,7 @@ public:
/**reference data /**reference data
* @js NA * @js NA
* @lua NA
*/ */
struct Reference struct Reference
{ {

View File

@ -42,6 +42,7 @@ NS_CC_BEGIN
/** /**
* @brief BundleReader is an interface for reading sequence of bytes. * @brief BundleReader is an interface for reading sequence of bytes.
* @js NA * @js NA
* @lua NA
*/ */
class BundleReader: public cocos2d::Ref class BundleReader: public cocos2d::Ref
{ {
@ -128,6 +129,8 @@ private:
char* _buffer; char* _buffer;
}; };
/// @cond
/** /**
* template read routines * template read routines
*/ */
@ -207,7 +210,9 @@ inline bool BundleReader::readArray<std::string>(unsigned int *length, std::vect
return true; return true;
} }
// end of actions group /// @endcond
// end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -39,6 +39,7 @@ class Camera;
* the frustum is a six-side geometry, usually use the frustum to do fast-culling: * the frustum is a six-side geometry, usually use the frustum to do fast-culling:
* check a entity whether is a potential visible entity * check a entity whether is a potential visible entity
* @js NA * @js NA
* @lua NA
*/ */
class CC_DLL Frustum class CC_DLL Frustum
{ {

View File

@ -59,14 +59,28 @@ public:
/**create mesh with vertex attributes*/ /**create mesh with vertex attributes*/
CC_DEPRECATED_ATTRIBUTE static Mesh* create(const std::vector<float>& vertices, int perVertexSizeInFloat, const IndexArray& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount){ return create(vertices, perVertexSizeInFloat, indices, attribs); } CC_DEPRECATED_ATTRIBUTE static Mesh* create(const std::vector<float>& vertices, int perVertexSizeInFloat, const IndexArray& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount){ return create(vertices, perVertexSizeInFloat, indices, attribs); }
/**
* @lua NA
*/
static Mesh* create(const std::vector<float>& vertices, int perVertexSizeInFloat, const IndexArray& indices, const std::vector<MeshVertexAttrib>& attribs); static Mesh* create(const std::vector<float>& vertices, int perVertexSizeInFloat, const IndexArray& indices, const std::vector<MeshVertexAttrib>& attribs);
/** create mesh */ /**
* create mesh
* @lua NA
*/
static Mesh* create(const std::string& name, MeshIndexData* indexData, MeshSkin* skin = nullptr); static Mesh* create(const std::string& name, MeshIndexData* indexData, MeshSkin* skin = nullptr);
/**get vertex buffer*/ /**
* get vertex buffer
*
* @lua NA
*/
GLuint getVertexBuffer() const; GLuint getVertexBuffer() const;
/**has vertex attribute?*/ /**
* has vertex attribute?
*
* @lua NA
*/
bool hasVertexAttrib(int attrib) const; bool hasVertexAttrib(int attrib) const;
/**get mesh vertex attribute count*/ /**get mesh vertex attribute count*/
ssize_t getMeshVertexAttribCount() const; ssize_t getMeshVertexAttribCount() const;
@ -84,13 +98,25 @@ public:
void setVisible(bool visible); void setVisible(bool visible);
bool isVisible() const { return _visible; } bool isVisible() const { return _visible; }
/**skin getter */ /**
* skin getter
*
* @lua NA
*/
MeshSkin* getSkin() const { return _skin; } MeshSkin* getSkin() const { return _skin; }
/**mesh index data getter */ /**
* mesh index data getter
*
* @lua NA
*/
MeshIndexData* getMeshIndexData() const { return _meshIndexData; } MeshIndexData* getMeshIndexData() const { return _meshIndexData; }
/**get GLProgramState*/ /**
* get GLProgramState
*
* @lua NA
*/
GLProgramState* getGLProgramState() const { return _glProgramState; } GLProgramState* getGLProgramState() const { return _glProgramState; }
/**name getter */ /**name getter */
@ -99,13 +125,29 @@ public:
void setBlendFunc(const BlendFunc &blendFunc); void setBlendFunc(const BlendFunc &blendFunc);
const BlendFunc &getBlendFunc() const; const BlendFunc &getBlendFunc() const;
/** get primitive type*/ /**
* get primitive type
*
* @lua NA
*/
GLenum getPrimitiveType() const; GLenum getPrimitiveType() const;
/**get index count*/ /**
* get index count
*
* @lua NA
*/
ssize_t getIndexCount() const; ssize_t getIndexCount() const;
/**get index format*/ /**
* get index format
*
* @lua NA
*/
GLenum getIndexFormat() const; GLenum getIndexFormat() const;
/**get index buffer*/ /**
* get index buffer
*
* @lua NA
*/
GLuint getIndexBuffer() const; GLuint getIndexBuffer() const;
/**get AABB*/ /**get AABB*/
@ -163,7 +205,7 @@ protected:
std::function<void()> _visibleChanged; std::function<void()> _visibleChanged;
}; };
// end of actions group // end of 3d group
/// @} /// @}

View File

@ -45,6 +45,7 @@ class Skeleton3D;
* @brief MeshSkin, A class maintain a collection of bones that affect Mesh vertex. * @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. * And it is responsible for computing matrix palletes that used by skin mesh rendering.
* @js NA * @js NA
* @lua NA
*/ */
class CC_DLL MeshSkin: public Ref class CC_DLL MeshSkin: public Ref
{ {
@ -105,7 +106,7 @@ protected:
Vec4* _matrixPalette; Vec4* _matrixPalette;
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -52,6 +52,7 @@ class MeshVertexData;
* the MeshIndexData class. * the MeshIndexData class.
* @brief the MeshIndexData contain all of the indices data which mesh need. * @brief the MeshIndexData contain all of the indices data which mesh need.
* @js NA * @js NA
* @lua NA
*/ */
class MeshIndexData : public Ref class MeshIndexData : public Ref
{ {
@ -138,7 +139,7 @@ protected:
int _vertexCount; //vertex count int _vertexCount; //vertex count
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -46,11 +46,15 @@ public:
/* /*
* Construct obb from oriented bounding box * Construct obb from oriented bounding box
*
* @lua NA
*/ */
OBB(const AABB& aabb); OBB(const AABB& aabb);
/* /*
* Construct obb from points * Construct obb from points
*
* @lua NA
*/ */
OBB(const Vec3* verts, int num); OBB(const Vec3* verts, int num);
@ -135,7 +139,7 @@ public:
Vec3 _extents; // obb length along each axis Vec3 _extents; // obb length along each axis
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -24,6 +24,7 @@ NS_CC_BEGIN
/** /**
* @brief .obj file Loader * @brief .obj file Loader
* @js NA * @js NA
* @lua NA
**/ **/
class ObjLoader class ObjLoader
{ {
@ -106,7 +107,7 @@ public:
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -40,6 +40,7 @@ enum class PointSide
/** /**
* Defines plane * Defines plane
* @js NA * @js NA
* @lua NA
**/ **/
class CC_DLL Plane class CC_DLL Plane
{ {

View File

@ -46,11 +46,14 @@ class CC_DLL Ray
public: public:
/** /**
* Constructor. * Constructor.
*
* @lua new
*/ */
Ray(); Ray();
/** /**
* Constructor. * Constructor.
* @lua NA
*/ */
Ray(const Ray& ray); Ray(const Ray& ray);
@ -59,11 +62,13 @@ public:
* *
* @param origin The ray's origin. * @param origin The ray's origin.
* @param direction The ray's direction. * @param direction The ray's direction.
* @lua new
*/ */
Ray(const Vec3& origin, const Vec3& direction); Ray(const Vec3& origin, const Vec3& direction);
/** /**
* Destructor. * Destructor.
* @lua NA
*/ */
~Ray(); ~Ray();
@ -99,7 +104,7 @@ public:
Vec3 _direction; // The ray direction vector. Vec3 _direction; // The ray direction vector.
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -39,6 +39,7 @@ NS_CC_BEGIN
/** /**
* @brief Defines a basic hierachial structure of transformation spaces. * @brief Defines a basic hierachial structure of transformation spaces.
* @lua NA
*/ */
class CC_DLL Bone3D : public Ref class CC_DLL Bone3D : public Ref
{ {
@ -189,7 +190,9 @@ protected:
class CC_DLL Skeleton3D: public Ref class CC_DLL Skeleton3D: public Ref
{ {
public: public:
/**
* @lua NA
*/
static Skeleton3D* create(const std::vector<NodeData*>& skeletondata); static Skeleton3D* create(const std::vector<NodeData*>& skeletondata);
/**get total bone count*/ /**get total bone count*/
@ -231,7 +234,7 @@ protected:
Vector<Bone3D*> _rootBones; Vector<Bone3D*> _rootBones;
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -22,6 +22,14 @@
THE SOFTWARE. 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/CCSkybox.h"
#include "3d/CCTextureCube.h" #include "3d/CCTextureCube.h"
@ -53,6 +61,17 @@ Skybox::~Skybox()
_texture->release(); _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() bool Skybox::init()
{ {
// create and set our custom shader // create and set our custom shader
@ -68,6 +87,19 @@ bool Skybox::init()
return true; 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() void Skybox::initBuffers()
{ {
if (Configuration::getInstance()->supportsShareableVAO()) if (Configuration::getInstance()->supportsShareableVAO())
@ -120,6 +152,9 @@ void Skybox::onDraw(const Mat4& transform, uint32_t flags)
{ {
auto state = getGLProgramState(); auto state = getGLProgramState();
state->apply(transform); 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); GLboolean depthFlag = glIsEnabled(GL_DEPTH_TEST);
GLint depthFunc; GLint depthFunc;
@ -179,12 +214,6 @@ void Skybox::setTexture(TextureCube* texture)
void Skybox::reload() void Skybox::reload()
{ {
auto glProgram = getGLProgramState()->getGLProgram();
glProgram->reset();
glProgram->initWithFilenames("Shaders3D/Skybox.vert", "Shaders3D/Skybox.frag");
glProgram->link();
glProgram->updateUniforms();
initBuffers(); initBuffers();
} }

View File

@ -25,10 +25,18 @@
#ifndef __SKYBOX_H__ #ifndef __SKYBOX_H__
#define __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 NS_CC_BEGIN
/**
* @addtogroup _3d
* @{
*/
class TextureCube; class TextureCube;
/** /**
@ -38,6 +46,19 @@ class CC_DLL Skybox : public Node
{ {
public: public:
CREATE_FUNC(Skybox); 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*/ /**texture getter and setter*/
void setTexture(TextureCube*); void setTexture(TextureCube*);
@ -63,6 +84,13 @@ CC_CONSTRUCTOR_ACCESS:
* init Skybox. * init Skybox.
*/ */
virtual bool init(); 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: protected:
@ -84,6 +112,9 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(Skybox); CC_DISALLOW_COPY_AND_ASSIGN(Skybox);
}; };
// end of 3d group
/// @}
NS_CC_END NS_CC_END
#endif // __SKYBOX_H__ #endif // __SKYBOX_H__

View File

@ -244,6 +244,7 @@ Sprite3D::Sprite3D()
, _aabbDirty(true) , _aabbDirty(true)
, _lightMask(-1) , _lightMask(-1)
, _shaderUsingLight(false) , _shaderUsingLight(false)
, _forceDepthWrite(false)
{ {
} }

View File

@ -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 */ /**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; 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<Mesh*> getMeshArrayByName(const std::string& name) const; std::vector<Mesh*> getMeshArrayByName(const std::string& name) const;
/**get mesh*/ /**get mesh*/
@ -266,10 +270,18 @@ public:
static Sprite3DCache* getInstance(); static Sprite3DCache* getInstance();
static void destroyInstance(); static void destroyInstance();
/**get the SpriteData struct*/ /**
* get the SpriteData struct
*
* @lua NA
*/
Sprite3DData* getSpriteData(const std::string& key) const; 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); bool addSprite3DData(const std::string& key, Sprite3DData* spritedata);
/**remove the SpriteData from Sprite3D by given the specified key*/ /**remove the SpriteData from Sprite3D by given the specified key*/
@ -289,9 +301,11 @@ protected:
std::unordered_map<std::string, Sprite3DData*> _spriteDatas; //cached sprite datas std::unordered_map<std::string, Sprite3DData*> _spriteDatas; //cached sprite datas
}; };
/// @cond
extern std::string CC_DLL s_attributeNames[];//attribute names array extern std::string CC_DLL s_attributeNames[];//attribute names array
/// @endcond
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -41,12 +41,15 @@ class Texture2D;
/** /**
* @brief the sprite3D material is only texture for now * @brief the sprite3D material is only texture for now
* @js NA * @js NA
* @lua NA
*/ */
class Sprite3DMaterialCache class Sprite3DMaterialCache
{ {
public: public:
/**get & destroy cache*/ /**get & destroy cache*/
static Sprite3DMaterialCache* getInstance(); static Sprite3DMaterialCache* getInstance();
/**destroy the instance*/
static void destroyInstance(); static void destroyInstance();
/**add to cache*/ /**add to cache*/
@ -71,7 +74,7 @@ protected:
}; };
// end of actions group // end of 3d group
/// @} /// @}
NS_CC_END NS_CC_END

View File

@ -26,6 +26,8 @@
#include "platform/CCImage.h" #include "platform/CCImage.h"
#include "platform/CCFileUtils.h" #include "platform/CCFileUtils.h"
#include "renderer/ccGLStateCache.h"
NS_CC_BEGIN NS_CC_BEGIN
unsigned char* getImageData(Image* img, Texture2D::PixelFormat& ePixFmt) 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; GLuint handle;
glGenTextures(1, &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++) 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; _name = handle;
glBindTexture(GL_TEXTURE_CUBE_MAP, 0); GL::bindTextureN(0, 0, GL_TEXTURE_CUBE_MAP);
for (auto img: images) for (auto img: images)
{ {
@ -245,14 +248,14 @@ void TextureCube::setTexParameters(const TexParams& texParams)
{ {
CCASSERT(_name != 0, __FUNCTION__); 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_MIN_FILTER, texParams.minFilter);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, texParams.wrapS); 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_S, texParams.wrapS);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, texParams.wrapT); 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() bool TextureCube::reloadTexture()

View File

@ -33,6 +33,11 @@
NS_CC_BEGIN NS_CC_BEGIN
/**
* @addtogroup _3d
* @{
*/
/** /**
TextureCube is a collection of six separate square textures that are put TextureCube is a collection of six separate square textures that are put
onto the faces of an imaginary cube. onto the faces of an imaginary cube.
@ -79,6 +84,9 @@ private:
std::vector<std::string> _imgPath; std::vector<std::string> _imgPath;
}; };
// end of 3d group
/// @}
NS_CC_END NS_CC_END
#endif // __CCTEXTURECUBE_H__ #endif // __CCTEXTURECUBE_H__

View File

@ -99,8 +99,10 @@ void AudioCache::readDataTask()
AudioBufferList theDataBuffer; AudioBufferList theDataBuffer;
ExtAudioFileRef extRef = nullptr; 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); auto error = ExtAudioFileOpenURL(fileURL, &extRef);
if(error) { if(error) {
printf("%s: ExtAudioFileOpenURL FAILED, Error = %ld\n", __PRETTY_FUNCTION__, (long)error); printf("%s: ExtAudioFileOpenURL FAILED, Error = %ld\n", __PRETTY_FUNCTION__, (long)error);

View File

@ -64,7 +64,12 @@ public:
/* Minimum delay in between sounds */ /* Minimum delay in between sounds */
double minDelay; double minDelay;
/**
* Defautl constructor
*
* @lua new
*/
AudioProfile() AudioProfile()
: maxInstances(0) : maxInstances(0)
, minDelay(0.0) , minDelay(0.0)

View File

@ -73,6 +73,7 @@ public:
* Release the shared Engine object. * 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
*/ */
static void end(); static void end();

View File

@ -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 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 callbackParam parameter used by the callback.
* @param f task can be lambda function. * @param f task can be lambda function.
* @lua NA
*/ */
template<class F> template<class F>
inline void enqueue(TaskType type, const TaskCallBack& callback, void* callbackParam, F&& f); inline void enqueue(TaskType type, const TaskCallBack& callback, void* callbackParam, F&& f);

View File

@ -50,6 +50,7 @@ Configuration::Configuration()
, _maxDirLightInShader(1) , _maxDirLightInShader(1)
, _maxPointLightInShader(1) , _maxPointLightInShader(1)
, _maxSpotLightInShader(1) , _maxSpotLightInShader(1)
, _isAnimate3DHighQuality(true)
{ {
} }
@ -262,6 +263,11 @@ int Configuration::getMaxSupportSpotLightInShader() const
return _maxSpotLightInShader; return _maxSpotLightInShader;
} }
bool Configuration::isHighAnimate3DQuality() const
{
return _isAnimate3DHighQuality;
}
// //
// generic getters for properties // generic getters for properties
// //
@ -350,6 +356,12 @@ void Configuration::loadConfigFile(const std::string& filename)
_maxSpotLightInShader = _valueDict[name].asInt(); _maxSpotLightInShader = _valueDict[name].asInt();
else else
_valueDict[name] = Value(_maxSpotLightInShader); _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 NS_CC_END

View File

@ -164,6 +164,12 @@ public:
*/ */
int getMaxSupportSpotLightInShader() const; 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. /** Returns whether or not an OpenGL is supported.
* *
* @param searchName A given search name. * @param searchName A given search name.
@ -230,6 +236,7 @@ protected:
int _maxDirLightInShader; //max support directional light in shader int _maxDirLightInShader; //max support directional light in shader
int _maxPointLightInShader; // max support point light in shader int _maxPointLightInShader; // max support point light in shader
int _maxSpotLightInShader; // max support spot 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; ValueMap _valueDict;
}; };

View File

@ -2,7 +2,7 @@
Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2013 cocos2d-x.org Copyright (c) 2010-2013 cocos2d-x.org
Copyright (c) 2011 Zynga Inc. Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -107,6 +107,7 @@ Director* Director::getInstance()
} }
Director::Director() Director::Director()
: _isStatusLabelUpdated(true)
{ {
} }
@ -386,7 +387,7 @@ void Director::setOpenGLView(GLView *openGLView)
// set size // set size
_winSizeInPoints = _openGLView->getDesignResolutionSize(); _winSizeInPoints = _openGLView->getDesignResolutionSize();
createStatsLabel(); _isStatusLabelUpdated = true;
if (_openGLView) if (_openGLView)
{ {
@ -1110,6 +1111,12 @@ void Director::resume()
// updates the FPS every frame // updates the FPS every frame
void Director::showStats() void Director::showStats()
{ {
if (_isStatusLabelUpdated)
{
createStatsLabel();
_isStatusLabelUpdated = false;
}
static unsigned long prevCalls = 0; static unsigned long prevCalls = 0;
static unsigned long prevVerts = 0; static unsigned long prevVerts = 0;
static float prevDeltaTime = 0.016f; // 60FPS static float prevDeltaTime = 0.016f; // 60FPS
@ -1255,7 +1262,7 @@ void Director::setContentScaleFactor(float scaleFactor)
if (scaleFactor != _contentScaleFactor) if (scaleFactor != _contentScaleFactor)
{ {
_contentScaleFactor = scaleFactor; _contentScaleFactor = scaleFactor;
createStatsLabel(); _isStatusLabelUpdated = true;
} }
} }

View File

@ -2,7 +2,7 @@
Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2013 cocos2d-x.org Copyright (c) 2010-2013 cocos2d-x.org
Copyright (c) 2011 Zynga Inc. Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc. Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -597,6 +597,8 @@ protected:
/* Console for the director */ /* Console for the director */
Console *_console; Console *_console;
bool _isStatusLabelUpdated;
// GLView will recreate stats labels to fit visible rect // GLView will recreate stats labels to fit visible rect
friend class GLView; friend class GLView;
}; };

View File

@ -58,15 +58,22 @@ class CC_DLL IMEDelegate
{ {
public: public:
/** /**
* Default constructor.
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual ~IMEDelegate(); virtual ~IMEDelegate();
/** /**
* Default destructor.
* @js NA
* @lua NA * @lua NA
*/ */
virtual bool attachWithIME(); virtual bool attachWithIME();
/** /**
* Determine whether the IME is detached or not.
* @js NA
* @lua NA * @lua NA
*/ */
virtual bool detachWithIME(); virtual bool detachWithIME();

View File

@ -72,7 +72,8 @@ public:
static void destroyInstance(); static void destroyInstance();
CSLoader(); CSLoader();
void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE void purge();
void init(); void init();

View File

@ -75,7 +75,8 @@ ActionTimeline/CSLoader.cpp \
FlatBuffersSerialize.cpp \ FlatBuffersSerialize.cpp \
WidgetCallBackHandlerProtocol.cpp \ WidgetCallBackHandlerProtocol.cpp \
WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp \ WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp \
CCObjectExtensionData.cpp CCObjectExtensionData.cpp \
CocoStudio.cpp
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/..

View File

@ -44,6 +44,7 @@ set(COCOS_CS_SRC
editor-support/cocostudio/TriggerObj.cpp editor-support/cocostudio/TriggerObj.cpp
editor-support/cocostudio/FlatBuffersSerialize.cpp editor-support/cocostudio/FlatBuffersSerialize.cpp
editor-support/cocostudio/CCObjectExtensionData.cpp editor-support/cocostudio/CCObjectExtensionData.cpp
editor-support/cocostudio/CocoStudio.cpp
editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp editor-support/cocostudio/WidgetReader/NodeReader/NodeReader.cpp
editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.cpp editor-support/cocostudio/WidgetReader/SingleNodeReader/SingleNodeReader.cpp
editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp

View File

@ -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();
}
}

View File

@ -65,4 +65,11 @@ THE SOFTWARE.
#include "cocostudio/CocosStudioExport.h" #include "cocostudio/CocosStudioExport.h"
#include "cocostudio/ActionTimeline/CSLoader.h" #include "cocostudio/ActionTimeline/CSLoader.h"
#include "cocostudio/CocosStudioExport.h"
namespace cocostudio
{
void CC_STUDIO_DLL destroyCocosStudio();
}
#endif #endif

View File

@ -111,7 +111,7 @@ FlatBuffersSerialize::FlatBuffersSerialize()
FlatBuffersSerialize::~FlatBuffersSerialize() FlatBuffersSerialize::~FlatBuffersSerialize()
{ {
purge();
} }
FlatBuffersSerialize* FlatBuffersSerialize::getInstance() FlatBuffersSerialize* FlatBuffersSerialize::getInstance()
@ -123,10 +123,16 @@ FlatBuffersSerialize* FlatBuffersSerialize::getInstance()
return _instanceFlatBuffersSerialize; return _instanceFlatBuffersSerialize;
} }
void FlatBuffersSerialize::purge() void FlatBuffersSerialize::purge()
{ {
CC_SAFE_DELETE(_instanceFlatBuffersSerialize); CC_SAFE_DELETE(_instanceFlatBuffersSerialize);
}
void FlatBuffersSerialize::destroyInstance()
{
CC_SAFE_DELETE(_instanceFlatBuffersSerialize);
} }

View File

@ -91,7 +91,9 @@ class CC_STUDIO_DLL FlatBuffersSerialize
public: public:
static FlatBuffersSerialize* getInstance(); static FlatBuffersSerialize* getInstance();
static void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
FlatBuffersSerialize(); FlatBuffersSerialize();
~FlatBuffersSerialize(); ~FlatBuffersSerialize();

View File

@ -34,6 +34,11 @@ ArmatureNodeReader* ArmatureNodeReader::getInstance()
return _instanceArmatureNodeReader; return _instanceArmatureNodeReader;
} }
void ArmatureNodeReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceArmatureNodeReader);
}
Offset<Table> ArmatureNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, Offset<Table> ArmatureNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder) flatbuffers::FlatBufferBuilder *builder)
{ {

View File

@ -26,7 +26,6 @@ THE SOFTWARE.
#define __ARMATURENODEREADER_H_ #define __ARMATURENODEREADER_H_
#include "cocos2d.h" #include "cocos2d.h"
#include "cocostudio/FlatBuffersSerialize.h"
#include "cocostudio/WidgetReader/NodeReaderProtocol.h" #include "cocostudio/WidgetReader/NodeReaderProtocol.h"
#include "cocostudio/WidgetReader/NodeReaderDefine.h" #include "cocostudio/WidgetReader/NodeReaderDefine.h"
@ -50,7 +49,9 @@ public:
~ArmatureNodeReader(); ~ArmatureNodeReader();
static ArmatureNodeReader* getInstance(); static ArmatureNodeReader* getInstance();
static void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder) override; flatbuffers::FlatBufferBuilder* builder) override;

View File

@ -64,6 +64,11 @@ namespace cocostudio
CC_SAFE_DELETE(instanceButtonReader); CC_SAFE_DELETE(instanceButtonReader);
} }
void ButtonReader::destroyInstance()
{
CC_SAFE_DELETE(instanceButtonReader);
}
void ButtonReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) void ButtonReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{ {
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode); WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);

View File

@ -39,7 +39,9 @@ namespace cocostudio
virtual ~ButtonReader(); virtual ~ButtonReader();
static ButtonReader* getInstance(); 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, virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget,
const rapidjson::Value& options); const rapidjson::Value& options);

View File

@ -45,6 +45,11 @@ namespace cocostudio
return instanceCheckBoxReader; return instanceCheckBoxReader;
} }
void CheckBoxReader::destroyInstance()
{
CC_SAFE_DELETE(instanceCheckBoxReader);
}
void CheckBoxReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) void CheckBoxReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{ {

View File

@ -39,7 +39,9 @@ namespace cocostudio
virtual ~CheckBoxReader(); virtual ~CheckBoxReader();
static CheckBoxReader* getInstance(); 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 setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);

View File

@ -63,6 +63,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceComAudioReader); CC_SAFE_DELETE(_instanceComAudioReader);
} }
void ComAudioReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceComAudioReader);
}
Offset<Table> ComAudioReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, Offset<Table> ComAudioReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder) flatbuffers::FlatBufferBuilder *builder)
{ {

View File

@ -40,7 +40,9 @@ namespace cocostudio
~ComAudioReader(); ~ComAudioReader();
static ComAudioReader* getInstance(); static ComAudioReader* getInstance();
static void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder); flatbuffers::FlatBufferBuilder* builder);

View File

@ -61,7 +61,7 @@ namespace cocostudio
return _instanceTMXTiledMapReader; return _instanceTMXTiledMapReader;
} }
void GameMapReader::purge() void GameMapReader::destroyInstance()
{ {
CC_SAFE_DELETE(_instanceTMXTiledMapReader); CC_SAFE_DELETE(_instanceTMXTiledMapReader);
} }

View File

@ -42,7 +42,9 @@ namespace cocostudio
~GameMapReader(); ~GameMapReader();
static GameMapReader* getInstance(); static GameMapReader* getInstance();
static void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder); flatbuffers::FlatBufferBuilder* builder);

View File

@ -49,6 +49,11 @@ namespace cocostudio
return instanceImageViewReader; return instanceImageViewReader;
} }
void ImageViewReader::destroyInstance()
{
CC_SAFE_DELETE(instanceImageViewReader);
}
void ImageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) void ImageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{ {
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode); WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);

View File

@ -41,7 +41,9 @@ namespace cocostudio
virtual ~ImageViewReader(); virtual ~ImageViewReader();
static ImageViewReader* getInstance(); 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 setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode); virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);

View File

@ -64,6 +64,11 @@ namespace cocostudio
return instanceLayoutReader; return instanceLayoutReader;
} }
void LayoutReader::destroyInstance()
{
CC_SAFE_DELETE(instanceLayoutReader);
}
void LayoutReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) void LayoutReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{ {
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode); WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);

View File

@ -40,7 +40,9 @@ namespace cocostudio
virtual ~LayoutReader(); virtual ~LayoutReader();
static LayoutReader* getInstance(); 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 setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -42,6 +42,11 @@ namespace cocostudio
return instanceListViewReader; return instanceListViewReader;
} }
void ListViewReader::destroyInstance()
{
CC_SAFE_DELETE(instanceListViewReader);
}
void ListViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode) void ListViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
{ {
ScrollViewReader::setPropsFromBinary(widget, cocoLoader, cocoNode); ScrollViewReader::setPropsFromBinary(widget, cocoLoader, cocoNode);

View File

@ -39,7 +39,9 @@ namespace cocostudio
virtual ~ListViewReader(); virtual ~ListViewReader();
static ListViewReader* getInstance(); 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 setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -48,6 +48,11 @@ namespace cocostudio
return instanceLoadingBar; return instanceLoadingBar;
} }
void LoadingBarReader::destroyInstance()
{
CC_SAFE_DELETE(instanceLoadingBar);
}
void LoadingBarReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) void LoadingBarReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{ {
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode); WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);

View File

@ -39,7 +39,9 @@ namespace cocostudio
virtual ~LoadingBarReader(); virtual ~LoadingBarReader();
static LoadingBarReader* getInstance(); 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 setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -67,6 +67,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceNode3DReader); CC_SAFE_DELETE(_instanceNode3DReader);
} }
void Node3DReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceNode3DReader);
}
Vec3 Node3DReader::getVec3Attribute(const tinyxml2::XMLAttribute* attribute) const Vec3 Node3DReader::getVec3Attribute(const tinyxml2::XMLAttribute* attribute) const
{ {
if(!attribute) if(!attribute)

View File

@ -46,7 +46,9 @@ namespace cocostudio
~Node3DReader(); ~Node3DReader();
static Node3DReader* getInstance(); static Node3DReader* getInstance();
static void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder); flatbuffers::FlatBufferBuilder* builder);

View File

@ -79,7 +79,7 @@ namespace cocostudio
return _instanceNodeReader; return _instanceNodeReader;
} }
void NodeReader::purge() void NodeReader::destroyInstance()
{ {
CC_SAFE_DELETE(_instanceNodeReader); CC_SAFE_DELETE(_instanceNodeReader);
} }

View File

@ -41,7 +41,9 @@ namespace cocostudio
~NodeReader(); ~NodeReader();
static NodeReader* getInstance(); static NodeReader* getInstance();
static void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder); flatbuffers::FlatBufferBuilder* builder);

View File

@ -40,6 +40,11 @@ namespace cocostudio
return instancePageViewReader; return instancePageViewReader;
} }
void PageViewReader::destroyInstance()
{
CC_SAFE_DELETE(instancePageViewReader);
}
void PageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) void PageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{ {
LayoutReader::setPropsFromBinary(widget, cocoLoader, cocoNode); LayoutReader::setPropsFromBinary(widget, cocoLoader, cocoNode);

View File

@ -39,7 +39,9 @@ namespace cocostudio
virtual ~PageViewReader(); virtual ~PageViewReader();
static PageViewReader* getInstance(); 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 setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* cocoNode) ; virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* cocoNode) ;

View File

@ -68,6 +68,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceParticle3DReader); CC_SAFE_DELETE(_instanceParticle3DReader);
} }
void Particle3DReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceParticle3DReader);
}
Offset<Table> Particle3DReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, Offset<Table> Particle3DReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder) flatbuffers::FlatBufferBuilder *builder)
{ {

View File

@ -41,7 +41,9 @@ namespace cocostudio
~Particle3DReader(); ~Particle3DReader();
static Particle3DReader* getInstance(); static Particle3DReader* getInstance();
static void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder); flatbuffers::FlatBufferBuilder* builder);

View File

@ -64,6 +64,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceParticleReader); CC_SAFE_DELETE(_instanceParticleReader);
} }
void ParticleReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceParticleReader);
}
Offset<Table> ParticleReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, Offset<Table> ParticleReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder) flatbuffers::FlatBufferBuilder *builder)
{ {

View File

@ -42,7 +42,9 @@ namespace cocostudio
~ParticleReader(); ~ParticleReader();
static ParticleReader* getInstance(); static ParticleReader* getInstance();
static void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder); flatbuffers::FlatBufferBuilder* builder);

View File

@ -62,6 +62,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceProjectNodeReader); CC_SAFE_DELETE(_instanceProjectNodeReader);
} }
void ProjectNodeReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceProjectNodeReader);
}
Offset<Table> ProjectNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, Offset<Table> ProjectNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder) flatbuffers::FlatBufferBuilder *builder)
{ {

View File

@ -40,7 +40,9 @@ namespace cocostudio
~ProjectNodeReader(); ~ProjectNodeReader();
static ProjectNodeReader* getInstance(); static ProjectNodeReader* getInstance();
static void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder); flatbuffers::FlatBufferBuilder* builder);

View File

@ -44,6 +44,11 @@ namespace cocostudio
return instanceScrollViewReader; return instanceScrollViewReader;
} }
void ScrollViewReader::destroyInstance()
{
CC_SAFE_DELETE(instanceScrollViewReader);
}
void ScrollViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode) void ScrollViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
{ {
//TODO: need to refactor... //TODO: need to refactor...

View File

@ -39,7 +39,9 @@ namespace cocostudio
virtual ~ScrollViewReader(); virtual ~ScrollViewReader();
static ScrollViewReader* getInstance(); 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 setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -67,6 +67,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceSingleNodeReader); CC_SAFE_DELETE(_instanceSingleNodeReader);
} }
void SingleNodeReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceSingleNodeReader);
}
Offset<Table> SingleNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, Offset<Table> SingleNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder) flatbuffers::FlatBufferBuilder *builder)
{ {

View File

@ -42,7 +42,9 @@ namespace cocostudio
~SingleNodeReader(); ~SingleNodeReader();
static SingleNodeReader* getInstance(); static SingleNodeReader* getInstance();
static void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder); flatbuffers::FlatBufferBuilder* builder);

View File

@ -48,6 +48,11 @@ namespace cocostudio
return instanceSliderReader; return instanceSliderReader;
} }
void SliderReader::destroyInstance()
{
CC_SAFE_DELETE(instanceSliderReader);
}
void SliderReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode) void SliderReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
{ {
this->beginSetBasicProperties(widget); this->beginSetBasicProperties(widget);

View File

@ -39,7 +39,9 @@ namespace cocostudio
virtual ~SliderReader(); virtual ~SliderReader();
static SliderReader* getInstance(); 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 setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ; virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;

View File

@ -67,6 +67,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceSprite3DReader); CC_SAFE_DELETE(_instanceSprite3DReader);
} }
void Sprite3DReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceSprite3DReader);
}
Vec2 Sprite3DReader::getVec2Attribute(const tinyxml2::XMLAttribute* attribute) const Vec2 Sprite3DReader::getVec2Attribute(const tinyxml2::XMLAttribute* attribute) const
{ {
if(!attribute) if(!attribute)

View File

@ -46,7 +46,9 @@ namespace cocostudio
~Sprite3DReader(); ~Sprite3DReader();
static Sprite3DReader* getInstance(); static Sprite3DReader* getInstance();
static void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder); flatbuffers::FlatBufferBuilder* builder);

View File

@ -65,6 +65,11 @@ namespace cocostudio
CC_SAFE_DELETE(_instanceSpriteReader); CC_SAFE_DELETE(_instanceSpriteReader);
} }
void SpriteReader::destroyInstance()
{
CC_SAFE_DELETE(_instanceSpriteReader);
}
Offset<Table> SpriteReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData, Offset<Table> SpriteReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
flatbuffers::FlatBufferBuilder *builder) flatbuffers::FlatBufferBuilder *builder)
{ {

View File

@ -42,7 +42,9 @@ namespace cocostudio
~SpriteReader(); ~SpriteReader();
static SpriteReader* getInstance(); static SpriteReader* getInstance();
static void purge(); /** @deprecated Use method destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge();
static void destroyInstance();
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData, flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
flatbuffers::FlatBufferBuilder* builder); flatbuffers::FlatBufferBuilder* builder);

View File

@ -45,6 +45,11 @@ namespace cocostudio
return instanceTextAtalsReader; return instanceTextAtalsReader;
} }
void TextAtlasReader::destroyInstance()
{
CC_SAFE_DELETE(instanceTextAtalsReader);
}
void TextAtlasReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode) void TextAtlasReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
{ {
this->beginSetBasicProperties(widget); this->beginSetBasicProperties(widget);

Some files were not shown because too many files have changed in this diff Show More