This commit is contained in:
XiaoFeng 2015-04-07 09:06:06 +08:00
commit 4929d8102a
466 changed files with 6552 additions and 15340 deletions

View File

@ -540,6 +540,7 @@ Developers:
hawkwood (Justin Hawkwood)
Fixing a bug that EditBox doesn't show any text if it's initialized with text.
Fixed a memory leak in new Audio.
wtyqm (zhang peng)
Fixing a bug that ccbRootPath wasn't passed to sub ccb nodes.

View File

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

View File

@ -29,9 +29,9 @@ cmake_minimum_required(VERSION 2.8)
# also from cmake's Modules dir, to not clash with per-project files.
cmake_policy(SET CMP0017 NEW)
# Use new behaviour with cmake >= 3.0:
# Use new behaviour with cmake >= 3.1:
# Only interpret if() arguments as variables or keywords when unquoted.
if(CMAKE_VERSION VERSION_GREATER 3)
if(CMAKE_VERSION VERSION_GREATER 3.1)
cmake_policy(SET CMP0054 NEW)
endif()

View File

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

View File

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

View File

@ -2,7 +2,7 @@
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
@ -33,13 +33,6 @@ THE SOFTWARE.
#include "deprecated/CCString.h"
#include <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
static int _globalFontSize = kItemSize;
@ -65,7 +58,7 @@ MenuItem* MenuItem::create()
MenuItem* MenuItem::create(Ref *target, SEL_MenuHandler selector)
{
MenuItem *ret = new (std::nothrow) MenuItem();
ret->initWithTarget(target, selector);
ret->initWithCallback(std::bind(selector, target, std::placeholders::_1));
ret->autorelease();
return ret;
}
@ -81,8 +74,6 @@ MenuItem* MenuItem::create( const ccMenuCallback& callback)
// FIXME: deprecated
bool MenuItem::initWithTarget(cocos2d::Ref *target, SEL_MenuHandler selector )
{
_target = target;
CC_SAFE_RETAIN(_target);
return initWithCallback( std::bind(selector,target, std::placeholders::_1) );
}
@ -102,7 +93,6 @@ MenuItem::~MenuItem()
void MenuItem::onExit()
{
Node::onExit();
CC_SAFE_RELEASE(_target);
}
void MenuItem::selected()
@ -159,8 +149,6 @@ bool MenuItem::isSelected() const
// FIXME: deprecated
void MenuItem::setTarget(Ref *target, SEL_MenuHandler selector)
{
_target = target;
CC_SAFE_RETAIN(_target);
setCallback( std::bind( selector, target, std::placeholders::_1) );
}
@ -199,7 +187,7 @@ void MenuItemLabel::setLabel(Node* var)
MenuItemLabel * MenuItemLabel::create(Node*label, Ref* target, SEL_MenuHandler selector)
{
MenuItemLabel *ret = new (std::nothrow) MenuItemLabel();
ret->initWithLabel(label, target, selector);
ret->initWithLabel(label, std::bind(selector, target, std::placeholders::_1));
ret->autorelease();
return ret;
}
@ -223,8 +211,6 @@ MenuItemLabel* MenuItemLabel::create(Node *label)
// FIXME:: deprecated
bool MenuItemLabel::initWithLabel(Node* label, Ref* target, SEL_MenuHandler selector)
{
_target = target;
CC_SAFE_RETAIN(_target);
return initWithLabel(label, std::bind(selector,target, std::placeholders::_1) );
}
@ -329,7 +315,7 @@ MenuItemAtlasFont * MenuItemAtlasFont::create(const std::string& value, const st
MenuItemAtlasFont * MenuItemAtlasFont::create(const std::string& value, const std::string& charMapFile, int itemWidth, int itemHeight, char startCharMap, Ref* target, SEL_MenuHandler selector)
{
MenuItemAtlasFont *ret = new (std::nothrow) MenuItemAtlasFont();
ret->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, target, selector);
ret->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, std::bind(selector, target, std::placeholders::_1));
ret->autorelease();
return ret;
}
@ -345,8 +331,6 @@ MenuItemAtlasFont * MenuItemAtlasFont::create(const std::string& value, const st
// FIXME:: deprecated
bool MenuItemAtlasFont::initWithString(const std::string& value, const std::string& charMapFile, int itemWidth, int itemHeight, char startCharMap, Ref* target, SEL_MenuHandler selector)
{
_target = target;
CC_SAFE_RETAIN(_target);
return initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap, std::bind(selector,target, std::placeholders::_1) );
}
@ -395,7 +379,7 @@ const std::string& MenuItemFont::getFontName()
MenuItemFont * MenuItemFont::create(const std::string& value, Ref* target, SEL_MenuHandler selector)
{
MenuItemFont *ret = new (std::nothrow) MenuItemFont();
ret->initWithString(value, target, selector);
ret->initWithString(value, std::bind(selector, target, std::placeholders::_1));
ret->autorelease();
return ret;
}
@ -431,8 +415,6 @@ bool MenuItemFont::initWithString(const std::string& value, Ref* target, SEL_Men
{
CCASSERT( !value.empty(), "Value length must be greater than 0");
_target = target;
CC_SAFE_RETAIN(target);
return initWithString(value, std::bind(selector,target, std::placeholders::_1) );
}
@ -552,7 +534,7 @@ MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite
// FIXME: deprecated
MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite, Ref* target, SEL_MenuHandler selector)
{
return MenuItemSprite::create(normalSprite, selectedSprite, nullptr, target, selector);
return MenuItemSprite::create(normalSprite, selectedSprite, nullptr, std::bind(selector, target, std::placeholders::_1));
}
MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite, const ccMenuCallback& callback)
@ -564,7 +546,7 @@ MenuItemSprite * MenuItemSprite::create(Node* normalSprite, Node* selectedSprite
MenuItemSprite * MenuItemSprite::create(Node *normalSprite, Node *selectedSprite, Node *disabledSprite, Ref *target, SEL_MenuHandler selector)
{
MenuItemSprite *ret = new (std::nothrow) MenuItemSprite();
ret->initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, target, selector);
ret->initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, std::bind(selector, target, std::placeholders::_1));
ret->autorelease();
return ret;
}
@ -580,8 +562,6 @@ MenuItemSprite * MenuItemSprite::create(Node *normalSprite, Node *selectedSprite
// FIXME: deprecated
bool MenuItemSprite::initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, Ref* target, SEL_MenuHandler selector)
{
_target = target;
CC_SAFE_RETAIN(_target);
return initWithNormalSprite(normalSprite, selectedSprite, disabledSprite, std::bind(selector,target, std::placeholders::_1) );
}
@ -712,7 +692,7 @@ MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std:
// FIXME: deprecated
MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std::string& selectedImage, Ref* target, SEL_MenuHandler selector)
{
return MenuItemImage::create(normalImage, selectedImage, "", target, selector);
return MenuItemImage::create(normalImage, selectedImage, "", std::bind(selector, target, std::placeholders::_1));
}
MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std::string& selectedImage, const ccMenuCallback& callback)
@ -724,7 +704,7 @@ MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std:
MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, Ref* target, SEL_MenuHandler selector)
{
MenuItemImage *ret = new (std::nothrow) MenuItemImage();
if (ret && ret->initWithNormalImage(normalImage, selectedImage, disabledImage, target, selector))
if (ret && ret->initWithNormalImage(normalImage, selectedImage, disabledImage, std::bind(selector, target, std::placeholders::_1)))
{
ret->autorelease();
return ret;
@ -760,8 +740,6 @@ MenuItemImage * MenuItemImage::create(const std::string& normalImage, const std:
// FIXME:: deprecated
bool MenuItemImage::initWithNormalImage(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, Ref* target, SEL_MenuHandler selector)
{
_target = target;
CC_SAFE_RETAIN(_target);
return initWithNormalImage(normalImage, selectedImage, disabledImage, std::bind(selector,target, std::placeholders::_1) );
}
bool MenuItemImage::initWithNormalImage(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, const ccMenuCallback& callback)
@ -813,7 +791,7 @@ void MenuItemImage::setDisabledSpriteFrame(SpriteFrame * frame)
MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler selector, const Vector<MenuItem*>& menuItems)
{
MenuItemToggle *ret = new (std::nothrow) MenuItemToggle();
ret->MenuItem::initWithTarget(target, selector);
ret->MenuItem::initWithCallback(std::bind(selector, target, std::placeholders::_1));
ret->_subItems = menuItems;
ret->_selectedIndex = UINT_MAX;
ret->setSelectedIndex(0);
@ -836,7 +814,7 @@ MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler s
va_list args;
va_start(args, item);
MenuItemToggle *ret = new (std::nothrow) MenuItemToggle();
ret->initWithTarget(target, selector, item, args);
ret->initWithCallback(std::bind(selector, target, std::placeholders::_1), item, args);
ret->autorelease();
va_end(args);
return ret;
@ -877,8 +855,6 @@ MenuItemToggle * MenuItemToggle::create()
// FIXME:: deprecated
bool MenuItemToggle::initWithTarget(Ref* target, SEL_MenuHandler selector, MenuItem* item, va_list args)
{
_target = target;
CC_SAFE_RETAIN(_target);
return initWithCallback(std::bind( selector, target, std::placeholders::_1), item, args);
}
@ -995,9 +971,3 @@ MenuItem* MenuItemToggle::getSelectedItem()
}
NS_CC_END
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
#elif _MSC_VER >= 1400 //vs 2005 or higher
#pragma warning (pop)
#endif

View File

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

View File

@ -621,7 +621,7 @@ Vec2 TMXLayer::calculateLayerOffset(const Vec2& pos)
case TMXOrientationStaggered:
{
float diffX = 0;
if ((int)abs(pos.y) % 2 == 1)
if ((int)std::abs(pos.y) % 2 == 1)
{
diffX = _mapTileSize.width/2;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -105,6 +105,17 @@ public:
CC_DEPRECATED_ATTRIBUTE bool getPlayBack() const { return _playReverse; }
CC_DEPRECATED_ATTRIBUTE void setPlayBack(bool reverse) { _playReverse = reverse; }
/**set high quality
* The default value is based on Configuration::isHighAnimate3DQuality(). You can configure it in the config.plist. However, you can modify it using the following function
* @param true: is high quality, false: is low quality.
*/
void setHighQuality(bool isHighQuality);
/**get high quality
* is it high quality
*/
bool isHighQuality() const;
CC_CONSTRUCTOR_ACCESS:
Animate3D();
@ -137,6 +148,13 @@ protected:
float _accTransTime; // acculate transition time
float _lastTime; // last t (0 - 1)
float _originInterval;// save origin interval time
// animation quality
EvaluateType _translateEvaluate;
EvaluateType _roteEvaluate;
EvaluateType _scaleEvaluate;
bool _isHighQuality; // true: is high quality, false: is low quality
std::unordered_map<Bone3D*, Animation3D::Curve*> _boneCurves; //weak ref
std::unordered_map<Node*, Animation3D::Curve*> _nodeCurves;
@ -146,7 +164,7 @@ protected:
static std::unordered_map<Node*, Animate3D*> s_runningAnimates;
};
// end of actions group
// end of 3d group
/// @}
NS_CC_END

View File

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

View File

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

View File

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

View File

@ -45,7 +45,7 @@ public:
VIEW_POINT_ORIENTED, // orient to the camera
VIEW_PLANE_ORIENTED // orient to the XOY plane of camera
};
/// @{
/// @name Creators
/**
@ -96,7 +96,11 @@ public:
/** update billboard's transform and turn it towards camera */
virtual void visit(Renderer *renderer, const Mat4& parentTransform, uint32_t parentFlags) override;
/** draw BillBoard object */
/**
* draw BillBoard object.
*
* @lua NA
*/
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
@ -122,7 +126,7 @@ private:
};
// end of actions group
// end of 3d group
/// @}
NS_CC_END

View File

@ -874,6 +874,8 @@ bool Bundle3D::loadMaterialsBinary(MaterialDatas& materialdatas)
{
NMaterialData materialData;
materialData.id = _binaryReader.readString();
// skip: diffuse(3), ambient(3), emissive(3), opacity(1), specular(3), shininess(1)
float data[14];
_binaryReader.read(&data,sizeof(float), 14);

View File

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

View File

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

View File

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

View File

@ -59,14 +59,28 @@ public:
/**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); }
/**
* @lua NA
*/
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);
/**get vertex buffer*/
/**
* get vertex buffer
*
* @lua NA
*/
GLuint getVertexBuffer() const;
/**has vertex attribute?*/
/**
* has vertex attribute?
*
* @lua NA
*/
bool hasVertexAttrib(int attrib) const;
/**get mesh vertex attribute count*/
ssize_t getMeshVertexAttribCount() const;
@ -84,13 +98,25 @@ public:
void setVisible(bool visible);
bool isVisible() const { return _visible; }
/**skin getter */
/**
* skin getter
*
* @lua NA
*/
MeshSkin* getSkin() const { return _skin; }
/**mesh index data getter */
/**
* mesh index data getter
*
* @lua NA
*/
MeshIndexData* getMeshIndexData() const { return _meshIndexData; }
/**get GLProgramState*/
/**
* get GLProgramState
*
* @lua NA
*/
GLProgramState* getGLProgramState() const { return _glProgramState; }
/**name getter */
@ -99,13 +125,29 @@ public:
void setBlendFunc(const BlendFunc &blendFunc);
const BlendFunc &getBlendFunc() const;
/** get primitive type*/
/**
* get primitive type
*
* @lua NA
*/
GLenum getPrimitiveType() const;
/**get index count*/
/**
* get index count
*
* @lua NA
*/
ssize_t getIndexCount() const;
/**get index format*/
/**
* get index format
*
* @lua NA
*/
GLenum getIndexFormat() const;
/**get index buffer*/
/**
* get index buffer
*
* @lua NA
*/
GLuint getIndexBuffer() const;
/**get AABB*/
@ -163,7 +205,7 @@ protected:
std::function<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.
* And it is responsible for computing matrix palletes that used by skin mesh rendering.
* @js NA
* @lua NA
*/
class CC_DLL MeshSkin: public Ref
{
@ -105,7 +106,7 @@ protected:
Vec4* _matrixPalette;
};
// end of actions group
// end of 3d group
/// @}
NS_CC_END

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,6 +22,14 @@
THE SOFTWARE.
****************************************************************************/
#include "base/ccMacros.h"
#include "base/CCConfiguration.h"
#include "base/CCDirector.h"
#include "renderer/ccGLStateCache.h"
#include "renderer/CCGLProgram.h"
#include "renderer/CCGLProgramCache.h"
#include "renderer/CCGLProgramState.h"
#include "renderer/CCRenderer.h"
#include "3d/CCSkybox.h"
#include "3d/CCTextureCube.h"
@ -53,6 +61,17 @@ Skybox::~Skybox()
_texture->release();
}
Skybox* Skybox::create(const std::string& positive_x, const std::string& negative_x,
const std::string& positive_y, const std::string& negative_y,
const std::string& positive_z, const std::string& negative_z)
{
auto ret = new (std::nothrow) Skybox();
ret->init(positive_x, negative_x, positive_y, negative_y, positive_z, negative_z);
ret->autorelease();
return ret;
}
bool Skybox::init()
{
// create and set our custom shader
@ -68,6 +87,19 @@ bool Skybox::init()
return true;
}
bool Skybox::init(const std::string& positive_x, const std::string& negative_x,
const std::string& positive_y, const std::string& negative_y,
const std::string& positive_z, const std::string& negative_z)
{
auto texture = TextureCube::create(positive_x, negative_x, positive_y, negative_y, positive_z, negative_z);
if (texture == nullptr)
return false;
init();
setTexture(texture);
return true;
}
void Skybox::initBuffers()
{
if (Configuration::getInstance()->supportsShareableVAO())

View File

@ -25,10 +25,18 @@
#ifndef __SKYBOX_H__
#define __SKYBOX_H__
#include "cocos2d.h"
#include "base/ccTypes.h"
#include "platform/CCPlatformMacros.h"
#include "renderer/CCCustomCommand.h"
#include "2d/CCNode.h"
NS_CC_BEGIN
/**
* @addtogroup _3d
* @{
*/
class TextureCube;
/**
@ -39,6 +47,19 @@ class CC_DLL Skybox : public Node
public:
CREATE_FUNC(Skybox);
/** create skybox from 6 textures.
@param positive_x texture for the right side of the texture cube face.
@param negative_x texture for the up side of the texture cube face.
@param positive_y texture for the top side of the texture cube face
@param negative_y texture for the bottom side of the texture cube face
@param positive_z texture for the forward side of the texture cube face.
@param negative_z texture for the rear side of the texture cube face.
@return A new skybox inited with given parameters.
*/
static Skybox* create(const std::string& positive_x, const std::string& negative_x,
const std::string& positive_y, const std::string& negative_y,
const std::string& positive_z, const std::string& negative_z);
/**texture getter and setter*/
void setTexture(TextureCube*);
@ -64,6 +85,13 @@ CC_CONSTRUCTOR_ACCESS:
*/
virtual bool init();
/**
* initialize with texture path
*/
bool init(const std::string& positive_x, const std::string& negative_x,
const std::string& positive_y, const std::string& negative_y,
const std::string& positive_z, const std::string& negative_z);
protected:
/**
@ -84,6 +112,9 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(Skybox);
};
// end of 3d group
/// @}
NS_CC_END
#endif // __SKYBOX_H__

View File

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

View File

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

View File

@ -26,6 +26,8 @@
#include "platform/CCImage.h"
#include "platform/CCFileUtils.h"
#include "renderer/ccGLStateCache.h"
NS_CC_BEGIN
unsigned char* getImageData(Image* img, Texture2D::PixelFormat& ePixFmt)
@ -189,7 +191,8 @@ bool TextureCube::init(const std::string& positive_x, const std::string& negativ
GLuint handle;
glGenTextures(1, &handle);
glBindTexture(GL_TEXTURE_CUBE_MAP, handle);
GL::bindTextureN(0, handle, GL_TEXTURE_CUBE_MAP);
for (int i = 0; i < 6; i++)
{
@ -231,7 +234,7 @@ bool TextureCube::init(const std::string& positive_x, const std::string& negativ
_name = handle;
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
GL::bindTextureN(0, 0, GL_TEXTURE_CUBE_MAP);
for (auto img: images)
{
@ -245,14 +248,14 @@ void TextureCube::setTexParameters(const TexParams& texParams)
{
CCASSERT(_name != 0, __FUNCTION__);
glBindTexture(GL_TEXTURE_CUBE_MAP, _name);
GL::bindTextureN(0, _name, GL_TEXTURE_CUBE_MAP);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, texParams.wrapS);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, texParams.wrapS);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, texParams.minFilter);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, texParams.magFilter);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, texParams.wrapS);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, texParams.wrapT);
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
GL::bindTextureN(0, 0, GL_TEXTURE_CUBE_MAP);
}
bool TextureCube::reloadTexture()

View File

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

View File

@ -99,7 +99,9 @@ void AudioCache::readDataTask()
AudioBufferList theDataBuffer;
ExtAudioFileRef extRef = nullptr;
auto fileURL = (CFURLRef)[[NSURL fileURLWithPath:[NSString stringWithCString:_fileFullPath.c_str() encoding:[NSString defaultCStringEncoding]]] retain];
NSString *fileFullPath = [[NSString alloc] initWithCString:_fileFullPath.c_str() encoding:[NSString defaultCStringEncoding]];
auto fileURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:fileFullPath];
[fileFullPath release];
auto error = ExtAudioFileOpenURL(fileURL, &extRef);
if(error) {

View File

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

View File

@ -73,6 +73,7 @@ public:
* Release the shared Engine object.
*
* @warning It must be called before the application exit, or it will lead to memory leaks.
* @lua destroyInstance
*/
static void end();

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

View File

@ -50,6 +50,7 @@ Configuration::Configuration()
, _maxDirLightInShader(1)
, _maxPointLightInShader(1)
, _maxSpotLightInShader(1)
, _isAnimate3DHighQuality(true)
{
}
@ -262,6 +263,11 @@ int Configuration::getMaxSupportSpotLightInShader() const
return _maxSpotLightInShader;
}
bool Configuration::isHighAnimate3DQuality() const
{
return _isAnimate3DHighQuality;
}
//
// generic getters for properties
//
@ -350,6 +356,12 @@ void Configuration::loadConfigFile(const std::string& filename)
_maxSpotLightInShader = _valueDict[name].asInt();
else
_valueDict[name] = Value(_maxSpotLightInShader);
name = "cocos2d.x.3d.animate_high_quality";
if (_valueDict.find(name) != _valueDict.end())
_isAnimate3DHighQuality = _valueDict[name].asBool();
else
_valueDict[name] = Value(_isAnimate3DHighQuality);
}
NS_CC_END

View File

@ -164,6 +164,12 @@ public:
*/
int getMaxSupportSpotLightInShader() const;
/** is 3d animate quality? Configure it in the config.plist, the key is cocos2d.x.3d.animate_high_quality, it is true by default.
* Animation quality of created Animate3D is based on the return value. However, animation quality of Animate3D can be modified by calling setHighQuality after it is created.
* @return true: is high quality, false: is low quality
*/
bool isHighAnimate3DQuality() const;
/** Returns whether or not an OpenGL is supported.
*
* @param searchName A given search name.
@ -230,6 +236,7 @@ protected:
int _maxDirLightInShader; //max support directional light in shader
int _maxPointLightInShader; // max support point light in shader
int _maxSpotLightInShader; // max support spot light in shader
bool _isAnimate3DHighQuality; // animation 3d quality, true: is high quality, false: is low quality
ValueMap _valueDict;
};

View File

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

View File

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

View File

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

View File

@ -89,13 +89,18 @@ public:
/** Get previous contact data */
inline const PhysicsContactData* getPreContactData() const { return _preContactData; }
/** Get data. */
/**
* Get data.
* @lua NA
*/
inline void* getData() const { return _data; }
/**
* @brief Set data to contact.
* You must manage the memory yourself, Generally you can set data at contact begin, and distory it at contact seperate.
*
* @lua NA
*/
inline void setData(void* data) { _data = data; }

View File

@ -1294,15 +1294,21 @@ bool FileUtils::renameFile(const std::string &path, const std::string &oldname,
if(FileUtils::getInstance()->isFileExist(_new))
{
DeleteFileA(_new.c_str());
if (!DeleteFileA(_new.c_str()))
{
CCLOGERROR("Fail to delete file %s !Error code is 0x%x", newPath.c_str(), GetLastError());
}
}
MoveFileA(_old.c_str(), _new.c_str());
if (0 == GetLastError())
if (MoveFileA(_old.c_str(), _new.c_str()))
{
return true;
}
else
{
CCLOGERROR("Fail to rename file %s to %s !Error code is 0x%x", oldPath.c_str(), newPath.c_str(), GetLastError());
return false;
}
#else
int errorCode = rename(oldPath.c_str(), newPath.c_str());

View File

@ -1,6 +1,6 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
Copyright (c) 2013-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
@ -156,7 +156,7 @@ void GLView::updateDesignResolutionSize()
// reset director's member variables to fit visible rect
auto director = Director::getInstance();
director->_winSizeInPoints = getDesignResolutionSize();
director->createStatsLabel();
director->_isStatusLabelUpdated = true;
director->setGLDefaultValues();
}
}

View File

@ -104,67 +104,27 @@ LanguageType Application::getCurrentLanguage()
NSDictionary* temp = [NSLocale componentsFromLocaleIdentifier:currentLanguage];
NSString * languageCode = [temp objectForKey:NSLocaleLanguageCode];
LanguageType ret = LanguageType::ENGLISH;
if ([languageCode isEqualToString:@"zh"])
{
ret = LanguageType::CHINESE;
}
else if ([languageCode isEqualToString:@"en"])
{
ret = LanguageType::ENGLISH;
}
else if ([languageCode isEqualToString:@"fr"]){
ret = LanguageType::FRENCH;
}
else if ([languageCode isEqualToString:@"it"]){
ret = LanguageType::ITALIAN;
}
else if ([languageCode isEqualToString:@"de"]){
ret = LanguageType::GERMAN;
}
else if ([languageCode isEqualToString:@"es"]){
ret = LanguageType::SPANISH;
}
else if ([languageCode isEqualToString:@"nl"]){
ret = LanguageType::DUTCH;
}
else if ([languageCode isEqualToString:@"ru"]){
ret = LanguageType::RUSSIAN;
}
else if ([languageCode isEqualToString:@"ko"]){
ret = LanguageType::KOREAN;
}
else if ([languageCode isEqualToString:@"ja"]){
ret = LanguageType::JAPANESE;
}
else if ([languageCode isEqualToString:@"hu"]){
ret = LanguageType::HUNGARIAN;
}
else if ([languageCode isEqualToString:@"pt"]){
ret = LanguageType::PORTUGUESE;
}
else if ([languageCode isEqualToString:@"ar"]){
ret = LanguageType::ARABIC;
}
else if ([languageCode isEqualToString:@"nb"]){
ret = LanguageType::NORWEGIAN;
}
else if ([languageCode isEqualToString:@"pl"]){
ret = LanguageType::POLISH;
}
else if ([languageCode isEqualToString:@"tr"]){
ret = LanguageType::TURKISH;
}
else if ([languageCode isEqualToString:@"uk"]){
ret = LanguageType::UKRAINIAN;
}
else if ([languageCode isEqualToString:@"ro"]){
ret = LanguageType::ROMANIAN;
}
else if ([languageCode isEqualToString:@"bg"]){
ret = LanguageType::BULGARIAN;
}
return ret;
if ([languageCode isEqualToString:@"zh"]) return LanguageType::CHINESE;
if ([languageCode isEqualToString:@"en"]) return LanguageType::ENGLISH;
if ([languageCode isEqualToString:@"fr"]) return LanguageType::FRENCH;
if ([languageCode isEqualToString:@"it"]) return LanguageType::ITALIAN;
if ([languageCode isEqualToString:@"de"]) return LanguageType::GERMAN;
if ([languageCode isEqualToString:@"es"]) return LanguageType::SPANISH;
if ([languageCode isEqualToString:@"nl"]) return LanguageType::DUTCH;
if ([languageCode isEqualToString:@"ru"]) return LanguageType::RUSSIAN;
if ([languageCode isEqualToString:@"ko"]) return LanguageType::KOREAN;
if ([languageCode isEqualToString:@"ja"]) return LanguageType::JAPANESE;
if ([languageCode isEqualToString:@"hu"]) return LanguageType::HUNGARIAN;
if ([languageCode isEqualToString:@"pt"]) return LanguageType::PORTUGUESE;
if ([languageCode isEqualToString:@"ar"]) return LanguageType::ARABIC;
if ([languageCode isEqualToString:@"nb"]) return LanguageType::NORWEGIAN;
if ([languageCode isEqualToString:@"pl"]) return LanguageType::POLISH;
if ([languageCode isEqualToString:@"tr"]) return LanguageType::TURKISH;
if ([languageCode isEqualToString:@"uk"]) return LanguageType::UKRAINIAN;
if ([languageCode isEqualToString:@"ro"]) return LanguageType::ROMANIAN;
if ([languageCode isEqualToString:@"bg"]) return LanguageType::BULGARIAN;
return LanguageType::ENGLISH;
}
Application::Platform Application::getTargetPlatform()

View File

@ -160,65 +160,27 @@ LanguageType Application::getCurrentLanguage()
NSDictionary* temp = [NSLocale componentsFromLocaleIdentifier:currentLanguage];
NSString * languageCode = [temp objectForKey:NSLocaleLanguageCode];
LanguageType ret = LanguageType::ENGLISH;
if ([languageCode isEqualToString:@"zh"]){
ret = LanguageType::CHINESE;
}
else if ([languageCode isEqualToString:@"en"]){
ret = LanguageType::ENGLISH;
}
else if ([languageCode isEqualToString:@"fr"]){
ret = LanguageType::FRENCH;
}
else if ([languageCode isEqualToString:@"it"]){
ret = LanguageType::ITALIAN;
}
else if ([languageCode isEqualToString:@"de"]){
ret = LanguageType::GERMAN;
}
else if ([languageCode isEqualToString:@"es"]){
ret = LanguageType::SPANISH;
}
else if ([languageCode isEqualToString:@"nl"]){
ret = LanguageType::DUTCH;
}
else if ([languageCode isEqualToString:@"ru"]){
ret = LanguageType::RUSSIAN;
}
else if ([languageCode isEqualToString:@"ko"]){
ret = LanguageType::KOREAN;
}
else if ([languageCode isEqualToString:@"ja"]){
ret = LanguageType::JAPANESE;
}
else if ([languageCode isEqualToString:@"hu"]){
ret = LanguageType::HUNGARIAN;
}
else if ([languageCode isEqualToString:@"pt"]){
ret = LanguageType::PORTUGUESE;
}
else if ([languageCode isEqualToString:@"ar"]){
ret = LanguageType::ARABIC;
}
else if ([languageCode isEqualToString:@"nb"]){
ret = LanguageType::NORWEGIAN;
}
else if ([languageCode isEqualToString:@"pl"]){
ret = LanguageType::POLISH;
}
else if ([languageCode isEqualToString:@"tr"]){
ret = LanguageType::TURKISH;
}
else if ([languageCode isEqualToString:@"uk"]){
ret = LanguageType::UKRAINIAN;
}
else if ([languageCode isEqualToString:@"ro"]){
ret = LanguageType::ROMANIAN;
}
else if ([languageCode isEqualToString:@"bg"]){
ret = LanguageType::BULGARIAN;
}
return ret;
if ([languageCode isEqualToString:@"zh"]) return LanguageType::CHINESE;
if ([languageCode isEqualToString:@"en"]) return LanguageType::ENGLISH;
if ([languageCode isEqualToString:@"fr"]) return LanguageType::FRENCH;
if ([languageCode isEqualToString:@"it"]) return LanguageType::ITALIAN;
if ([languageCode isEqualToString:@"de"]) return LanguageType::GERMAN;
if ([languageCode isEqualToString:@"es"]) return LanguageType::SPANISH;
if ([languageCode isEqualToString:@"nl"]) return LanguageType::DUTCH;
if ([languageCode isEqualToString:@"ru"]) return LanguageType::RUSSIAN;
if ([languageCode isEqualToString:@"ko"]) return LanguageType::KOREAN;
if ([languageCode isEqualToString:@"ja"]) return LanguageType::JAPANESE;
if ([languageCode isEqualToString:@"hu"]) return LanguageType::HUNGARIAN;
if ([languageCode isEqualToString:@"pt"]) return LanguageType::PORTUGUESE;
if ([languageCode isEqualToString:@"ar"]) return LanguageType::ARABIC;
if ([languageCode isEqualToString:@"nb"]) return LanguageType::NORWEGIAN;
if ([languageCode isEqualToString:@"pl"]) return LanguageType::POLISH;
if ([languageCode isEqualToString:@"tr"]) return LanguageType::TURKISH;
if ([languageCode isEqualToString:@"uk"]) return LanguageType::UKRAINIAN;
if ([languageCode isEqualToString:@"ro"]) return LanguageType::ROMANIAN;
if ([languageCode isEqualToString:@"bg"]) return LanguageType::BULGARIAN;
return LanguageType::ENGLISH;
}
bool Application::openURL(const std::string &url)

View File

@ -75,7 +75,9 @@ void Device::setAccelerometerEnabled(bool isEnabled)
if(sAccelerometer == nullptr)
{
MessageBox("This device does not have an accelerometer.","Alert");
// It's not a friendly experience and may cause crash.
//MessageBox("This device does not have an accelerometer.","Alert");
log("This device does not have an accelerometer.");
return;
}

View File

@ -48,7 +48,9 @@ class EventListenerCustom;
class EventCustom;
/**
Uniform Value, which is used to store to value send to openGL pipe line by glUniformXXX.
* Uniform Value, which is used to store to value send to openGL pipe line by glUniformXXX.
*
* @lua NA
*/
class CC_DLL UniformValue
{
@ -134,7 +136,11 @@ protected:
*/
};
/**Vertex Attribute Value, which is an abstraction of VertexAttribute and data pointer.*/
/**
* Vertex Attribute Value, which is an abstraction of VertexAttribute and data pointer.
*
* @lua NA
*/
class CC_DLL VertexAttribValue
{
friend class GLProgram;

View File

@ -66,7 +66,8 @@
-- @return ActionCamera#ActionCamera ret (return value: cc.ActionCamera)
--------------------------------
-- js ctor
-- js ctor<br>
-- lua new
-- @function [parent=#ActionCamera] ActionCamera
-- @param self
-- @return ActionCamera#ActionCamera self (return value: cc.ActionCamera)

View File

@ -13,7 +13,7 @@
--------------------------------
-- Sets the Animation object to be animated <br>
-- param A certain animation.
-- param animation certain animation.
-- @function [parent=#Animate] setAnimation
-- @param self
-- @param #cc.Animation animation

View File

@ -10,6 +10,15 @@
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- set high quality<br>
-- 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<br>
-- param true: is high quality, false: is low quality.
-- @function [parent=#Animate3D] setHighQuality
-- @param self
-- @param #bool isHighQuality
-- @return Animate3D#Animate3D self (return value: cc.Animate3D)
--------------------------------
--
-- @function [parent=#Animate3D] setWeight
@ -30,6 +39,13 @@
-- @param #float speed
-- @return Animate3D#Animate3D self (return value: cc.Animate3D)
--------------------------------
-- get high quality<br>
-- is it high quality
-- @function [parent=#Animate3D] isHighQuality
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- get & set origin interval
-- @function [parent=#Animate3D] setOriginInterval

View File

@ -4,7 +4,8 @@
-- @parent_module ccexp
--------------------------------
--
-- Defautl constructor<br>
-- lua new
-- @function [parent=#AudioProfile] AudioProfile
-- @param self
-- @return experimental::AudioProfile#experimental::AudioProfile self (return value: cc.experimental::AudioProfile)

View File

@ -3,13 +3,6 @@
-- @module CSLoader
-- @parent_module cc
--------------------------------
--
-- @function [parent=#CSLoader] setJsonPath
-- @param self
-- @param #string jsonPath
-- @return CSLoader#CSLoader self (return value: cc.CSLoader)
--------------------------------
--
-- @function [parent=#CSLoader] createNodeFromJson
@ -43,8 +36,9 @@
--------------------------------
--
-- @function [parent=#CSLoader] purge
-- @function [parent=#CSLoader] setJsonPath
-- @param self
-- @param #string jsonPath
-- @return CSLoader#CSLoader self (return value: cc.CSLoader)
--------------------------------

View File

@ -19,7 +19,7 @@
--------------------------------
-- Set the selector target.<br>
-- param The selector target.
-- param sel The selector target.
-- @function [parent=#CallFunc] setTargetCallback
-- @param self
-- @param #cc.Ref sel

View File

@ -112,7 +112,6 @@
-- Creates an orthographic camera.<br>
-- param zoomX The zoom factor along the X-axis of the orthographic projection (the width of the ortho projection).<br>
-- param zoomY The zoom factor along the Y-axis of the orthographic projection (the height of the ortho projection).<br>
-- param aspectRatio The aspect ratio of the orthographic projection.<br>
-- param nearPlane The near plane distance.<br>
-- param farPlane The far plane distance.
-- @function [parent=#Camera] createOrthographic

View File

@ -43,11 +43,11 @@
--------------------------------
-- Load cross texture for checkbox.<br>
-- param cross The cross texture name.<br>
-- param crossTextureName The cross texture name.<br>
-- param texType @see `Widget::TextureResType`
-- @function [parent=#CheckBox] loadTextureFrontCross
-- @param self
-- @param #string
-- @param #string crossTextureName
-- @param #int texType
-- @return CheckBox#CheckBox self (return value: ccui.CheckBox)
@ -60,17 +60,18 @@
--------------------------------
-- Load all textures for initializing a checkbox.<br>
-- param backGround The background image name.<br>
-- param backGroundSelected The background selected image name.<br>
-- param background The background image name.<br>
-- param backgroundSelected The background selected image name.<br>
-- param cross The cross image name.<br>
-- param backgroundDisabled The background disabled state texture.<br>
-- param frontCrossDisabled The front cross disabled state image name.<br>
-- param texType @see `Widget::TextureResType`
-- @function [parent=#CheckBox] loadTextures
-- @param self
-- @param #string backGround
-- @param #string backGroundSelected
-- @param #string background
-- @param #string backgroundSelected
-- @param #string cross
-- @param #string backGroundDisabled
-- @param #string backgroundDisabled
-- @param #string frontCrossDisabled
-- @param #int texType
-- @return CheckBox#CheckBox self (return value: ccui.CheckBox)
@ -86,7 +87,7 @@
--------------------------------
-- Load background texture for checkbox.<br>
-- param backGround The background image name.<br>
-- param texType @see `Widget::TextureResType`
-- param type @see `Widget::TextureResType`
-- @function [parent=#CheckBox] loadTextureBackGround
-- @param self
-- @param #string backGround
@ -119,7 +120,7 @@
-- @function [parent=#CheckBox] create
-- @param self
-- @param #string backGround
-- @param #string backGroundSeleted
-- @param #string backGroundSelected
-- @param #string cross
-- @param #string backGroundDisabled
-- @param #string frontCrossDisabled
@ -151,7 +152,8 @@
-- @return size_table#size_table ret (return value: size_table)
--------------------------------
-- Default constructor.
-- Default constructor.<br>
-- lua new
-- @function [parent=#CheckBox] CheckBox
-- @param self
-- @return CheckBox#CheckBox self (return value: ccui.CheckBox)

View File

@ -11,7 +11,8 @@
-- By default returns true if has any children attached.<br>
-- return If you have custom stencil-based node with stencil drawing mechanics other then children-based,<br>
-- then this method should return true every time you wish stencil to be visited.<br>
-- By default returns true if has any children attached.
-- By default returns true if has any children attached.<br>
-- js NA
-- @function [parent=#ClippingNode] hasContent
-- @param self
-- @return bool#bool ret (return value: bool)

View File

@ -86,7 +86,8 @@
-- @return ControlColourPicker#ControlColourPicker self (return value: cc.ControlColourPicker)
--------------------------------
-- js ctor
-- js ctor<br>
-- lua new
-- @function [parent=#ControlColourPicker] ControlColourPicker
-- @param self
-- @return ControlColourPicker#ControlColourPicker self (return value: cc.ControlColourPicker)

View File

@ -180,7 +180,8 @@
-- @return bool#bool ret (return value: bool)
--------------------------------
-- js ctor
-- js ctor<br>
-- lua new
-- @function [parent=#ControlPotentiometer] ControlPotentiometer
-- @param self
-- @return ControlPotentiometer#ControlPotentiometer self (return value: cc.ControlPotentiometer)

View File

@ -173,7 +173,8 @@
-- @return ControlSlider#ControlSlider self (return value: cc.ControlSlider)
--------------------------------
-- js ctor
-- js ctor<br>
-- lua new
-- @function [parent=#ControlSlider] ControlSlider
-- @param self
-- @return ControlSlider#ControlSlider self (return value: cc.ControlSlider)

View File

@ -178,7 +178,8 @@
-- @return bool#bool ret (return value: bool)
--------------------------------
-- js ctor
-- js ctor<br>
-- lua new
-- @function [parent=#ControlStepper] ControlStepper
-- @param self
-- @return ControlStepper#ControlStepper self (return value: cc.ControlStepper)

View File

@ -98,7 +98,8 @@
-- @return bool#bool ret (return value: bool)
--------------------------------
-- js ctor
-- js ctor<br>
-- lua new
-- @function [parent=#ControlSwitch] ControlSwitch
-- @param self
-- @return ControlSwitch#ControlSwitch self (return value: cc.ControlSwitch)

View File

@ -8,7 +8,8 @@
-- Draw an line from origin to destination with color. <br>
-- param origin The line origin.<br>
-- param destination The line destination.<br>
-- param color The line color.
-- param color The line color.<br>
-- js NA
-- @function [parent=#DrawNode] drawLine
-- @param self
-- @param #vec2_table origin
@ -43,7 +44,7 @@
-- @return DrawNode#DrawNode self (return value: cc.DrawNode)
--------------------------------
--
-- js NA
-- @function [parent=#DrawNode] onDrawGLPoint
-- @param self
-- @param #mat4_table transform
@ -78,14 +79,13 @@
--------------------------------
-- Get the color mixed mode.<br>
-- js NA<br>
-- lua NA
-- @function [parent=#DrawNode] getBlendFunc
-- @param self
-- @return BlendFunc#BlendFunc ret (return value: cc.BlendFunc)
--------------------------------
--
-- js NA
-- @function [parent=#DrawNode] onDraw
-- @param self
-- @param #mat4_table transform
@ -124,7 +124,7 @@
-- @return DrawNode#DrawNode self (return value: cc.DrawNode)
--------------------------------
--
-- js NA
-- @function [parent=#DrawNode] onDrawGLLine
-- @param self
-- @param #mat4_table transform
@ -136,7 +136,8 @@
-- param p1 The triangle vertex point.<br>
-- param p2 The triangle vertex point.<br>
-- param p3 The triangle vertex point.<br>
-- param color The triangle color.
-- param color The triangle color.<br>
-- js NA
-- @function [parent=#DrawNode] drawTriangle
-- @param self
-- @param #vec2_table p1
@ -168,7 +169,8 @@
-- The origin and the destination can not have the same x and y coordinate.<br>
-- param origin The rectangle origin.<br>
-- param destination The rectangle destination.<br>
-- param color The rectangle color.
-- param color The rectangle color.<br>
-- js NA
-- @function [parent=#DrawNode] drawSolidRect
-- @param self
-- @param #vec2_table origin
@ -180,7 +182,8 @@
-- Draw a point.<br>
-- param point A Vec2 used to point.<br>
-- param pointSize The point size.<br>
-- param color The point color.
-- param color The point color.<br>
-- js NA
-- @function [parent=#DrawNode] drawPoint
-- @param self
-- @param #vec2_table point

View File

@ -284,7 +284,8 @@
--------------------------------
-- Constructor.<br>
-- js ctor
-- js ctor<br>
-- lua new
-- @function [parent=#EditBox] EditBox
-- @param self
-- @return EditBox#EditBox self (return value: ccui.EditBox)

View File

@ -12,7 +12,8 @@
--------------------------------
-- @{<br>
-- Getter and Setter for depth test state when blit.
-- Getter and Setter for depth test state when blit.<br>
-- js NA
-- @function [parent=#Grid3D] setNeedDepthTestForBlit
-- @param self
-- @param #bool neededDepthTest

View File

@ -106,7 +106,8 @@
--------------------------------
-- @{<br>
-- Interface for custom action when before or after draw.
-- Interface for custom action when before or after draw.<br>
-- js NA
-- @function [parent=#GridBase] beforeBlit
-- @param self
-- @return GridBase#GridBase self (return value: cc.GridBase)

View File

@ -13,7 +13,9 @@
-- @return HBox#HBox ret (return value: ccui.HBox)
--------------------------------
-- Default constructor
-- Default constructor<br>
-- js ctor<br>
-- lua new
-- @function [parent=#HBox] HBox
-- @param self
-- @return HBox#HBox self (return value: ccui.HBox)

View File

@ -6,9 +6,11 @@
--------------------------------
-- brief Get a UTF8 substring from a std::string with a given start position and length<br>
-- Sample: std::string str = "中国中国中国"; substr = getSubStringOfUTF8String(str,0,2) will = "中国"<br>
-- param str The source string.<br>
-- param start The start position of the substring.<br>
-- param length The length of the substring in UTF8 count<br>
-- return a UTF8 substring
-- return a UTF8 substring<br>
-- js NA
-- @function [parent=#Helper] getSubStringOfUTF8String
-- @param self
-- @param #string str

View File

@ -16,10 +16,10 @@
--------------------------------
-- Enable scale9 renderer.<br>
-- param enable Set to true will use scale9 renderer, false otherwise.
-- param enabled Set to true will use scale9 renderer, false otherwise.
-- @function [parent=#ImageView] setScale9Enabled
-- @param self
-- @param #bool able
-- @param #bool enabled
-- @return ImageView#ImageView self (return value: ccui.ImageView)
--------------------------------
@ -95,7 +95,9 @@
-- @return ImageView#ImageView self (return value: ccui.ImageView)
--------------------------------
-- Default constructor
-- Default constructor<br>
-- js ctor<br>
-- lua new
-- @function [parent=#ImageView] ImageView
-- @param self
-- @return ImageView#ImageView self (return value: ccui.ImageView)

View File

@ -50,7 +50,7 @@
-- @return LabelAtlas#LabelAtlas self (return value: cc.LabelAtlas)
--------------------------------
--
-- js NA
-- @function [parent=#LabelAtlas] getDescription
-- @param self
-- @return string#string ret (return value: string)

View File

@ -269,7 +269,7 @@
-- @function [parent=#Layout] addChild
-- @param self
-- @param #cc.Node child
-- @param #int zOrder
-- @param #int localZOrder
-- @param #string name
-- @return Layout#Layout self (return value: ccui.Layout)
@ -299,7 +299,7 @@
--------------------------------
-- When a widget is in a layout, you could call this method to get the next focused widget within a specified direction.<br>
-- If the widget is not in a layout, it will return itself<br>
-- param dir the direction to look for the next focused widget in a layout<br>
-- param direction the direction to look for the next focused widget in a layout<br>
-- param current the current focused widget<br>
-- return the next focused widget in a layout
-- @function [parent=#Layout] findNextFocusedWidget
@ -317,7 +317,9 @@
-- @return Layout#Layout self (return value: ccui.Layout)
--------------------------------
-- Default constructor
-- Default constructor<br>
-- js ctor<br>
-- lua new
-- @function [parent=#Layout] Layout
-- @param self
-- @return Layout#Layout self (return value: ccui.Layout)

View File

@ -270,7 +270,7 @@
--------------------------------
-- Percent content size is used to adapt node's content size based on parent's content size.<br>
-- If set to true then node's content size will be changed based on the value setted by @setPercentContentSize<br>
-- If set to true then node's content size will be changed based on the value setted by @see setPercentContentSize<br>
-- param isUsed True to enable percent content size, false otherwise.
-- @function [parent=#LayoutComponent] setUsingPercentContentSize
-- @param self
@ -361,7 +361,7 @@
--------------------------------
-- Change the bottom margin of owner relative to its parent.<br>
-- param Margin in float.
-- param margin in float.
-- @function [parent=#LayoutComponent] setBottomMargin
-- @param self
-- @param #float margin
@ -399,7 +399,8 @@
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Default constructor
-- Default constructor<br>
-- lua new
-- @function [parent=#LayoutComponent] LayoutComponent
-- @param self
-- @return LayoutComponent#LayoutComponent self (return value: ccui.LayoutComponent)

View File

@ -42,7 +42,8 @@
-- @return LayoutParameter#LayoutParameter ret (return value: ccui.LayoutParameter)
--------------------------------
-- Default constructor.
-- Default constructor.<br>
-- lua new
-- @function [parent=#LayoutParameter] LayoutParameter
-- @param self
-- @return LayoutParameter#LayoutParameter self (return value: ccui.LayoutParameter)

View File

@ -42,7 +42,8 @@
-- @return LinearLayoutParameter#LinearLayoutParameter self (return value: ccui.LinearLayoutParameter)
--------------------------------
-- Default constructor.
-- Default constructor.<br>
-- lua new
-- @function [parent=#LinearLayoutParameter] LinearLayoutParameter
-- @param self
-- @return LinearLayoutParameter#LinearLayoutParameter self (return value: ccui.LinearLayoutParameter)

View File

@ -180,8 +180,8 @@
--------------------------------
-- Changes scroll direction of scrollview.<br>
-- Direction Direction::VERTICAL means vertical scroll, Direction::HORIZONTAL means horizontal scroll<br>
-- param dir, set the list view's scroll direction
-- Direction Direction::VERTICAL means vertical scroll, Direction::HORIZONTAL means horizontal scroll.<br>
-- param dir Set the list view's scroll direction.
-- @function [parent=#ListView] setDirection
-- @param self
-- @param #int dir
@ -215,7 +215,9 @@
-- @return ListView#ListView self (return value: ccui.ListView)
--------------------------------
-- Default constructor
-- Default constructor<br>
-- js ctor<br>
-- lua new
-- @function [parent=#ListView] ListView
-- @param self
-- @return ListView#ListView self (return value: ccui.ListView)

View File

@ -120,7 +120,9 @@
-- @return LoadingBar#LoadingBar self (return value: ccui.LoadingBar)
--------------------------------
-- Default constructor.
-- Default constructor.<br>
-- js ctor<br>
-- lua new
-- @function [parent=#LoadingBar] LoadingBar
-- @param self
-- @return LoadingBar#LoadingBar self (return value: ccui.LoadingBar)

View File

@ -48,7 +48,7 @@
-- @return rect_table#rect_table ret (return value: rect_table)
--------------------------------
--
-- js NA
-- @function [parent=#MenuItem] getDescription
-- @param self
-- @return string#string ret (return value: string)

View File

@ -6,14 +6,16 @@
--------------------------------
-- get font size .<br>
-- js getFontSize
-- js getFontSize<br>
-- js NA
-- @function [parent=#MenuItemFont] getFontSizeObj
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- Returns the name of the Font.<br>
-- js getFontNameObj
-- js getFontNameObj<br>
-- js NA
-- @function [parent=#MenuItemFont] getFontNameObj
-- @param self
-- @return string#string ret (return value: string)
@ -22,7 +24,8 @@
-- Set font size.<br>
-- c++ can not overload static and non-static member functions with the same parameter types.<br>
-- so change the name to setFontSizeObj.<br>
-- js setFontSize
-- js setFontSize<br>
-- js NA
-- @function [parent=#MenuItemFont] setFontSizeObj
-- @param self
-- @param #int size
@ -32,7 +35,8 @@
-- Set the font name .<br>
-- c++ can not overload static and non-static member functions with the same parameter types.<br>
-- so change the name to setFontNameObj.<br>
-- js setFontName
-- js setFontName<br>
-- js NA
-- @function [parent=#MenuItemFont] setFontNameObj
-- @param self
-- @param #string name

View File

@ -567,7 +567,7 @@
-- Executes an action, and returns the action that is executed.<br>
-- This node becomes the action's target. Refer to Action::getTarget().<br>
-- warning Actions don't retain their target.<br>
-- param An Action pointer
-- param action An Action pointer.
-- @function [parent=#Node] runAction
-- @param self
-- @param #cc.Action action

View File

@ -166,7 +166,9 @@
-- @return PageView#PageView self (return value: ccui.PageView)
--------------------------------
-- Default constructor
-- Default constructor<br>
-- js ctor<br>
-- lua new
-- @function [parent=#PageView] PageView
-- @param self
-- @return PageView#PageView self (return value: ccui.PageView)

View File

@ -390,7 +390,7 @@
--------------------------------
-- Sets the source position of the emitter.<br>
-- param The source position of the emitter.
-- param pos The source position of the emitter.
-- @function [parent=#ParticleSystem] setSourcePosition
-- @param self
-- @param #vec2_table pos
@ -713,7 +713,7 @@
-- This plist files can be created manually or with Particle Designer:<br>
-- http:particledesigner.71squared.com/<br>
-- since v2.0<br>
-- param Particle plist file name.<br>
-- param plistFile Particle plist file name.<br>
-- return An autoreleased ParticleSystem object.
-- @function [parent=#ParticleSystem] create
-- @param self

View File

@ -37,14 +37,14 @@
-- @return float#float ret (return value: float)
--------------------------------
-- Set the distance between “clicks”.
-- Set the distance between "clicks".
-- @function [parent=#PhysicsJointRatchet] setRatchet
-- @param self
-- @param #float ratchet
-- @return PhysicsJointRatchet#PhysicsJointRatchet self (return value: cc.PhysicsJointRatchet)
--------------------------------
-- Get the distance between “clicks”.
-- Get the distance between "clicks".
-- @function [parent=#PhysicsJointRatchet] getRatchet
-- @param self
-- @return float#float ret (return value: float)
@ -54,7 +54,7 @@
-- param a A is the body to connect.<br>
-- param b B is the body to connect.<br>
-- param phase Phase is the initial offset to use when deciding where the ratchet angles are.<br>
-- param ratchet Ratchet is the distance between “clicks”.<br>
-- param ratchet Ratchet is the distance between "clicks".<br>
-- return A object pointer.
-- @function [parent=#PhysicsJointRatchet] construct
-- @param self

View File

@ -107,7 +107,7 @@
-- @return ProtectedNode#ProtectedNode self (return value: cc.ProtectedNode)
--------------------------------
-- / @} end of Children and Parent
-- js NA
-- @function [parent=#ProtectedNode] visit
-- @param self
-- @param #cc.Renderer renderer

View File

@ -13,7 +13,9 @@
-- @return RelativeBox#RelativeBox ret (return value: ccui.RelativeBox)
--------------------------------
-- Default constructor.
-- Default constructor.<br>
-- js ctor<br>
-- lua new
-- @function [parent=#RelativeBox] RelativeBox
-- @param self
-- @return RelativeBox#RelativeBox self (return value: ccui.RelativeBox)

View File

@ -72,7 +72,8 @@
-- @return RelativeLayoutParameter#RelativeLayoutParameter self (return value: ccui.RelativeLayoutParameter)
--------------------------------
-- Default constructor
-- Default constructor<br>
-- lua new
-- @function [parent=#RelativeLayoutParameter] RelativeLayoutParameter
-- @param self
-- @return RelativeLayoutParameter#RelativeLayoutParameter self (return value: ccui.RelativeLayoutParameter)

View File

@ -77,7 +77,8 @@
--------------------------------
-- Flag: Use stack matrix computed from scene hierarchy or generate new modelView and projection matrix.<br>
-- param keepMatrix Wether or not use stack matrix computed from scene hierarchy or generate new modelView and projection matrix.
-- param keepMatrix Wether or not use stack matrix computed from scene hierarchy or generate new modelView and projection matrix.<br>
-- js NA
-- @function [parent=#RenderTexture] setKeepMatrix
-- @param self
-- @param #bool keepMatrix
@ -125,7 +126,8 @@
-- @return RenderTexture#RenderTexture self (return value: cc.RenderTexture)
--------------------------------
-- End is key word of lua, use other name to export to lua.
-- End is key word of lua, use other name to export to lua.<br>
-- js NA
-- @function [parent=#RenderTexture] endToLua
-- @param self
-- @return RenderTexture#RenderTexture self (return value: cc.RenderTexture)
@ -238,7 +240,8 @@
--------------------------------
-- FIXME: should be procted.<br>
-- but due to a bug in PowerVR + Android,<br>
-- the constructor is public again.
-- the constructor is public again.<br>
-- js ctor
-- @function [parent=#RenderTexture] RenderTexture
-- @param self
-- @return RenderTexture#RenderTexture self (return value: cc.RenderTexture)

View File

@ -18,7 +18,9 @@
-- @return bool#bool ret (return value: bool)
--------------------------------
-- brief Default constructor.
-- brief Default constructor.<br>
-- js ctor<br>
-- lua new
-- @function [parent=#RichElement] RichElement
-- @param self
-- @return RichElement#RichElement self (return value: ccui.RichElement)

View File

@ -35,7 +35,9 @@
-- @return RichElementCustomNode#RichElementCustomNode ret (return value: ccui.RichElementCustomNode)
--------------------------------
-- brief Default constructor.
-- brief Default constructor.<br>
-- js ctor<br>
-- lua new
-- @function [parent=#RichElementCustomNode] RichElementCustomNode
-- @param self
-- @return RichElementCustomNode#RichElementCustomNode self (return value: ccui.RichElementCustomNode)

View File

@ -35,7 +35,9 @@
-- @return RichElementImage#RichElementImage ret (return value: ccui.RichElementImage)
--------------------------------
-- brief Default constructor.
-- brief Default constructor.<br>
-- js ctor<br>
-- lua new
-- @function [parent=#RichElementImage] RichElementImage
-- @param self
-- @return RichElementImage#RichElementImage self (return value: ccui.RichElementImage)

View File

@ -43,7 +43,9 @@
-- @return RichElementText#RichElementText ret (return value: ccui.RichElementText)
--------------------------------
-- brief Default constructor.
-- brief Default constructor.<br>
-- js ctor<br>
-- lua new
-- @function [parent=#RichElementText] RichElementText
-- @param self
-- @return RichElementText#RichElementText self (return value: ccui.RichElementText)

View File

@ -79,7 +79,9 @@
-- @return RichText#RichText self (return value: ccui.RichText)
--------------------------------
-- brief Default constructor.
-- brief Default constructor.<br>
-- js ctor<br>
-- lua new
-- @function [parent=#RichText] RichText
-- @param self
-- @return RichText#RichText self (return value: ccui.RichText)

View File

@ -35,7 +35,7 @@
-- @return RotateTo#RotateTo ret (return value: cc.RotateTo)
--------------------------------
-- param dt In seconds.
-- param time In seconds.
-- @function [parent=#RotateTo] update
-- @param self
-- @param #float time

View File

@ -37,7 +37,8 @@
--------------------------------
-- brief Toggle 9-slice feature.<br>
-- If Scale9Sprite is 9-slice disabled, the Scale9Sprite will rendered as a normal sprite.<br>
-- param enabled True to enable 9-slice, false otherwise.
-- param enabled True to enable 9-slice, false otherwise.<br>
-- js NA
-- @function [parent=#Scale9Sprite] setScale9Enabled
-- @param self
-- @param #bool enabled
@ -177,7 +178,8 @@
--------------------------------
-- brief Query whether the Scale9Sprite is enable 9-slice or not.<br>
-- return True if 9-slice is enabled, false otherwise.
-- return True if 9-slice is enabled, false otherwise.<br>
-- js NA
-- @function [parent=#Scale9Sprite] isScale9Enabled
-- @param self
-- @return bool#bool ret (return value: bool)
@ -399,7 +401,8 @@
--------------------------------
-- Default constructor.<br>
-- js ctor
-- js ctor<br>
-- lua new
-- @function [parent=#Scale9Sprite] Scale9Sprite
-- @param self
-- @return Scale9Sprite#Scale9Sprite self (return value: ccui.Scale9Sprite)

View File

@ -134,7 +134,7 @@
--------------------------------
-- Move inner container to vertical percent position of scrollview.<br>
-- param A value between 0 and 100.
-- param percent A value between 0 and 100.
-- @function [parent=#ScrollView] jumpToPercentVertical
-- @param self
-- @param #float percent
@ -164,7 +164,7 @@
--------------------------------
-- Move inner container to horizontal percent position of scrollview.<br>
-- param A value between 0 and 100.
-- param percent A value between 0 and 100.
-- @function [parent=#ScrollView] jumpToPercentHorizontal
-- @param self
-- @param #float percent
@ -202,7 +202,7 @@
--------------------------------
-- Move inner container to both direction percent position of scrollview.<br>
-- param A value between 0 and 100.
-- param percent A value between 0 and 100.
-- @function [parent=#ScrollView] jumpToPercentBothDirection
-- @param self
-- @param #vec2_table percent
@ -293,7 +293,7 @@
-- @function [parent=#ScrollView] addChild
-- @param self
-- @param #cc.Node child
-- @param #int zOrder
-- @param #int localZOrder
-- @param #string name
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
@ -341,7 +341,7 @@
--------------------------------
-- When a widget is in a layout, you could call this method to get the next focused widget within a specified direction.<br>
-- If the widget is not in a layout, it will return itself<br>
-- param dir the direction to look for the next focused widget in a layout<br>
-- param direction the direction to look for the next focused widget in a layout<br>
-- param current the current focused widget<br>
-- return the next focused widget in a layout
-- @function [parent=#ScrollView] findNextFocusedWidget
@ -388,7 +388,9 @@
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)
--------------------------------
-- Default constructor
-- Default constructor<br>
-- js ctor<br>
-- lua new
-- @function [parent=#ScrollView] ScrollView
-- @param self
-- @return ScrollView#ScrollView self (return value: ccui.ScrollView)

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