This commit is contained in:
Dhilan007 2014-07-10 17:47:16 +08:00
commit 9b0bab26b6
217 changed files with 1916 additions and 2051 deletions

View File

@ -886,6 +886,7 @@ Developers:
zhouxiaoxiaoxujian zhouxiaoxiaoxujian
Added TextField::getStringLength() Added TextField::getStringLength()
Add shadow, outline, glow filter support for UIText Add shadow, outline, glow filter support for UIText
Fix UITextField IME can't auto detach
QiuleiWang QiuleiWang
Fix the bug that calculated height of multi-line string was incorrect on iOS Fix the bug that calculated height of multi-line string was incorrect on iOS
@ -907,6 +908,9 @@ Developers:
Teivaz Teivaz
Custom uniform search optimization Custom uniform search optimization
chareice
Make `setup.py` work on zsh
Retired Core Developers: Retired Core Developers:
WenSheng Yang WenSheng Yang
Author of windows port, CCTextField, Author of windows port, CCTextField,

View File

@ -1,4 +1,21 @@
cocos2d-x-3.2rc0 ?? cocos2d-x-3.2 ??
[FIX] Animation3D: getOrCreate is deprecated and replaced with Animation3D::create
[FIX] Animate3D: setSpeed() accept negtive value, which means play reverse, getPlayback and setPlayBack are deprecated
[FIX] GLView: cursor position is not correct if design resolution is different from device resolution
[FIX] Label: color can not be set correctly if using system font
[FIX] Node: setRotation3D not work based on anchor point
[FIX] Node: modify regular of enumerateChildren, now it just searchs its children
[FIX] Setup.py: not work if using zsh
[FIX] SpriteBatchNode: opacity can not work
[FIX] Sprite3D: may crash on Android if playing animation and replace Scene after come from background
[FIX] UIdget: opacity is wrong when replace texture
[FIX] UITextField: keyboard can not hide if touching space outside of keyboard
[FIX] Others: don't release singleton objects correctly that are needed in the whole game, which will be treated
as memory leak when using VLD.
cocos2d-x-3.2rc0 Jul.7 2014
[NEW] FastTMXTiledMap: added fast tmx, which is much more faster for static tiled map [NEW] FastTMXTiledMap: added fast tmx, which is much more faster for static tiled map
[NEW] GLProgramState: can use uniform location to get/set uniform values [NEW] GLProgramState: can use uniform location to get/set uniform values
[NEW] HttpClient: added sendImmediate() [NEW] HttpClient: added sendImmediate()

View File

@ -585,7 +585,7 @@ public:
virtual JumpTo* clone() const override; virtual JumpTo* clone() const override;
virtual JumpTo* reverse(void) const override; virtual JumpTo* reverse(void) const override;
private: CC_CONSTRUCTOR_ACCESS:
JumpTo() {} JumpTo() {}
virtual ~JumpTo() {} virtual ~JumpTo() {}
CC_DISALLOW_COPY_AND_ASSIGN(JumpTo); CC_DISALLOW_COPY_AND_ASSIGN(JumpTo);
@ -750,7 +750,7 @@ public:
virtual ScaleBy* clone() const override; virtual ScaleBy* clone() const override;
virtual ScaleBy* reverse(void) const override; virtual ScaleBy* reverse(void) const override;
protected: CC_CONSTRUCTOR_ACCESS:
ScaleBy() {} ScaleBy() {}
virtual ~ScaleBy() {} virtual ~ScaleBy() {}
@ -842,7 +842,7 @@ public:
void setReverseAction(FadeTo* ac); void setReverseAction(FadeTo* ac);
protected: CC_CONSTRUCTOR_ACCESS:
FadeIn():_reverseAction(nullptr) {} FadeIn():_reverseAction(nullptr) {}
virtual ~FadeIn() {} virtual ~FadeIn() {}
@ -869,7 +869,7 @@ public:
void setReverseAction(FadeTo* ac); void setReverseAction(FadeTo* ac);
protected: CC_CONSTRUCTOR_ACCESS:
FadeOut():_reverseAction(nullptr) {} FadeOut():_reverseAction(nullptr) {}
virtual ~FadeOut() {} virtual ~FadeOut() {}
private: private:
@ -961,7 +961,7 @@ public:
virtual DelayTime* reverse() const override; virtual DelayTime* reverse() const override;
virtual DelayTime* clone() const override; virtual DelayTime* clone() const override;
protected: CC_CONSTRUCTOR_ACCESS:
DelayTime() {} DelayTime() {}
virtual ~DelayTime() {} virtual ~DelayTime() {}

View File

@ -884,7 +884,7 @@ LayerMultiplex * LayerMultiplex::create(Layer * layer, ...)
LayerMultiplex * LayerMultiplex::createWithLayer(Layer* layer) LayerMultiplex * LayerMultiplex::createWithLayer(Layer* layer)
{ {
return LayerMultiplex::create(layer, NULL); return LayerMultiplex::create(layer, nullptr);
} }
LayerMultiplex* LayerMultiplex::create() LayerMultiplex* LayerMultiplex::create()

View File

@ -842,24 +842,14 @@ void Node::enumerateChildren(const std::string &name, std::function<bool (Node *
size_t subStrStartPos = 0; // sub string start index size_t subStrStartPos = 0; // sub string start index
size_t subStrlength = length; // sub string length size_t subStrlength = length; // sub string length
// Starts with '/' or '//'? // Starts with '//'?
bool searchFromRoot = false; bool searchRecursively = false;
bool searchFromRootRecursive = false; if (length > 2 && name[0] == '/' && name[1] == '/')
if (name[0] == '/')
{ {
if (length > 2 && name[1] == '/') searchRecursively = true;
{
searchFromRootRecursive = true;
subStrStartPos = 2; subStrStartPos = 2;
subStrlength -= 2; subStrlength -= 2;
} }
else
{
searchFromRoot = true;
subStrStartPos = 1;
subStrlength -= 1;
}
}
// End with '/..'? // End with '/..'?
bool searchFromParent = false; bool searchFromParent = false;
@ -872,7 +862,7 @@ void Node::enumerateChildren(const std::string &name, std::function<bool (Node *
subStrlength -= 3; subStrlength -= 3;
} }
// Remove '/', '//', '/..' if exist // Remove '//', '/..' if exist
std::string newName = name.substr(subStrStartPos, subStrlength); std::string newName = name.substr(subStrStartPos, subStrlength);
if (searchFromParent) if (searchFromParent)
@ -880,23 +870,11 @@ void Node::enumerateChildren(const std::string &name, std::function<bool (Node *
newName.insert(0, "[[:alnum:]]+/"); newName.insert(0, "[[:alnum:]]+/");
} }
if (searchFromRoot)
{ if (searchRecursively)
// name is '/xxx'
auto root = getScene();
if (root)
{
root->doEnumerate(newName, callback);
}
}
else if (searchFromRootRecursive)
{ {
// name is '//xxx' // name is '//xxx'
auto root = getScene(); doEnumerateRecursive(this, newName, callback);
if (root)
{
doEnumerateRecursive(root, newName, callback);
}
} }
else else
{ {
@ -1635,17 +1613,19 @@ const Mat4& Node::getNodeToParentTransform() const
bool needsSkewMatrix = ( _skewX || _skewY ); bool needsSkewMatrix = ( _skewX || _skewY );
Vec2 anchorPoint;
anchorPoint.x = _anchorPointInPoints.x * _scaleX;
anchorPoint.y = _anchorPointInPoints.y * _scaleY;
// optimization: // optimization:
// inline anchor point calculation if skew is not needed // inline anchor point calculation if skew is not needed
// Adjusted transform calculation for rotational skew // Adjusted transform calculation for rotational skew
if (! needsSkewMatrix && !_anchorPointInPoints.equals(Vec2::ZERO)) if (! needsSkewMatrix && !_anchorPointInPoints.equals(Vec2::ZERO))
{ {
x += cy * -_anchorPointInPoints.x * _scaleX + -sx * -_anchorPointInPoints.y * _scaleY; x += cy * -anchorPoint.x + -sx * -anchorPoint.y;
y += sy * -_anchorPointInPoints.x * _scaleX + cx * -_anchorPointInPoints.y * _scaleY; y += sy * -anchorPoint.x + cx * -anchorPoint.y;
} }
// Build Transform Matrix // Build Transform Matrix
// Adjusted transform calculation for rotational skew // Adjusted transform calculation for rotational skew
float mat[] = { float mat[] = {
@ -1656,6 +1636,11 @@ const Mat4& Node::getNodeToParentTransform() const
_transform.set(mat); _transform.set(mat);
if(!_ignoreAnchorPointForPosition)
{
_transform.translate(anchorPoint.x, anchorPoint.y, 0);
}
// XXX // XXX
// FIX ME: Expensive operation. // FIX ME: Expensive operation.
// FIX ME: It should be done together with the rotationZ // FIX ME: It should be done together with the rotationZ
@ -1670,6 +1655,11 @@ const Mat4& Node::getNodeToParentTransform() const
_transform = _transform * rotX; _transform = _transform * rotX;
} }
if(!_ignoreAnchorPointForPosition)
{
_transform.translate(-anchorPoint.x, -anchorPoint.y, 0);
}
// XXX: Try to inline skew // XXX: Try to inline skew
// If skew is needed, apply skew and then anchor point // If skew is needed, apply skew and then anchor point
if (needsSkewMatrix) if (needsSkewMatrix)

View File

@ -714,23 +714,19 @@ public:
virtual Node* getChildByName(const std::string& name) const; virtual Node* getChildByName(const std::string& name) const;
/** Search the children of the receiving node to perform processing for nodes which share a name. /** Search the children of the receiving node to perform processing for nodes which share a name.
* *
* @param name The name to search for, supports c++11 regular expression * @param name The name to search for, supports c++11 regular expression.
* Search syntax options: * Search syntax options:
* `/` : When placed at the start of the search string, this indicates that the search should be performed on the tree's node. * `//`: Can only be placed at the begin of the search string. This indicates that it will search recursively.
* `//`: Can only be placed at the begin of the search string. This indicates that the search should be performed on the tree's node
* and be performed recursively across the entire node tree.
* `..`: The search should move up to the node's parent. Can only be placed at the end of string * `..`: The search should move up to the node's parent. Can only be placed at the end of string
* `/` : When placed anywhere but the start of the search string, this indicates that the search should move to the node's children * `/` : When placed anywhere but the start of the search string, this indicates that the search should move to the node's children.
* *
* @code * @code
* enumerateChildren("/MyName", ...): This searches the root's children and matches any node with the name `MyName`. * enumerateChildren("//MyName", ...): This searches the children recursively and matches any node with the name `MyName`.
* enumerateChildren("//MyName", ...): This searches the root's children recursively and matches any node with the name `MyName`.
* enumerateChildren("[[:alnum:]]+", ...): This search string matches every node of its children. * enumerateChildren("[[:alnum:]]+", ...): This search string matches every node of its children.
* enumerateChildren("/MyName", ...): This searches the node tree and matches the parent node of every node named `MyName`.
* enumerateChildren("A[[:digit:]]", ...): This searches the node's children and returns any child named `A0`, `A1`, ..., `A9` * enumerateChildren("A[[:digit:]]", ...): This searches the node's children and returns any child named `A0`, `A1`, ..., `A9`
* enumerateChildren("Abby/Normal", ...): This searches the node's grandchildren and returns any node whose name is `Normal` * enumerateChildren("Abby/Normal", ...): This searches the node's grandchildren and returns any node whose name is `Normal`
* and whose parent is named `Abby`. * and whose parent is named `Abby`.
* enumerateChildren("//Abby/Normal", ...): This searches the node tree and returns any node whose name is `Normal` and whose * enumerateChildren("//Abby/Normal", ...): This searches recursively and returns any node whose name is `Normal` and whose
* parent is named `Abby`. * parent is named `Abby`.
* @endcode * @endcode
* *

View File

@ -66,12 +66,12 @@ Animate3D* Animate3D::clone() const
auto animate = const_cast<Animate3D*>(this); auto animate = const_cast<Animate3D*>(this);
auto copy = Animate3D::create(animate->_animation); auto copy = Animate3D::create(animate->_animation);
copy->_speed = _speed; copy->_absSpeed = _absSpeed;
copy->_weight = _weight; copy->_weight = _weight;
copy->_elapsed = _elapsed; copy->_elapsed = _elapsed;
copy->_start = _start; copy->_start = _start;
copy->_last = _last; copy->_last = _last;
copy->_playBack = _playBack; copy->_playReverse = _playReverse;
copy->setDuration(animate->getDuration()); copy->setDuration(animate->getDuration());
return copy; return copy;
@ -81,7 +81,7 @@ Animate3D* Animate3D::clone() const
Animate3D* Animate3D::reverse() const Animate3D* Animate3D::reverse() const
{ {
auto animate = clone(); auto animate = clone();
animate->_playBack = !animate->_playBack; animate->_playReverse = !animate->_playReverse;
return animate; return animate;
} }
@ -112,16 +112,16 @@ void Animate3D::startWithTarget(Node *target)
//! called every frame with it's delta time. DON'T override unless you know what you are doing. //! called every frame with it's delta time. DON'T override unless you know what you are doing.
void Animate3D::step(float dt) void Animate3D::step(float dt)
{ {
ActionInterval::step(dt * _speed); ActionInterval::step(dt * _absSpeed);
} }
void Animate3D::update(float t) void Animate3D::update(float t)
{ {
if (_target) if (_target && _weight > 0.f)
{ {
float transDst[3], rotDst[4], scaleDst[3]; float transDst[3], rotDst[4], scaleDst[3];
float* trans = nullptr, *rot = nullptr, *scale = nullptr; float* trans = nullptr, *rot = nullptr, *scale = nullptr;
if (_playBack) if (_playReverse)
t = 1 - t; t = 1 - t;
t = _start + t * _last; t = _start + t * _last;
@ -149,13 +149,29 @@ void Animate3D::update(float t)
} }
float Animate3D::getSpeed() const
{
return _playReverse ? -_absSpeed : _absSpeed;
}
void Animate3D::setSpeed(float speed)
{
_absSpeed = fabsf(speed);
_playReverse = speed < 0;
}
void Animate3D::setWeight(float weight)
{
CCASSERT(weight >= 0.0f, "invalid weight");
_weight = fabsf(weight);
}
Animate3D::Animate3D() Animate3D::Animate3D()
: _speed(1) : _absSpeed(1.f)
, _weight(1.f) , _weight(1.f)
, _start(0.f) , _start(0.f)
, _last(1.f) , _last(1.f)
, _animation(nullptr) , _animation(nullptr)
, _playBack(false) , _playReverse(false)
{ {
} }

View File

@ -32,6 +32,7 @@
#include "base/ccMacros.h" #include "base/ccMacros.h"
#include "base/CCRef.h" #include "base/CCRef.h"
#include "base/ccTypes.h" #include "base/ccTypes.h"
#include "base/CCPlatformMacros.h"
#include "2d/CCActionInterval.h" #include "2d/CCActionInterval.h"
NS_CC_BEGIN NS_CC_BEGIN
@ -66,17 +67,17 @@ public:
virtual void update(float t) override; virtual void update(float t) override;
/**get & set speed */ /**get & set speed, negative speed means playing reverse */
float getSpeed() const { return _speed; } float getSpeed() const;
void setSpeed(float speed) { _speed = speed; } void setSpeed(float speed);
/**get & set blend weight*/ /**get & set blend weight, weight must positive*/
float getWeight() const { return _weight; } float getWeight() const { return _weight; }
void setWeight(float weight) { _weight = weight; } void setWeight(float weight);
/**get & set play back*/ /**get & set play reverse, these are deprecated, use set negative speed instead*/
bool getPlayBack() const { return _playBack; } CC_DEPRECATED_ATTRIBUTE bool getPlayBack() const { return _playReverse; }
void setPlayBack(bool playBack) { _playBack = playBack; } CC_DEPRECATED_ATTRIBUTE void setPlayBack(bool reverse) { _playReverse = reverse; }
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
@ -86,11 +87,11 @@ CC_CONSTRUCTOR_ACCESS:
protected: protected:
Animation3D* _animation; //animation data Animation3D* _animation; //animation data
float _speed; //playing speed float _absSpeed; //playing speed
float _weight; //blend weight float _weight; //blend weight
float _start; //start time 0 - 1, used to generate sub Animate3D float _start; //start time 0 - 1, used to generate sub Animate3D
float _last; //last time 0 - 1, used to generate sub Animate3D float _last; //last time 0 - 1, used to generate sub Animate3D
bool _playBack; // is playing back bool _playReverse; // is playing reverse
std::map<Bone*, Animation3D::Curve*> _boneCurves; //weak ref std::map<Bone*, Animation3D::Curve*> _boneCurves; //weak ref
}; };

View File

@ -30,7 +30,7 @@
NS_CC_BEGIN NS_CC_BEGIN
Animation3D* Animation3D::getOrCreate(const std::string& fileName, const std::string& animationName) Animation3D* Animation3D::create(const std::string& fileName, const std::string& animationName)
{ {
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(fileName); std::string fullPath = FileUtils::getInstance()->fullPathForFilename(fileName);
std::string key = fullPath + "#" + animationName; std::string key = fullPath + "#" + animationName;

View File

@ -59,8 +59,10 @@ public:
~Curve(); ~Curve();
}; };
/**read all animation or only the animation with given animationName? animationName == "" read all.*/ /**read all animation or only the animation with given animationName? animationName == "" read the first.*/
static Animation3D* getOrCreate(const std::string& filename, const std::string& animationName = ""); static Animation3D* create(const std::string& filename, const std::string& 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; }

View File

@ -447,8 +447,7 @@ bool Bundle3D::loadBinary(const std::string& path)
return false; return false;
} }
// Create bundle reader // Initialise bundle reader
//CC_SAFE_DELETE(_bundleReader);
_binaryReader.init( (char*)_binaryBuffer->getBytes(), _binaryBuffer->getSize() ); _binaryReader.init( (char*)_binaryBuffer->getBytes(), _binaryBuffer->getSize() );
// Read identifier info // Read identifier info
@ -463,8 +462,11 @@ bool Bundle3D::loadBinary(const std::string& path)
// Read version // Read version
unsigned char ver[2]; unsigned char ver[2];
if (_binaryReader.read(ver, 1, 2) == 2) if (_binaryReader.read(ver, 1, 2)!= 2){
{ CCLOG("Failed to read version:");
return false;
}
if (ver[0] != 0) { if (ver[0] != 0) {
clear(); clear();
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]); CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
@ -476,7 +478,7 @@ bool Bundle3D::loadBinary(const std::string& path)
CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]); CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]);
return false; return false;
} }
}
// Read ref table size // Read ref table size
if (_binaryReader.read(&_referenceCount, 4, 1) != 1) if (_binaryReader.read(&_referenceCount, 4, 1) != 1)
@ -766,17 +768,37 @@ bool Bundle3D::loadAnimationDataBinary(Animation3DData* animationdata)
GLenum Bundle3D::parseGLType(const std::string& str) GLenum Bundle3D::parseGLType(const std::string& str)
{ {
if (str == "GL_FLOAT") if (str == "GL_BYTE")
{ {
return GL_FLOAT; return GL_BYTE;
}
else if(str == "GL_UNSIGNED_BYTE")
{
return GL_UNSIGNED_BYTE;
}
else if(str == "GL_SHORT")
{
return GL_SHORT;
}
else if(str == "GL_UNSIGNED_SHORT")
{
return GL_UNSIGNED_SHORT;
}
else if(str == "GL_INT")
{
return GL_INT;
} }
else if (str == "GL_UNSIGNED_INT") else if (str == "GL_UNSIGNED_INT")
{ {
return GL_UNSIGNED_INT; return GL_UNSIGNED_INT;
} }
else if (str == "GL_FLOAT")
{
return GL_FLOAT;
}
else else
{ {
assert(0); CCASSERT(false, "Wrong GL type");
return 0; return 0;
} }
} }

View File

@ -5,7 +5,7 @@ NS_CC_BEGIN
BundleReader::BundleReader() BundleReader::BundleReader()
{ {
m_buffer = NULL; m_buffer = nullptr;
m_position = 0; m_position = 0;
m_length = 0; m_length = 0;
}; };
@ -65,7 +65,7 @@ char* BundleReader::readLine(int num,char* line)
char* p = line; char* p = line;
char c; char c;
ssize_t readNum = 0; ssize_t readNum = 0;
while((c=*buffer) != 10 && readNum < (ssize_t)num && m_position<(long int)m_length) while((c=*buffer) != 10 && readNum < (ssize_t)num && m_position < m_length)
{ {
*p = c; *p = c;
p++; p++;
@ -91,7 +91,7 @@ ssize_t BundleReader::length()
return m_length; return m_length;
} }
long int BundleReader::tell() ssize_t BundleReader::tell()
{ {
if (!m_buffer) if (!m_buffer)
return -1; return -1;
@ -123,7 +123,7 @@ bool BundleReader::seek(long int offset, int origin)
bool BundleReader::rewind() bool BundleReader::rewind()
{ {
if (m_buffer != NULL) if (m_buffer != nullptr)
{ {
m_position = 0; m_position = 0;
return true; return true;

View File

@ -112,7 +112,7 @@ public:
bool readMatrix(float* m); bool readMatrix(float* m);
private: private:
long int m_position; ssize_t m_position;
ssize_t m_length; ssize_t m_length;
char* m_buffer; char* m_buffer;
}; };
@ -136,6 +136,7 @@ inline bool BundleReader::readArray(unsigned int *length, std::vector<T> *values
{ {
return false; return false;
} }
if (*length > 0 && values) if (*length > 0 && values)
{ {
values->resize(*length); values->resize(*length);

View File

@ -125,7 +125,7 @@ bool RenderMeshData::init(const std::vector<float>& positions,
return true; return true;
} }
bool RenderMeshData::init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount) bool RenderMeshData::init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs)
{ {
_vertexs = vertices; _vertexs = vertices;
_indices = indices; _indices = indices;
@ -174,10 +174,10 @@ Mesh* Mesh::create(const std::vector<float>& positions, const std::vector<float>
return nullptr; return nullptr;
} }
Mesh* Mesh::create(const std::vector<float> &vertices, int vertexSizeInFloat, const std::vector<unsigned short> &indices, int numIndex, const std::vector<MeshVertexAttrib> &attribs, int attribCount) Mesh* Mesh::create(const std::vector<float> &vertices, int vertexSizeInFloat, const std::vector<unsigned short> &indices, const std::vector<MeshVertexAttrib> &attribs)
{ {
auto mesh = new Mesh(); auto mesh = new Mesh();
if (mesh && mesh->init(vertices, vertexSizeInFloat, indices, numIndex, attribs, attribCount)) if (mesh && mesh->init(vertices, vertexSizeInFloat, indices, attribs))
{ {
mesh->autorelease(); mesh->autorelease();
return mesh; return mesh;
@ -192,17 +192,17 @@ bool Mesh::init(const std::vector<float>& positions, const std::vector<float>& n
if (!bRet) if (!bRet)
return false; return false;
restore(); buildBuffer();
return true; return true;
} }
bool Mesh::init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount) bool Mesh::init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs)
{ {
bool bRet = _renderdata.init(vertices, vertexSizeInFloat, indices, numIndex, attribs, attribCount); bool bRet = _renderdata.init(vertices, vertexSizeInFloat, indices, attribs);
if (!bRet) if (!bRet)
return false; return false;
restore(); buildBuffer();
return true; return true;
} }
@ -242,20 +242,20 @@ void Mesh::buildBuffer()
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
unsigned int indexSize = 2; unsigned int indexSize = 2;
IndexFormat indexformat = IndexFormat::INDEX16;
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexSize * _renderdata._indices.size(), &_renderdata._indices[0], GL_STATIC_DRAW); glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexSize * _renderdata._indices.size(), &_renderdata._indices[0], GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
_primitiveType = PrimitiveType::TRIANGLES; _primitiveType = PrimitiveType::TRIANGLES;
_indexFormat = indexformat; _indexFormat = IndexFormat::INDEX16;
_indexCount = _renderdata._indices.size(); _indexCount = _renderdata._indices.size();
} }
void Mesh::restore() void Mesh::restore()
{ {
cleanAndFreeBuffers(); _vertexBuffer = 0;
_indexBuffer = 0;
buildBuffer(); buildBuffer();
} }

View File

@ -49,7 +49,7 @@ public:
} }
bool hasVertexAttrib(int attrib); bool hasVertexAttrib(int attrib);
bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices); bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices);
bool init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount); bool init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs);
protected: protected:
@ -90,7 +90,10 @@ public:
static Mesh* create(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices); static Mesh* create(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices);
/**create mesh with vertex attributes*/ /**create mesh with vertex attributes*/
static Mesh* create(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount); CC_DEPRECATED_ATTRIBUTE static Mesh* create(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount) { return create(vertices, vertexSizeInFloat, indices, attribs); }
/**create mesh with vertex attributes*/
static Mesh* create(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs);
/**get vertex buffer*/ /**get vertex buffer*/
inline GLuint getVertexBuffer() const { return _vertexBuffer; } inline GLuint getVertexBuffer() const { return _vertexBuffer; }
@ -124,7 +127,7 @@ CC_CONSTRUCTOR_ACCESS:
bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices); bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices);
/**init mesh*/ /**init mesh*/
bool init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount); bool init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs);
/**build buffer*/ /**build buffer*/
void buildBuffer(); void buildBuffer();

View File

@ -193,7 +193,7 @@ bool Sprite3D::loadFromC3x(const std::string& path)
return false; return false;
} }
_mesh = Mesh::create(meshdata.vertex, meshdata.vertexSizeInFloat, meshdata.indices, meshdata.numIndex, meshdata.attribs, meshdata.attribCount); _mesh = Mesh::create(meshdata.vertex, meshdata.vertexSizeInFloat, meshdata.indices, meshdata.attribs);
CC_SAFE_RETAIN(_mesh); CC_SAFE_RETAIN(_mesh);
_skin = MeshSkin::create(fullPath, ""); _skin = MeshSkin::create(fullPath, "");
@ -342,7 +342,7 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
_meshCommand.setDepthTestEnabled(true); _meshCommand.setDepthTestEnabled(true);
if (_skin) if (_skin)
{ {
_meshCommand.setMatrixPaletteSize(_skin->getMatrixPaletteSize()); _meshCommand.setMatrixPaletteSize((int)_skin->getMatrixPaletteSize());
_meshCommand.setMatrixPalette(_skin->getMatrixPalette()); _meshCommand.setMatrixPalette(_skin->getMatrixPalette());
} }
//support tint and fade //support tint and fade

View File

@ -222,7 +222,7 @@ static void _log(const char *format, va_list args)
WCHAR wszBuf[MAX_LOG_LENGTH] = {0}; WCHAR wszBuf[MAX_LOG_LENGTH] = {0};
MultiByteToWideChar(CP_UTF8, 0, buf, -1, wszBuf, sizeof(wszBuf)); MultiByteToWideChar(CP_UTF8, 0, buf, -1, wszBuf, sizeof(wszBuf));
OutputDebugStringW(wszBuf); OutputDebugStringW(wszBuf);
WideCharToMultiByte(CP_ACP, 0, wszBuf, -1, buf, sizeof(buf), NULL, FALSE); WideCharToMultiByte(CP_ACP, 0, wszBuf, -1, buf, sizeof(buf), nullptr, FALSE);
printf("%s", buf); printf("%s", buf);
fflush(stdout); fflush(stdout);
#else #else
@ -337,7 +337,7 @@ bool Console::listenOnTCP(int port)
#endif #endif
#endif #endif
if ( (n = getaddrinfo(NULL, serv, &hints, &res)) != 0) { if ( (n = getaddrinfo(nullptr, serv, &hints, &res)) != 0) {
fprintf(stderr,"net_listen error for %s: %s", serv, gai_strerror(n)); fprintf(stderr,"net_listen error for %s: %s", serv, gai_strerror(n));
return false; return false;
} }
@ -359,9 +359,9 @@ bool Console::listenOnTCP(int port)
#else #else
close(listenfd); close(listenfd);
#endif #endif
} while ( (res = res->ai_next) != NULL); } while ( (res = res->ai_next) != nullptr);
if (res == NULL) { if (res == nullptr) {
perror("net_listen:"); perror("net_listen:");
freeaddrinfo(ressave); freeaddrinfo(ressave);
return false; return false;
@ -372,14 +372,14 @@ bool Console::listenOnTCP(int port)
if (res->ai_family == AF_INET) { if (res->ai_family == AF_INET) {
char buf[INET_ADDRSTRLEN] = ""; char buf[INET_ADDRSTRLEN] = "";
struct sockaddr_in *sin = (struct sockaddr_in*) res->ai_addr; struct sockaddr_in *sin = (struct sockaddr_in*) res->ai_addr;
if( inet_ntop(res->ai_family, &sin->sin_addr, buf, sizeof(buf)) != NULL ) if( inet_ntop(res->ai_family, &sin->sin_addr, buf, sizeof(buf)) != nullptr )
cocos2d::log("Console: listening on %s : %d", buf, ntohs(sin->sin_port)); cocos2d::log("Console: listening on %s : %d", buf, ntohs(sin->sin_port));
else else
perror("inet_ntop"); perror("inet_ntop");
} else if (res->ai_family == AF_INET6) { } else if (res->ai_family == AF_INET6) {
char buf[INET6_ADDRSTRLEN] = ""; char buf[INET6_ADDRSTRLEN] = "";
struct sockaddr_in6 *sin = (struct sockaddr_in6*) res->ai_addr; struct sockaddr_in6 *sin = (struct sockaddr_in6*) res->ai_addr;
if( inet_ntop(res->ai_family, &sin->sin6_addr, buf, sizeof(buf)) != NULL ) if( inet_ntop(res->ai_family, &sin->sin6_addr, buf, sizeof(buf)) != nullptr )
cocos2d::log("Console: listening on %s : %d", buf, ntohs(sin->sin6_port)); cocos2d::log("Console: listening on %s : %d", buf, ntohs(sin->sin6_port));
else else
perror("inet_ntop"); perror("inet_ntop");
@ -1042,7 +1042,7 @@ void Console::loop()
copy_set = _read_set; copy_set = _read_set;
timeout_copy = timeout; timeout_copy = timeout;
int nready = select(_maxfd+1, &copy_set, NULL, NULL, &timeout_copy); int nready = select(_maxfd+1, &copy_set, nullptr, nullptr, &timeout_copy);
if( nready == -1 ) if( nready == -1 )
{ {

View File

@ -114,8 +114,6 @@ public:
GCController* _gcController; GCController* _gcController;
}; };
std::vector<Controller*> Controller::s_allController;
void Controller::startDiscoveryController() void Controller::startDiscoveryController()
{ {
[GCController startWirelessControllerDiscoveryWithCompletionHandler: nil]; [GCController startWirelessControllerDiscoveryWithCompletionHandler: nil];

View File

@ -614,7 +614,7 @@ void EventDispatcher::removeEventListener(EventListener* listener)
if (l->getAssociatedNode() != nullptr) if (l->getAssociatedNode() != nullptr)
{ {
dissociateNodeAndEventListener(l->getAssociatedNode(), l); dissociateNodeAndEventListener(l->getAssociatedNode(), l);
l->setAssociatedNode(nullptr); // NULL out the node pointer so we don't have any dangling pointers to destroyed nodes. l->setAssociatedNode(nullptr); // nullptr out the node pointer so we don't have any dangling pointers to destroyed nodes.
} }
if (_inDispatch == 0) if (_inDispatch == 0)
@ -1277,7 +1277,7 @@ void EventDispatcher::removeEventListenersForListenerID(const EventListener::Lis
if (l->getAssociatedNode() != nullptr) if (l->getAssociatedNode() != nullptr)
{ {
dissociateNodeAndEventListener(l->getAssociatedNode(), l); dissociateNodeAndEventListener(l->getAssociatedNode(), l);
l->setAssociatedNode(nullptr); // NULL out the node pointer so we don't have any dangling pointers to destroyed nodes. l->setAssociatedNode(nullptr); // nullptr out the node pointer so we don't have any dangling pointers to destroyed nodes.
} }
if (_inDispatch == 0) if (_inDispatch == 0)

View File

@ -30,7 +30,7 @@ NS_CC_BEGIN
EventMouse::EventMouse(MouseEventType mouseEventCode) EventMouse::EventMouse(MouseEventType mouseEventCode)
: Event(Type::MOUSE) : Event(Type::MOUSE)
, _mouseEventType(mouseEventCode) , _mouseEventType(mouseEventCode)
, _mouseButton(0) , _mouseButton(-1)
, _x(0.0f) , _x(0.0f)
, _y(0.0f) , _y(0.0f)
, _scrollX(0.0f) , _scrollX(0.0f)

View File

@ -65,7 +65,7 @@ Ref::~Ref()
else else
{ {
ScriptEngineProtocol* pEngine = ScriptEngineManager::getInstance()->getScriptEngine(); ScriptEngineProtocol* pEngine = ScriptEngineManager::getInstance()->getScriptEngine();
if (pEngine != NULL && pEngine->getScriptType() == kScriptTypeJavascript) if (pEngine != nullptr && pEngine->getScriptType() == kScriptTypeJavascript)
{ {
pEngine->removeScriptObjectByObject(this); pEngine->removeScriptObjectByObject(this);
} }

View File

@ -181,7 +181,7 @@ void tgaFlipImage( tImageTGA *info )
unsigned char *row = (unsigned char *)malloc(rowbytes); unsigned char *row = (unsigned char *)malloc(rowbytes);
int y; int y;
if (row == NULL) return; if (row == nullptr) return;
for( y = 0; y < (info->height/2); y++ ) for( y = 0; y < (info->height/2); y++ )
{ {
@ -233,7 +233,7 @@ tImageTGA* tgaLoadBuffer(unsigned char* buffer, long size)
info->imageData = (unsigned char *)malloc(sizeof(unsigned char) * total); info->imageData = (unsigned char *)malloc(sizeof(unsigned char) * total);
// check to make sure we have the memory required // check to make sure we have the memory required
if (info->imageData == NULL) if (info->imageData == nullptr)
{ {
info->status = TGA_ERROR_MEMORY; info->status = TGA_ERROR_MEMORY;
break; break;

View File

@ -261,6 +261,10 @@ THE SOFTWARE.
//3d //3d
#include "3d/CCSprite3D.h" #include "3d/CCSprite3D.h"
#include "3d/CCMesh.h" #include "3d/CCMesh.h"
#include "3d/CCMeshSkin.h"
#include "3d/CCAnimate3D.h"
#include "3d/CCAnimation3D.h"
#include "3d/CCSprite3DMaterial.h"
// Audio // Audio
#include "audio/include/SimpleAudioEngine.h" #include "audio/include/SimpleAudioEngine.h"

View File

@ -1020,7 +1020,7 @@ CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLEnableVertexAttribs(unsigned int
CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBindTexture2D(GLuint textureId) { GL::bindTexture2D(textureId); } CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBindTexture2D(GLuint textureId) { GL::bindTexture2D(textureId); }
CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBindTexture2DN(GLuint textureUnit, GLuint textureId) { GL::bindTexture2DN(textureUnit, textureId); } CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBindTexture2DN(GLuint textureUnit, GLuint textureId) { GL::bindTexture2DN(textureUnit, textureId); }
CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLDeleteTexture(GLuint textureId) { GL::deleteTexture(textureId); } CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLDeleteTexture(GLuint textureId) { GL::deleteTexture(textureId); }
CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLDeleteTextureN(GLuint textureUnit, GLuint textureId) { GL::deleteTextureN(textureUnit, textureId); } CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLDeleteTextureN(GLuint textureUnit, GLuint textureId) { GL::deleteTexture(textureId); }
CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBindVAO(GLuint vaoId) { GL::bindVAO(vaoId); } CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBindVAO(GLuint vaoId) { GL::bindVAO(vaoId); }
CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLEnable( int flags ) { /* ignore */ }; CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLEnable( int flags ) { /* ignore */ };
CC_DEPRECATED_ATTRIBUTE typedef int ccGLServerState; CC_DEPRECATED_ATTRIBUTE typedef int ccGLServerState;

View File

@ -97,7 +97,7 @@ unsigned int __Dictionary::count()
__Array* __Dictionary::allKeys() __Array* __Dictionary::allKeys()
{ {
int iKeyCount = this->count(); int iKeyCount = this->count();
if (iKeyCount <= 0) return NULL; if (iKeyCount <= 0) return nullptr;
__Array* array = __Array::createWithCapacity(iKeyCount); __Array* array = __Array::createWithCapacity(iKeyCount);
@ -127,7 +127,7 @@ __Array* __Dictionary::allKeys()
__Array* __Dictionary::allKeysForObject(Ref* object) __Array* __Dictionary::allKeysForObject(Ref* object)
{ {
int iKeyCount = this->count(); int iKeyCount = this->count();
if (iKeyCount <= 0) return NULL; if (iKeyCount <= 0) return nullptr;
__Array* array = __Array::create(); __Array* array = __Array::create();
DictElement *pElement, *tmp; DictElement *pElement, *tmp;
@ -161,16 +161,16 @@ __Array* __Dictionary::allKeysForObject(Ref* object)
Ref* __Dictionary::objectForKey(const std::string& key) Ref* __Dictionary::objectForKey(const std::string& key)
{ {
// if dictionary wasn't initialized, return NULL directly. // if dictionary wasn't initialized, return nullptr directly.
if (_dictType == kDictUnknown) return NULL; if (_dictType == kDictUnknown) return nullptr;
// __Dictionary only supports one kind of key, string or integer. // __Dictionary only supports one kind of key, string or integer.
// This method uses string as key, therefore we should make sure that the key type of this __Dictionary is string. // This method uses string as key, therefore we should make sure that the key type of this __Dictionary is string.
CCASSERT(_dictType == kDictStr, "this dictionary does not use string as key."); CCASSERT(_dictType == kDictStr, "this dictionary does not use string as key.");
Ref* pRetObject = NULL; Ref* pRetObject = nullptr;
DictElement *pElement = NULL; DictElement *pElement = nullptr;
HASH_FIND_STR(_elements, key.c_str(), pElement); HASH_FIND_STR(_elements, key.c_str(), pElement);
if (pElement != NULL) if (pElement != nullptr)
{ {
pRetObject = pElement->_object; pRetObject = pElement->_object;
} }
@ -179,16 +179,16 @@ Ref* __Dictionary::objectForKey(const std::string& key)
Ref* __Dictionary::objectForKey(intptr_t key) Ref* __Dictionary::objectForKey(intptr_t key)
{ {
// if dictionary wasn't initialized, return NULL directly. // if dictionary wasn't initialized, return nullptr directly.
if (_dictType == kDictUnknown) return NULL; if (_dictType == kDictUnknown) return nullptr;
// __Dictionary only supports one kind of key, string or integer. // __Dictionary only supports one kind of key, string or integer.
// This method uses integer as key, therefore we should make sure that the key type of this __Dictionary is integer. // This method uses integer as key, therefore we should make sure that the key type of this __Dictionary is integer.
CCASSERT(_dictType == kDictInt, "this dictionary does not use integer as key."); CCASSERT(_dictType == kDictInt, "this dictionary does not use integer as key.");
Ref* pRetObject = NULL; Ref* pRetObject = nullptr;
DictElement *pElement = NULL; DictElement *pElement = nullptr;
HASH_FIND_PTR(_elements, &key, pElement); HASH_FIND_PTR(_elements, &key, pElement);
if (pElement != NULL) if (pElement != nullptr)
{ {
pRetObject = pElement->_object; pRetObject = pElement->_object;
} }
@ -198,7 +198,7 @@ Ref* __Dictionary::objectForKey(intptr_t key)
const __String* __Dictionary::valueForKey(const std::string& key) const __String* __Dictionary::valueForKey(const std::string& key)
{ {
__String* pStr = dynamic_cast<__String*>(objectForKey(key)); __String* pStr = dynamic_cast<__String*>(objectForKey(key));
if (pStr == NULL) if (pStr == nullptr)
{ {
pStr = __String::create(""); pStr = __String::create("");
} }
@ -208,7 +208,7 @@ const __String* __Dictionary::valueForKey(const std::string& key)
const __String* __Dictionary::valueForKey(intptr_t key) const __String* __Dictionary::valueForKey(intptr_t key)
{ {
__String* pStr = dynamic_cast<__String*>(objectForKey(key)); __String* pStr = dynamic_cast<__String*>(objectForKey(key));
if (pStr == NULL) if (pStr == nullptr)
{ {
pStr = __String::create(""); pStr = __String::create("");
} }
@ -217,7 +217,7 @@ const __String* __Dictionary::valueForKey(intptr_t key)
void __Dictionary::setObject(Ref* pObject, const std::string& key) void __Dictionary::setObject(Ref* pObject, const std::string& key)
{ {
CCASSERT(key.length() > 0 && pObject != NULL, "Invalid Argument!"); CCASSERT(key.length() > 0 && pObject != nullptr, "Invalid Argument!");
if (_dictType == kDictUnknown) if (_dictType == kDictUnknown)
{ {
_dictType = kDictStr; _dictType = kDictStr;
@ -225,9 +225,9 @@ void __Dictionary::setObject(Ref* pObject, const std::string& key)
CCASSERT(_dictType == kDictStr, "this dictionary doesn't use string as key."); CCASSERT(_dictType == kDictStr, "this dictionary doesn't use string as key.");
DictElement *pElement = NULL; DictElement *pElement = nullptr;
HASH_FIND_STR(_elements, key.c_str(), pElement); HASH_FIND_STR(_elements, key.c_str(), pElement);
if (pElement == NULL) if (pElement == nullptr)
{ {
setObjectUnSafe(pObject, key); setObjectUnSafe(pObject, key);
} }
@ -243,7 +243,7 @@ void __Dictionary::setObject(Ref* pObject, const std::string& key)
void __Dictionary::setObject(Ref* pObject, intptr_t key) void __Dictionary::setObject(Ref* pObject, intptr_t key)
{ {
CCASSERT(pObject != NULL, "Invalid Argument!"); CCASSERT(pObject != nullptr, "Invalid Argument!");
if (_dictType == kDictUnknown) if (_dictType == kDictUnknown)
{ {
_dictType = kDictInt; _dictType = kDictInt;
@ -251,9 +251,9 @@ void __Dictionary::setObject(Ref* pObject, intptr_t key)
CCASSERT(_dictType == kDictInt, "this dictionary doesn't use integer as key."); CCASSERT(_dictType == kDictInt, "this dictionary doesn't use integer as key.");
DictElement *pElement = NULL; DictElement *pElement = nullptr;
HASH_FIND_PTR(_elements, &key, pElement); HASH_FIND_PTR(_elements, &key, pElement);
if (pElement == NULL) if (pElement == nullptr)
{ {
setObjectUnSafe(pObject, key); setObjectUnSafe(pObject, key);
} }
@ -277,7 +277,7 @@ void __Dictionary::removeObjectForKey(const std::string& key)
CCASSERT(_dictType == kDictStr, "this dictionary doesn't use string as its key"); CCASSERT(_dictType == kDictStr, "this dictionary doesn't use string as its key");
CCASSERT(key.length() > 0, "Invalid Argument!"); CCASSERT(key.length() > 0, "Invalid Argument!");
DictElement *pElement = NULL; DictElement *pElement = nullptr;
HASH_FIND_STR(_elements, key.c_str(), pElement); HASH_FIND_STR(_elements, key.c_str(), pElement);
removeObjectForElememt(pElement); removeObjectForElememt(pElement);
} }
@ -290,7 +290,7 @@ void __Dictionary::removeObjectForKey(intptr_t key)
} }
CCASSERT(_dictType == kDictInt, "this dictionary doesn't use integer as its key"); CCASSERT(_dictType == kDictInt, "this dictionary doesn't use integer as its key");
DictElement *pElement = NULL; DictElement *pElement = nullptr;
HASH_FIND_PTR(_elements, &key, pElement); HASH_FIND_PTR(_elements, &key, pElement);
removeObjectForElememt(pElement); removeObjectForElememt(pElement);
} }
@ -311,7 +311,7 @@ void __Dictionary::setObjectUnSafe(Ref* pObject, const intptr_t key)
void __Dictionary::removeObjectsForKeys(__Array* pKey__Array) void __Dictionary::removeObjectsForKeys(__Array* pKey__Array)
{ {
Ref* pObj = NULL; Ref* pObj = nullptr;
CCARRAY_FOREACH(pKey__Array, pObj) CCARRAY_FOREACH(pKey__Array, pObj)
{ {
__String* pStr = static_cast<__String*>(pObj); __String* pStr = static_cast<__String*>(pObj);
@ -321,7 +321,7 @@ void __Dictionary::removeObjectsForKeys(__Array* pKey__Array)
void __Dictionary::removeObjectForElememt(DictElement* pElement) void __Dictionary::removeObjectForElememt(DictElement* pElement)
{ {
if (pElement != NULL) if (pElement != nullptr)
{ {
HASH_DEL(_elements, pElement); HASH_DEL(_elements, pElement);
pElement->_object->release(); pElement->_object->release();
@ -345,7 +345,7 @@ Ref* __Dictionary::randomObject()
{ {
if (_dictType == kDictUnknown) if (_dictType == kDictUnknown)
{ {
return NULL; return nullptr;
} }
Ref* key = allKeys()->getRandomObject(); Ref* key = allKeys()->getRandomObject();
@ -360,7 +360,7 @@ Ref* __Dictionary::randomObject()
} }
else else
{ {
return NULL; return nullptr;
} }
} }
@ -566,9 +566,9 @@ __Dictionary* __Dictionary::clone() const
{ {
__Dictionary* newDict = __Dictionary::create(); __Dictionary* newDict = __Dictionary::create();
DictElement* element = NULL; DictElement* element = nullptr;
Ref* tmpObj = NULL; Ref* tmpObj = nullptr;
Clonable* obj = NULL; Clonable* obj = nullptr;
if (_dictType == kDictInt) if (_dictType == kDictInt)
{ {
CCDICT_FOREACH(this, element) CCDICT_FOREACH(this, element)

View File

@ -66,7 +66,7 @@ __Set * __Set::create()
{ {
__Set * pRet = new __Set(); __Set * pRet = new __Set();
if (pRet != NULL) if (pRet != nullptr)
{ {
pRet->autorelease(); pRet->autorelease();
} }

View File

@ -69,7 +69,7 @@ bool __String::initWithFormatAndValist(const char* format, va_list ap)
{ {
bool bRet = false; bool bRet = false;
char* pBuf = (char*)malloc(kMaxStringLen); char* pBuf = (char*)malloc(kMaxStringLen);
if (pBuf != NULL) if (pBuf != nullptr)
{ {
vsnprintf(pBuf, kMaxStringLen, format, ap); vsnprintf(pBuf, kMaxStringLen, format, ap);
_string = pBuf; _string = pBuf;
@ -170,7 +170,7 @@ void __String::appendWithFormat(const char* format, ...)
va_start(ap, format); va_start(ap, format);
char* pBuf = (char*)malloc(kMaxStringLen); char* pBuf = (char*)malloc(kMaxStringLen);
if (pBuf != NULL) if (pBuf != nullptr)
{ {
vsnprintf(pBuf, kMaxStringLen, format, ap); vsnprintf(pBuf, kMaxStringLen, format, ap);
_string.append(pBuf); _string.append(pBuf);
@ -207,7 +207,7 @@ bool __String::isEqual(const Ref* pObject)
{ {
bool bRet = false; bool bRet = false;
const __String* pStr = dynamic_cast<const __String*>(pObject); const __String* pStr = dynamic_cast<const __String*>(pObject);
if (pStr != NULL) if (pStr != nullptr)
{ {
if (0 == _string.compare(pStr->_string)) if (0 == _string.compare(pStr->_string))
{ {
@ -226,11 +226,11 @@ __String* __String::create(const std::string& str)
__String* __String::createWithData(const unsigned char* data, size_t nLen) __String* __String::createWithData(const unsigned char* data, size_t nLen)
{ {
__String* ret = NULL; __String* ret = nullptr;
if (data != NULL) if (data != nullptr)
{ {
char* pStr = (char*)malloc(nLen+1); char* pStr = (char*)malloc(nLen+1);
if (pStr != NULL) if (pStr != nullptr)
{ {
pStr[nLen] = '\0'; pStr[nLen] = '\0';
if (nLen > 0) if (nLen > 0)

View File

@ -86,15 +86,15 @@ void ControlButtonLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, con
void ControlButtonLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) { void ControlButtonLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL) == 0) { if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL) == 0) {
if(pSpriteFrame != NULL) { if(pSpriteFrame != nullptr) {
((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::NORMAL); ((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::NORMAL);
} }
} else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED) == 0) { } else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED) == 0) {
if(pSpriteFrame != NULL) { if(pSpriteFrame != nullptr) {
((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::HIGH_LIGHTED); ((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::HIGH_LIGHTED);
} }
} else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED) == 0) { } else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED) == 0) {
if(pSpriteFrame != NULL) { if(pSpriteFrame != nullptr) {
((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::DISABLED); ((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::DISABLED);
} }
} else { } else {

View File

@ -10,15 +10,15 @@ namespace cocosbuilder {
void MenuItemImageLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) { void MenuItemImageLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_NORMALDISPLAYFRAME) == 0) { if(strcmp(pPropertyName, PROPERTY_NORMALDISPLAYFRAME) == 0) {
if(pSpriteFrame != NULL) { if(pSpriteFrame != nullptr) {
((MenuItemImage *)pNode)->setNormalSpriteFrame(pSpriteFrame); ((MenuItemImage *)pNode)->setNormalSpriteFrame(pSpriteFrame);
} }
} else if(strcmp(pPropertyName, PROPERTY_SELECTEDDISPLAYFRAME) == 0) { } else if(strcmp(pPropertyName, PROPERTY_SELECTEDDISPLAYFRAME) == 0) {
if(pSpriteFrame != NULL) { if(pSpriteFrame != nullptr) {
((MenuItemImage *)pNode)->setSelectedSpriteFrame(pSpriteFrame); ((MenuItemImage *)pNode)->setSelectedSpriteFrame(pSpriteFrame);
} }
} else if(strcmp(pPropertyName, PROPERTY_DISABLEDDISPLAYFRAME) == 0) { } else if(strcmp(pPropertyName, PROPERTY_DISABLEDDISPLAYFRAME) == 0) {
if(pSpriteFrame != NULL) { if(pSpriteFrame != nullptr) {
((MenuItemImage *)pNode)->setDisabledSpriteFrame(pSpriteFrame); ((MenuItemImage *)pNode)->setDisabledSpriteFrame(pSpriteFrame);
} }
} else { } else {

View File

@ -9,7 +9,7 @@ namespace cocosbuilder {
void MenuItemLoader::onHandlePropTypeBlock(Node * pNode, Node * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * ccbReader) { void MenuItemLoader::onHandlePropTypeBlock(Node * pNode, Node * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLOCK) == 0) { if(strcmp(pPropertyName, PROPERTY_BLOCK) == 0) {
if (NULL != pBlockData) // Add this condition to allow MenuItemImage without target/selector predefined if (nullptr != pBlockData) // Add this condition to allow MenuItemImage without target/selector predefined
{ {
((MenuItem *)pNode)->setCallback( std::bind( pBlockData->mSELMenuHandler, pBlockData->_target, std::placeholders::_1) ); ((MenuItem *)pNode)->setCallback( std::bind( pBlockData->mSELMenuHandler, pBlockData->_target, std::placeholders::_1) );
// ((MenuItem *)pNode)->setTarget(pBlockData->_target, pBlockData->mSELMenuHandler); // ((MenuItem *)pNode)->setTarget(pBlockData->_target, pBlockData->mSELMenuHandler);

View File

@ -71,7 +71,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * ccbRe
// #endif // #endif
// Forward properties for sub ccb files // Forward properties for sub ccb files
if (dynamic_cast<CCBFile*>(pNode) != NULL) if (dynamic_cast<CCBFile*>(pNode) != nullptr)
{ {
CCBFile *ccbNode = (CCBFile*)pNode; CCBFile *ccbNode = (CCBFile*)pNode;
if (ccbNode->getCCBFileNode() && isExtraProp) if (ccbNode->getCCBFileNode() && isExtraProp)
@ -80,7 +80,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * ccbRe
// Skip properties that doesn't have a value to override // Skip properties that doesn't have a value to override
__Array *extraPropsNames = (__Array*)pNode->getUserObject(); __Array *extraPropsNames = (__Array*)pNode->getUserObject();
Ref* pObj = NULL; Ref* pObj = nullptr;
bool bFound = false; bool bFound = false;
CCARRAY_FOREACH(extraPropsNames, pObj) CCARRAY_FOREACH(extraPropsNames, pObj)
{ {
@ -346,7 +346,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * ccbRe
case CCBReader::PropertyType::BLOCK_CONTROL: case CCBReader::PropertyType::BLOCK_CONTROL:
{ {
BlockControlData * blockControlData = this->parsePropTypeBlockControl(pNode, pParent, ccbReader); BlockControlData * blockControlData = this->parsePropTypeBlockControl(pNode, pParent, ccbReader);
if(setProp && blockControlData != NULL) { if(setProp && blockControlData != nullptr) {
this->onHandlePropTypeBlockControl(pNode, pParent, propertyName.c_str(), blockControlData, ccbReader); this->onHandlePropTypeBlockControl(pNode, pParent, propertyName.c_str(), blockControlData, ccbReader);
} }
CC_SAFE_DELETE(blockControlData); CC_SAFE_DELETE(blockControlData);
@ -574,14 +574,14 @@ SpriteFrame * NodeLoader::parsePropTypeSpriteFrame(Node * pNode, Node * pParent,
std::string spriteSheet = ccbReader->readCachedString(); std::string spriteSheet = ccbReader->readCachedString();
std::string spriteFile = ccbReader->readCachedString(); std::string spriteFile = ccbReader->readCachedString();
SpriteFrame *spriteFrame = NULL; SpriteFrame *spriteFrame = nullptr;
if (spriteFile.length() != 0) if (spriteFile.length() != 0)
{ {
if (spriteSheet.length() == 0) if (spriteSheet.length() == 0)
{ {
spriteFile = ccbReader->getCCBRootPath() + spriteFile; spriteFile = ccbReader->getCCBRootPath() + spriteFile;
Texture2D * texture = Director::getInstance()->getTextureCache()->addImage(spriteFile.c_str()); Texture2D * texture = Director::getInstance()->getTextureCache()->addImage(spriteFile.c_str());
if(texture != NULL) { if(texture != nullptr) {
Rect bounds = Rect(0, 0, texture->getContentSize().width, texture->getContentSize().height); Rect bounds = Rect(0, 0, texture->getContentSize().width, texture->getContentSize().height);
spriteFrame = SpriteFrame::createWithTexture(texture, bounds); spriteFrame = SpriteFrame::createWithTexture(texture, bounds);
} }
@ -613,7 +613,7 @@ Animation * NodeLoader::parsePropTypeAnimation(Node * pNode, Node * pParent, CCB
std::string animationFile = ccbReader->getCCBRootPath() + ccbReader->readCachedString(); std::string animationFile = ccbReader->getCCBRootPath() + ccbReader->readCachedString();
std::string animation = ccbReader->readCachedString(); std::string animation = ccbReader->readCachedString();
Animation * ccAnimation = NULL; Animation * ccAnimation = nullptr;
// Support for stripping relative file paths, since ios doesn't currently // Support for stripping relative file paths, since ios doesn't currently
// know what to do with them, since its pulling from bundle. // know what to do with them, since its pulling from bundle.
@ -642,7 +642,7 @@ Texture2D * NodeLoader::parsePropTypeTexture(Node * pNode, Node * pParent, CCBRe
} }
else else
{ {
return NULL; return nullptr;
} }
} }
@ -761,7 +761,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead
if(selectorTarget != CCBReader::TargetType::NONE) if(selectorTarget != CCBReader::TargetType::NONE)
{ {
Ref* target = NULL; Ref* target = nullptr;
if(!ccbReader->isJSControlled()) if(!ccbReader->isJSControlled())
{ {
if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT) if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT)
@ -773,7 +773,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead
target = ccbReader->getOwner(); target = ccbReader->getOwner();
} }
if(target != NULL) if(target != nullptr)
{ {
if(selectorName.length() > 0) if(selectorName.length() > 0)
{ {
@ -781,7 +781,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead
CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(target); CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(target);
if(targetAsCCBSelectorResolver != NULL) if(targetAsCCBSelectorResolver != nullptr)
{ {
selMenuHandler = targetAsCCBSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName.c_str()); selMenuHandler = targetAsCCBSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName.c_str());
} }
@ -789,7 +789,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead
if(selMenuHandler == 0) if(selMenuHandler == 0)
{ {
CCBSelectorResolver * ccbSelectorResolver = ccbReader->getCCBSelectorResolver(); CCBSelectorResolver * ccbSelectorResolver = ccbReader->getCCBSelectorResolver();
if(ccbSelectorResolver != NULL) if(ccbSelectorResolver != nullptr)
{ {
selMenuHandler = ccbSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName.c_str()); selMenuHandler = ccbSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName.c_str());
} }
@ -809,7 +809,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead
CCLOG("Unexpected empty selector."); CCLOG("Unexpected empty selector.");
} }
} else { } else {
CCLOG("Unexpected NULL target for selector."); CCLOG("Unexpected nullptr target for selector.");
} }
} }
else else
@ -831,7 +831,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead
} }
} }
return NULL; return nullptr;
} }
BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pParent, CCBReader * ccbReader) BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pParent, CCBReader * ccbReader)
@ -844,7 +844,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP
{ {
if(!ccbReader->isJSControlled()) if(!ccbReader->isJSControlled())
{ {
Ref* target = NULL; Ref* target = nullptr;
if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT) if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT)
{ {
target = ccbReader->getAnimationManager()->getRootNode(); target = ccbReader->getAnimationManager()->getRootNode();
@ -854,7 +854,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP
target = ccbReader->getOwner(); target = ccbReader->getOwner();
} }
if(target != NULL) if(target != nullptr)
{ {
if(selectorName.length() > 0) if(selectorName.length() > 0)
{ {
@ -862,7 +862,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP
CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(target); CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(target);
if(targetAsCCBSelectorResolver != NULL) if(targetAsCCBSelectorResolver != nullptr)
{ {
selControlHandler = targetAsCCBSelectorResolver->onResolveCCBCCControlSelector(target, selectorName.c_str()); selControlHandler = targetAsCCBSelectorResolver->onResolveCCBCCControlSelector(target, selectorName.c_str());
} }
@ -870,7 +870,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP
if(selControlHandler == 0) if(selControlHandler == 0)
{ {
CCBSelectorResolver * ccbSelectorResolver = ccbReader->getCCBSelectorResolver(); CCBSelectorResolver * ccbSelectorResolver = ccbReader->getCCBSelectorResolver();
if(ccbSelectorResolver != NULL) if(ccbSelectorResolver != nullptr)
{ {
selControlHandler = ccbSelectorResolver->onResolveCCBCCControlSelector(target, selectorName.c_str()); selControlHandler = ccbSelectorResolver->onResolveCCBCCControlSelector(target, selectorName.c_str());
} }
@ -894,7 +894,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP
CCLOG("Unexpected empty selector."); CCLOG("Unexpected empty selector.");
} }
} else { } else {
CCLOG("Unexpected NULL target for selector."); CCLOG("Unexpected nullptr target for selector.");
} }
} }
else else
@ -914,7 +914,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP
} }
} }
return NULL; return nullptr;
} }
Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader * pCCBReader) { Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader * pCCBReader) {
@ -960,7 +960,7 @@ Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader
reader->getAnimationManager()->runAnimationsForSequenceIdTweenDuration(reader->getAnimationManager()->getAutoPlaySequenceId(), 0); reader->getAnimationManager()->runAnimationsForSequenceIdTweenDuration(reader->getAnimationManager()->getAutoPlaySequenceId(), 0);
} }
if (reader->isJSControlled() && pCCBReader->isJSControlled() && NULL == reader->_owner) if (reader->isJSControlled() && pCCBReader->isJSControlled() && nullptr == reader->_owner)
{ {
//set variables and callback to owner //set variables and callback to owner
//set callback //set callback

View File

@ -79,10 +79,10 @@ void NodeLoaderLibrary::purge(bool pReleaseNodeLoaders) {
static NodeLoaderLibrary * sSharedNodeLoaderLibrary = NULL; static NodeLoaderLibrary * sSharedNodeLoaderLibrary = nullptr;
NodeLoaderLibrary * NodeLoaderLibrary::getInstance() { NodeLoaderLibrary * NodeLoaderLibrary::getInstance() {
if(sSharedNodeLoaderLibrary == NULL) { if(sSharedNodeLoaderLibrary == nullptr) {
sSharedNodeLoaderLibrary = new NodeLoaderLibrary(); sSharedNodeLoaderLibrary = new NodeLoaderLibrary();
sSharedNodeLoaderLibrary->registerDefaultNodeLoaders(); sSharedNodeLoaderLibrary->registerDefaultNodeLoaders();

View File

@ -12,10 +12,10 @@ namespace cocosbuilder {
void SpriteLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) { void SpriteLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_DISPLAYFRAME) == 0) { if(strcmp(pPropertyName, PROPERTY_DISPLAYFRAME) == 0) {
if(pSpriteFrame != NULL) { if(pSpriteFrame != nullptr) {
((Sprite *)pNode)->setSpriteFrame(pSpriteFrame); ((Sprite *)pNode)->setSpriteFrame(pSpriteFrame);
} else { } else {
CCLOG("ERROR: SpriteFrame NULL"); CCLOG("ERROR: SpriteFrame nullptr");
} }
} else { } else {
NodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, ccbReader); NodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, ccbReader);

View File

@ -278,8 +278,8 @@ void ActionTimeline::emitFrameEvent(Frame* frame)
void ActionTimeline::gotoFrame(int frameIndex) void ActionTimeline::gotoFrame(int frameIndex)
{ {
int size = _timelineList.size(); ssize_t size = _timelineList.size();
for(int i = 0; i<size; i++) for(ssize_t i = 0; i < size; i++)
{ {
_timelineList.at(i)->gotoFrame(frameIndex); _timelineList.at(i)->gotoFrame(frameIndex);
} }
@ -287,8 +287,8 @@ void ActionTimeline::gotoFrame(int frameIndex)
void ActionTimeline::stepToFrame(int frameIndex) void ActionTimeline::stepToFrame(int frameIndex)
{ {
int size = _timelineList.size(); ssize_t size = _timelineList.size();
for(int i = 0; i<size; i++) for(ssize_t i = 0; i < size; i++)
{ {
_timelineList.at(i)->stepToFrame(frameIndex); _timelineList.at(i)->stepToFrame(frameIndex);
} }

View File

@ -68,7 +68,7 @@ VisibleFrame* VisibleFrame::create()
return frame; return frame;
} }
CC_SAFE_DELETE(frame); CC_SAFE_DELETE(frame);
return NULL; return nullptr;
} }
VisibleFrame::VisibleFrame() VisibleFrame::VisibleFrame()
@ -104,7 +104,7 @@ TextureFrame* TextureFrame::create()
return frame; return frame;
} }
CC_SAFE_DELETE(frame); CC_SAFE_DELETE(frame);
return NULL; return nullptr;
} }
TextureFrame::TextureFrame() TextureFrame::TextureFrame()
@ -155,7 +155,7 @@ RotationFrame* RotationFrame::create()
return frame; return frame;
} }
CC_SAFE_DELETE(frame); CC_SAFE_DELETE(frame);
return NULL; return nullptr;
} }
RotationFrame::RotationFrame() RotationFrame::RotationFrame()
@ -204,7 +204,7 @@ SkewFrame* SkewFrame::create()
return frame; return frame;
} }
CC_SAFE_DELETE(frame); CC_SAFE_DELETE(frame);
return NULL; return nullptr;
} }
SkewFrame::SkewFrame() SkewFrame::SkewFrame()
@ -261,7 +261,7 @@ RotationSkewFrame* RotationSkewFrame::create()
return frame; return frame;
} }
CC_SAFE_DELETE(frame); CC_SAFE_DELETE(frame);
return NULL; return nullptr;
} }
RotationSkewFrame::RotationSkewFrame() RotationSkewFrame::RotationSkewFrame()
@ -314,7 +314,7 @@ PositionFrame* PositionFrame::create()
return frame; return frame;
} }
CC_SAFE_DELETE(frame); CC_SAFE_DELETE(frame);
return NULL; return nullptr;
} }
PositionFrame::PositionFrame() PositionFrame::PositionFrame()
@ -366,7 +366,7 @@ ScaleFrame* ScaleFrame::create()
return frame; return frame;
} }
CC_SAFE_DELETE(frame); CC_SAFE_DELETE(frame);
return NULL; return nullptr;
} }
ScaleFrame::ScaleFrame() ScaleFrame::ScaleFrame()
@ -421,7 +421,7 @@ AnchorPointFrame* AnchorPointFrame::create()
return frame; return frame;
} }
CC_SAFE_DELETE(frame); CC_SAFE_DELETE(frame);
return NULL; return nullptr;
} }
AnchorPointFrame::AnchorPointFrame() AnchorPointFrame::AnchorPointFrame()
@ -457,7 +457,7 @@ InnerActionFrame* InnerActionFrame::create()
return frame; return frame;
} }
CC_SAFE_DELETE(frame); CC_SAFE_DELETE(frame);
return NULL; return nullptr;
} }
InnerActionFrame::InnerActionFrame() InnerActionFrame::InnerActionFrame()
@ -493,7 +493,7 @@ ColorFrame* ColorFrame::create()
return frame; return frame;
} }
CC_SAFE_DELETE(frame); CC_SAFE_DELETE(frame);
return NULL; return nullptr;
} }
ColorFrame::ColorFrame() ColorFrame::ColorFrame()
@ -559,7 +559,7 @@ EventFrame* EventFrame::create()
return frame; return frame;
} }
CC_SAFE_DELETE(frame); CC_SAFE_DELETE(frame);
return NULL; return nullptr;
} }
EventFrame::EventFrame() EventFrame::EventFrame()
@ -594,7 +594,7 @@ ZOrderFrame* ZOrderFrame::create()
return frame; return frame;
} }
CC_SAFE_DELETE(frame); CC_SAFE_DELETE(frame);
return NULL; return nullptr;
} }
ZOrderFrame::ZOrderFrame() ZOrderFrame::ZOrderFrame()
@ -605,7 +605,7 @@ ZOrderFrame::ZOrderFrame()
void ZOrderFrame::onEnter(Frame *nextFrame) void ZOrderFrame::onEnter(Frame *nextFrame)
{ {
if(_node) if(_node)
_node->setZOrder(_zorder); _node->setLocalZOrder(_zorder);
} }

View File

@ -284,9 +284,9 @@ void NodeReader::initNode(Node* node, const rapidjson::Value& json)
if (rotation != 0) if (rotation != 0)
node->setRotation(rotation); node->setRotation(rotation);
if(rotationSkewX != 0) if(rotationSkewX != 0)
node->setRotationX(rotationSkewX); node->setRotationSkewX(rotationSkewX);
if(rotationSkewY != 0) if(rotationSkewY != 0)
node->setRotationY(rotationSkewY); node->setRotationSkewY(rotationSkewY);
if(skewx != 0) if(skewx != 0)
node->setSkewX(skewx); node->setSkewX(skewx);
if(skewy != 0) if(skewy != 0)
@ -296,19 +296,17 @@ void NodeReader::initNode(Node* node, const rapidjson::Value& json)
if(width != 0 || height != 0) if(width != 0 || height != 0)
node->setContentSize(Size(width, height)); node->setContentSize(Size(width, height));
if(zorder != 0) if(zorder != 0)
node->setZOrder(zorder); node->setLocalZOrder(zorder);
if(visible != true) if(visible != true)
node->setVisible(visible); node->setVisible(visible);
if(alpha != 255) if(alpha != 255)
{ {
node->setOpacity(alpha); node->setOpacity(alpha);
node->setCascadeOpacityEnabled(true);
} }
if(red != 255 || green != 255 || blue != 255) if(red != 255 || green != 255 || blue != 255)
{ {
node->setColor(Color3B(red, green, blue)); node->setColor(Color3B(red, green, blue));
node->setCascadeColorEnabled(true);
} }

View File

@ -104,7 +104,7 @@ void Timeline::insertFrame(Frame* frame, int index)
void Timeline::removeFrame(Frame* frame) void Timeline::removeFrame(Frame* frame)
{ {
_frames.eraseObject(frame); _frames.eraseObject(frame);
frame->setTimeline(NULL); frame->setTimeline(nullptr);
} }
void Timeline::setNode(Node* node) void Timeline::setNode(Node* node)
@ -131,8 +131,8 @@ void Timeline::apply(int frameIndex)
void Timeline::binarySearchKeyFrame(int frameIndex) void Timeline::binarySearchKeyFrame(int frameIndex)
{ {
Frame *from = NULL; Frame *from = nullptr;
Frame *to = NULL; Frame *to = nullptr;
long length = _frames.size(); long length = _frames.size();
bool needEnterFrame = false; bool needEnterFrame = false;

View File

@ -402,9 +402,9 @@ void Armature::draw(cocos2d::Renderer *renderer, const Mat4 &transform, uint32_t
Skin *skin = static_cast<Skin *>(node); Skin *skin = static_cast<Skin *>(node);
skin->updateTransform(); skin->updateTransform();
bool blendDirty = bone->isBlendDirty(); BlendFunc func = bone->getBlendFunc();
if (blendDirty) if (func.src != _blendFunc.src || func.dst != _blendFunc.dst)
{ {
skin->setBlendFunc(bone->getBlendFunc()); skin->setBlendFunc(bone->getBlendFunc());
} }

View File

@ -1311,7 +1311,7 @@ void DataReaderHelper::addDataFromJsonCache(const std::string& fileContent, Data
length = DICTOOL->getArrayCount_json(json, CONFIG_FILE_PATH); // json[CONFIG_FILE_PATH].IsNull() ? 0 : json[CONFIG_FILE_PATH].Size(); length = DICTOOL->getArrayCount_json(json, CONFIG_FILE_PATH); // json[CONFIG_FILE_PATH].IsNull() ? 0 : json[CONFIG_FILE_PATH].Size();
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
{ {
const char *path = DICTOOL->getStringValueFromArray_json(json, CONFIG_FILE_PATH, i); // json[CONFIG_FILE_PATH][i].IsNull() ? NULL : json[CONFIG_FILE_PATH][i].GetString(); const char *path = DICTOOL->getStringValueFromArray_json(json, CONFIG_FILE_PATH, i); // json[CONFIG_FILE_PATH][i].IsNull() ? nullptr : json[CONFIG_FILE_PATH][i].GetString();
if (path == nullptr) if (path == nullptr)
{ {
CCLOG("load CONFIG_FILE_PATH error."); CCLOG("load CONFIG_FILE_PATH error.");
@ -2426,21 +2426,21 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
} }
else if (key.compare(A_HEIGHT) == 0) else if (key.compare(A_HEIGHT) == 0)
{ {
if(str != NULL) if(str != nullptr)
{ {
textureData->height = atof(str); textureData->height = atof(str);
} }
} }
else if (key.compare(A_PIVOT_X) == 0) else if (key.compare(A_PIVOT_X) == 0)
{ {
if(str != NULL) if(str != nullptr)
{ {
textureData->pivotX = atof(str); textureData->pivotX = atof(str);
} }
} }
else if (key.compare(A_PIVOT_Y) == 0) else if (key.compare(A_PIVOT_Y) == 0)
{ {
if(str != NULL) if(str != nullptr)
{ {
textureData->pivotY = atof(str); textureData->pivotY = atof(str);
} }

View File

@ -351,7 +351,7 @@ Widget* GUIReader::widgetFromBinaryFile(const char *fileName)
const char* fileVersion = ""; const char* fileVersion = "";
ui::Widget* widget = nullptr; ui::Widget* widget = nullptr;
if (pBuffer != NULL && nSize > 0) if (pBuffer != nullptr && nSize > 0)
{ {
CocoLoader tCocoLoader; CocoLoader tCocoLoader;
if(true == tCocoLoader.ReadCocoBinBuff((char*)pBuffer)) if(true == tCocoLoader.ReadCocoBinBuff((char*)pBuffer))
@ -494,7 +494,7 @@ Widget* WidgetPropertiesReader0250::createWidget(const rapidjson::Value& data, c
if (widget->getContentSize().equals(Size::ZERO)) if (widget->getContentSize().equals(Size::ZERO))
{ {
Layout* rootWidget = dynamic_cast<Layout*>(widget); Layout* rootWidget = dynamic_cast<Layout*>(widget);
rootWidget->setSize(Size(fileDesignWidth, fileDesignHeight)); rootWidget->setContentSize(Size(fileDesignWidth, fileDesignHeight));
} }
/* ********************** */ /* ********************** */
@ -608,7 +608,7 @@ void WidgetPropertiesReader0250::setPropsForWidgetFromJsonDictionary(Widget*widg
float w = DICTOOL->getFloatValue_json(options, "width"); float w = DICTOOL->getFloatValue_json(options, "width");
float h = DICTOOL->getFloatValue_json(options, "height"); float h = DICTOOL->getFloatValue_json(options, "height");
widget->setSize(Size(w, h)); widget->setContentSize(Size(w, h));
widget->setTag(DICTOOL->getIntValue_json(options, "tag")); widget->setTag(DICTOOL->getIntValue_json(options, "tag"));
widget->setActionTag(DICTOOL->getIntValue_json(options, "actiontag")); widget->setActionTag(DICTOOL->getIntValue_json(options, "actiontag"));
@ -707,7 +707,7 @@ void WidgetPropertiesReader0250::setPropsForButtonFromJsonDictionary(Widget*widg
{ {
float swf = DICTOOL->getFloatValue_json(options, "scale9Width"); float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
float shf = DICTOOL->getFloatValue_json(options, "scale9Height"); float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
button->setSize(Size(swf, shf)); button->setContentSize(Size(swf, shf));
} }
} }
else else
@ -823,7 +823,7 @@ void WidgetPropertiesReader0250::setPropsForImageViewFromJsonDictionary(Widget*w
{ {
float swf = DICTOOL->getFloatValue_json(options, "scale9Width"); float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
float shf = DICTOOL->getFloatValue_json(options, "scale9Height"); float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
imageView->setSize(Size(swf, shf)); imageView->setContentSize(Size(swf, shf));
} }
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX"); float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
@ -1016,7 +1016,7 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(Widget*widg
{ {
slider->loadBarTexture(imageFileName_tp); slider->loadBarTexture(imageFileName_tp);
} }
slider->setSize(Size(barLength, slider->getContentSize().height)); slider->setContentSize(Size(barLength, slider->getContentSize().height));
} }
else else
{ {
@ -1204,7 +1204,7 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
if (widget->getContentSize().equals(Size::ZERO)) if (widget->getContentSize().equals(Size::ZERO))
{ {
Layout* rootWidget = dynamic_cast<Layout*>(widget); Layout* rootWidget = dynamic_cast<Layout*>(widget);
rootWidget->setSize(Size(fileDesignWidth, fileDesignHeight)); rootWidget->setContentSize(Size(fileDesignWidth, fileDesignHeight));
} }
/* ********************** */ /* ********************** */
@ -1268,7 +1268,7 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
if (widget->getContentSize().equals(Size::ZERO)) if (widget->getContentSize().equals(Size::ZERO))
{ {
Layout* rootWidget = dynamic_cast<Layout*>(widget); Layout* rootWidget = dynamic_cast<Layout*>(widget);
rootWidget->setSize(Size(fileDesignWidth, fileDesignHeight)); rootWidget->setContentSize(Size(fileDesignWidth, fileDesignHeight));
} }
} }
} }
@ -1340,7 +1340,7 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* cocoLoader, st
setPropsForAllWidgetFromBinary(reader, widget, cocoLoader, optionsNode); setPropsForAllWidgetFromBinary(reader, widget, cocoLoader, optionsNode);
// 2nd., custom widget parse with custom reader // 2nd., custom widget parse with custom reader
//2nd. parse custom property //2nd. parse custom property
const char* customProperty = NULL; const char* customProperty = nullptr;
stExpCocoNode *optionChildNode = optionsNode->GetChildArray(cocoLoader); stExpCocoNode *optionChildNode = optionsNode->GetChildArray(cocoLoader);
for (int k = 0; k < optionsNode->GetChildNum(); ++k) { for (int k = 0; k < optionsNode->GetChildNum(); ++k) {
std::string key = optionChildNode[k].GetName(cocoLoader); std::string key = optionChildNode[k].GetName(cocoLoader);

View File

@ -531,7 +531,7 @@ void SceneReader::setPropertyFromJsonDict(CocoLoader *cocoLoader, stExpCocoNode
else if (key == "zorder") else if (key == "zorder")
{ {
nZorder = atoi(value.c_str()); nZorder = atoi(value.c_str());
node->setZOrder(nZorder); node->setLocalZOrder(nZorder);
} }
else if(key == "scalex") else if(key == "scalex")
{ {

View File

@ -92,7 +92,7 @@ Type stExpCocoNode::GetType(CocoLoader* pCoco)
char* stExpCocoNode::GetName(CocoLoader* pCoco) char* stExpCocoNode::GetName(CocoLoader* pCoco)
{ {
char* szName = NULL ; char* szName = nullptr ;
if(m_ObjIndex >= 0) if(m_ObjIndex >= 0)
{ {
stExpCocoObjectDesc* tpCocoObjectDesc = pCoco->GetCocoObjectDescArray(); stExpCocoObjectDesc* tpCocoObjectDesc = pCoco->GetCocoObjectDescArray();
@ -147,9 +147,9 @@ stExpCocoNode* stExpCocoNode::GetChildArray(CocoLoader* pCoco)
CocoLoader::CocoLoader() CocoLoader::CocoLoader()
{ {
m_pRootNode = NULL; m_pRootNode = nullptr;
m_pObjectDescArray = NULL; m_pObjectDescArray = nullptr;
m_pMemoryBuff = NULL; m_pMemoryBuff = nullptr;
} }
CocoLoader::~CocoLoader() CocoLoader::~CocoLoader()
@ -157,7 +157,7 @@ CocoLoader::~CocoLoader()
if(m_pMemoryBuff) if(m_pMemoryBuff)
{ {
delete[] m_pMemoryBuff; delete[] m_pMemoryBuff;
m_pMemoryBuff = NULL; m_pMemoryBuff = nullptr;
} }
} }
@ -176,7 +176,7 @@ bool CocoLoader::ReadCocoBinBuff(char* pBinBuff)
char* pDestBuff = new char[m_pFileHeader->m_nDataSize]; char* pDestBuff = new char[m_pFileHeader->m_nDataSize];
uLongf dwSrcSize = m_pFileHeader->m_nCompressSize; uLongf dwSrcSize = m_pFileHeader->m_nCompressSize;
uLongf dwDestSize = m_pFileHeader->m_nDataSize; uLongf dwDestSize = m_pFileHeader->m_nDataSize;
int nRes = uncompress((Bytef*)pDestBuff,&dwDestSize,(Bytef*)m_pMemoryBuff,dwSrcSize); uncompress((Bytef*)pDestBuff,&dwDestSize,(Bytef*)m_pMemoryBuff,dwSrcSize);
pStartAddr = m_pMemoryBuff = pDestBuff; pStartAddr = m_pMemoryBuff = pDestBuff;
} }
@ -198,7 +198,7 @@ stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(const char* szObjDesc)
return &m_pObjectDescArray[i]; return &m_pObjectDescArray[i];
} }
} }
return NULL; return nullptr;
} }
stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(int vIndex) stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(int vIndex)
@ -207,7 +207,7 @@ stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(int vIndex)
{ {
return &m_pObjectDescArray[vIndex]; return &m_pObjectDescArray[vIndex];
} }
return NULL; return nullptr;
} }
char* CocoLoader::GetMemoryAddr_AttribDesc() char* CocoLoader::GetMemoryAddr_AttribDesc()

View File

@ -115,7 +115,7 @@ void TriggerMng::parse(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCoc
#if CC_ENABLE_SCRIPT_BINDING #if CC_ENABLE_SCRIPT_BINDING
ScriptEngineProtocol* engine = ScriptEngineManager::getInstance()->getScriptEngine(); ScriptEngineProtocol* engine = ScriptEngineManager::getInstance()->getScriptEngine();
bool useBindings = engine != NULL; bool useBindings = engine != nullptr;
if (useBindings) if (useBindings)
{ {
@ -234,7 +234,7 @@ bool TriggerMng::isEmpty(void) const
const char *str2 = pActionArray[i3].GetValue(pCocoLoader); const char *str2 = pActionArray[i3].GetValue(pCocoLoader);
if (key2.compare("classname") == 0) if (key2.compare("classname") == 0)
{ {
if (str2 != NULL) if (str2 != nullptr)
{ {
action.AddMember("classname", str2, allocator); action.AddMember("classname", str2, allocator);
} }
@ -255,7 +255,7 @@ bool TriggerMng::isEmpty(void) const
const char *str3 = pDataItemArray[i5].GetValue(pCocoLoader); const char *str3 = pDataItemArray[i5].GetValue(pCocoLoader);
if (key3.compare("key") == 0) if (key3.compare("key") == 0)
{ {
if (str3 != NULL) if (str3 != nullptr)
{ {
dataitem.AddMember("key", str3, allocator); dataitem.AddMember("key", str3, allocator);
} }
@ -310,7 +310,7 @@ bool TriggerMng::isEmpty(void) const
const char *str4 = pConditionArray[i7].GetValue(pCocoLoader); const char *str4 = pConditionArray[i7].GetValue(pCocoLoader);
if (key4.compare("classname") == 0) if (key4.compare("classname") == 0)
{ {
if (str4 != NULL) if (str4 != nullptr)
{ {
cond.AddMember("classname", str4, allocator); cond.AddMember("classname", str4, allocator);
} }
@ -331,7 +331,7 @@ bool TriggerMng::isEmpty(void) const
const char *str5 = pDataItemArray[i9].GetValue(pCocoLoader); const char *str5 = pDataItemArray[i9].GetValue(pCocoLoader);
if (key5.compare("key") == 0) if (key5.compare("key") == 0)
{ {
if (str5 != NULL) if (str5 != nullptr)
{ {
dataitem.AddMember("key", str5, allocator); dataitem.AddMember("key", str5, allocator);
} }
@ -380,7 +380,7 @@ bool TriggerMng::isEmpty(void) const
stExpCocoNode *pEventArray = pEventsArray->GetChildArray(pCocoLoader); stExpCocoNode *pEventArray = pEventsArray->GetChildArray(pCocoLoader);
std::string key6 = pEventArray[0].GetName(pCocoLoader); std::string key6 = pEventArray[0].GetName(pCocoLoader);
const char *str6 = pEventArray[0].GetValue(pCocoLoader); const char *str6 = pEventArray[0].GetValue(pCocoLoader);
if (key6.compare("id") == 0 && str6 != NULL) if (key6.compare("id") == 0 && str6 != nullptr)
{ {
event.AddMember("id", atoi(str6), allocator); event.AddMember("id", atoi(str6), allocator);
eventsItem.PushBack(event, allocator); eventsItem.PushBack(event, allocator);
@ -390,7 +390,7 @@ bool TriggerMng::isEmpty(void) const
} }
else if (key1.compare("id") == 0) else if (key1.compare("id") == 0)
{ {
if (str1 != NULL) if (str1 != nullptr)
{ {
vElemItem.AddMember("id", atoi(str1), allocator); vElemItem.AddMember("id", atoi(str1), allocator);
} }

View File

@ -253,7 +253,7 @@ void TriggerObj::serialize(const rapidjson::Value &val)
const char* str0 = pTriggerObjArray[i0].GetValue(pCocoLoader); const char* str0 = pTriggerObjArray[i0].GetValue(pCocoLoader);
if (key.compare("id") == 0) if (key.compare("id") == 0)
{ {
if (str0 != NULL) if (str0 != nullptr)
{ {
_id = atoi(str0); //(unsigned int)(DICTOOL->getIntValue_json(val, "id")); _id = atoi(str0); //(unsigned int)(DICTOOL->getIntValue_json(val, "id"));
} }
@ -292,7 +292,7 @@ void TriggerObj::serialize(const rapidjson::Value &val)
continue; continue;
} }
BaseTriggerAction *act = dynamic_cast<BaseTriggerAction*>(ObjectFactory::getInstance()->createObject(classname)); BaseTriggerAction *act = dynamic_cast<BaseTriggerAction*>(ObjectFactory::getInstance()->createObject(classname));
CCAssert(act != NULL, "class named classname can not implement!"); CCAssert(act != nullptr, "class named classname can not implement!");
act->serialize(pCocoLoader, &pActionArray[1]); act->serialize(pCocoLoader, &pActionArray[1]);
act->init(); act->init();
_acts.pushBack(act); _acts.pushBack(act);

View File

@ -152,7 +152,7 @@ namespace cocostudio
if (button->isScale9Enabled()) { if (button->isScale9Enabled()) {
button->setCapInsets(Rect(capsx, capsy, capsWidth, capsHeight)); button->setCapInsets(Rect(capsx, capsy, capsWidth, capsHeight));
button->setSize(Size(scale9Width, scale9Height)); button->setContentSize(Size(scale9Width, scale9Height));
} }
button->setTitleColor(Color3B(cri, cgi, cbi)); button->setTitleColor(Color3B(cri, cgi, cbi));
@ -203,7 +203,7 @@ namespace cocostudio
{ {
float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width); float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width);
float shf = DICTOOL->getFloatValue_json(options, P_Scale9Height); float shf = DICTOOL->getFloatValue_json(options, P_Scale9Height);
button->setSize(Size(swf, shf)); button->setContentSize(Size(swf, shf));
} }
} }
bool tt = DICTOOL->checkObjectExist_json(options, P_Text); bool tt = DICTOOL->checkObjectExist_json(options, P_Text);

View File

@ -15,7 +15,7 @@ namespace cocostudio
static const char* P_BackGroundBoxDisabledData = "backGroundBoxDisabledData"; static const char* P_BackGroundBoxDisabledData = "backGroundBoxDisabledData";
static const char* P_FrontCrossDisabledData = "frontCrossDisabledData"; static const char* P_FrontCrossDisabledData = "frontCrossDisabledData";
static CheckBoxReader* instanceCheckBoxReader = NULL; static CheckBoxReader* instanceCheckBoxReader = nullptr;
IMPLEMENT_CLASS_WIDGET_READER_INFO(CheckBoxReader) IMPLEMENT_CLASS_WIDGET_READER_INFO(CheckBoxReader)

View File

@ -19,7 +19,7 @@ namespace cocostudio
static const char* P_Scale9Height = "scale9Height"; static const char* P_Scale9Height = "scale9Height";
static ImageViewReader* instanceImageViewReader = NULL; static ImageViewReader* instanceImageViewReader = nullptr;
IMPLEMENT_CLASS_WIDGET_READER_INFO(ImageViewReader) IMPLEMENT_CLASS_WIDGET_READER_INFO(ImageViewReader)
@ -128,7 +128,7 @@ namespace cocostudio
float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width,80.0f); float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width,80.0f);
float shf = DICTOOL->getFloatValue_json(options, P_Scale9Height,80.0f); float shf = DICTOOL->getFloatValue_json(options, P_Scale9Height,80.0f);
imageView->setSize(Size(swf, shf)); imageView->setContentSize(Size(swf, shf));
float cx = DICTOOL->getFloatValue_json(options, P_CapInsetsX); float cx = DICTOOL->getFloatValue_json(options, P_CapInsetsX);

View File

@ -34,7 +34,7 @@ namespace cocostudio
static const char* P_BackGroundImageData = "backGroundImageData"; static const char* P_BackGroundImageData = "backGroundImageData";
static const char* P_LayoutType = "layoutType"; static const char* P_LayoutType = "layoutType";
static LayoutReader* instanceLayoutReader = NULL; static LayoutReader* instanceLayoutReader = nullptr;
IMPLEMENT_CLASS_WIDGET_READER_INFO(LayoutReader) IMPLEMENT_CLASS_WIDGET_READER_INFO(LayoutReader)

View File

@ -12,7 +12,7 @@ namespace cocostudio
static const char* P_Direction = "direction"; static const char* P_Direction = "direction";
static const char* P_ItemMargin = "itemMargin"; static const char* P_ItemMargin = "itemMargin";
static ListViewReader* instanceListViewReader = NULL; static ListViewReader* instanceListViewReader = nullptr;
IMPLEMENT_CLASS_WIDGET_READER_INFO(ListViewReader) IMPLEMENT_CLASS_WIDGET_READER_INFO(ListViewReader)

View File

@ -19,7 +19,7 @@ namespace cocostudio
static const char* P_Direction = "direction"; static const char* P_Direction = "direction";
static const char* P_Percent = "percent"; static const char* P_Percent = "percent";
static LoadingBarReader* instanceLoadingBar = NULL; static LoadingBarReader* instanceLoadingBar = nullptr;
IMPLEMENT_CLASS_WIDGET_READER_INFO(LoadingBarReader) IMPLEMENT_CLASS_WIDGET_READER_INFO(LoadingBarReader)
@ -130,7 +130,7 @@ namespace cocostudio
float width = DICTOOL->getFloatValue_json(options, P_Width); float width = DICTOOL->getFloatValue_json(options, P_Width);
float height = DICTOOL->getFloatValue_json(options, P_Height); float height = DICTOOL->getFloatValue_json(options, P_Height);
loadingBar->setSize(Size(width, height)); loadingBar->setContentSize(Size(width, height));
/**/ /**/

View File

@ -18,9 +18,7 @@ namespace cocostudio
static const char* P_BallDisabledData = "ballDisabledData"; static const char* P_BallDisabledData = "ballDisabledData";
static const char* P_ProgressBarData = "progressBarData"; static const char* P_ProgressBarData = "progressBarData";
static const char* P_BarFileName = "barFileName"; static SliderReader* instanceSliderReader = nullptr;
static SliderReader* instanceSliderReader = NULL;
IMPLEMENT_CLASS_WIDGET_READER_INFO(SliderReader) IMPLEMENT_CLASS_WIDGET_READER_INFO(SliderReader)
@ -125,7 +123,7 @@ namespace cocostudio
} //end of for loop } //end of for loop
if (slider->isScale9Enabled()) { if (slider->isScale9Enabled()) {
slider->setSize(Size(barLength, slider->getContentSize().height)); slider->setContentSize(Size(barLength, slider->getContentSize().height));
} }
slider->setPercent(percent); slider->setPercent(percent);

View File

@ -15,10 +15,7 @@ namespace cocostudio
static const char* P_ItemHeight = "itemHeight"; static const char* P_ItemHeight = "itemHeight";
static const char* P_StartCharMap = "startCharMap"; static const char* P_StartCharMap = "startCharMap";
static TextAtlasReader* instanceTextAtalsReader = nullptr;
static const char* P_CharMapFile = "charMapFile";
static TextAtlasReader* instanceTextAtalsReader = NULL;
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextAtlasReader) IMPLEMENT_CLASS_WIDGET_READER_INFO(TextAtlasReader)

View File

@ -12,7 +12,7 @@ namespace cocostudio
static const char* P_FileNameData = "fileNameData"; static const char* P_FileNameData = "fileNameData";
static const char* P_Text = "text"; static const char* P_Text = "text";
static TextBMFontReader* instanceTextBMFontReader = NULL; static TextBMFontReader* instanceTextBMFontReader = nullptr;
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextBMFontReader) IMPLEMENT_CLASS_WIDGET_READER_INFO(TextBMFontReader)

View File

@ -9,7 +9,7 @@ using namespace ui;
namespace cocostudio namespace cocostudio
{ {
static TextFieldReader* instanceTextFieldReader = NULL; static TextFieldReader* instanceTextFieldReader = nullptr;
static const char* P_PlaceHolder = "placeHolder"; static const char* P_PlaceHolder = "placeHolder";
static const char* P_Text = "text"; static const char* P_Text = "text";

View File

@ -18,7 +18,7 @@ namespace cocostudio
static const char* P_HAlignment = "hAlignment"; static const char* P_HAlignment = "hAlignment";
static const char* P_VAlignment = "vAlignment"; static const char* P_VAlignment = "vAlignment";
static TextReader* instanceTextReader = NULL; static TextReader* instanceTextReader = nullptr;
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextReader) IMPLEMENT_CLASS_WIDGET_READER_INFO(TextReader)

View File

@ -59,7 +59,7 @@ namespace cocostudio
const char* P_Path = "path"; const char* P_Path = "path";
static WidgetReader* instanceWidgetReader = NULL; static WidgetReader* instanceWidgetReader = nullptr;
IMPLEMENT_CLASS_WIDGET_READER_INFO(WidgetReader) IMPLEMENT_CLASS_WIDGET_READER_INFO(WidgetReader)
@ -139,7 +139,7 @@ namespace cocostudio
w = DICTOOL->getFloatValue_json(options, P_Width); w = DICTOOL->getFloatValue_json(options, P_Width);
h = DICTOOL->getFloatValue_json(options, P_Height); h = DICTOOL->getFloatValue_json(options, P_Height);
} }
widget->setSize(Size(w, h)); widget->setContentSize(Size(w, h));
widget->setTag(DICTOOL->getIntValue_json(options, P_Tag)); widget->setTag(DICTOOL->getIntValue_json(options, P_Tag));
widget->setActionTag(DICTOOL->getIntValue_json(options, P_ActionTag)); widget->setActionTag(DICTOOL->getIntValue_json(options, P_ActionTag));
@ -259,7 +259,7 @@ namespace cocostudio
widget->setOpacity(_opacity); widget->setOpacity(_opacity);
//the setSize method will be conflict with scale9Width & scale9Height //the setSize method will be conflict with scale9Width & scale9Height
if (!widget->isIgnoreContentAdaptWithSize()) { if (!widget->isIgnoreContentAdaptWithSize()) {
widget->setSize(Size(_width, _height)); widget->setContentSize(Size(_width, _height));
} }
widget->setPosition(_position); widget->setPosition(_position);
widget->setAnchorPoint(_originalAnchorPoint); widget->setAnchorPoint(_originalAnchorPoint);

View File

@ -174,7 +174,7 @@ namespace cocostudio
}else if(key == P_Visbile){ \ }else if(key == P_Visbile){ \
widget->setVisible(valueToBool(value)); \ widget->setVisible(valueToBool(value)); \
}else if(key == P_ZOrder){ \ }else if(key == P_ZOrder){ \
widget->setZOrder(valueToInt(value)); \ widget->setLocalZOrder(valueToInt(value)); \
}else if(key == P_LayoutParameter){ \ }else if(key == P_LayoutParameter){ \
stExpCocoNode *layoutCocosNode = stChildArray[i].GetChildArray(cocoLoader); \ stExpCocoNode *layoutCocosNode = stChildArray[i].GetChildArray(cocoLoader); \
ui::LinearLayoutParameter *linearParameter = ui::LinearLayoutParameter::create(); \ ui::LinearLayoutParameter *linearParameter = ui::LinearLayoutParameter::create(); \

View File

@ -156,7 +156,7 @@ void Mat4::createOrthographicOffCenter(float left, float right, float bottom, fl
void Mat4::createBillboard(const Vec3& objectPosition, const Vec3& cameraPosition, void Mat4::createBillboard(const Vec3& objectPosition, const Vec3& cameraPosition,
const Vec3& cameraUpVector, Mat4* dst) const Vec3& cameraUpVector, Mat4* dst)
{ {
createBillboardHelper(objectPosition, cameraPosition, cameraUpVector, NULL, dst); createBillboardHelper(objectPosition, cameraPosition, cameraUpVector, nullptr, dst);
} }
void Mat4::createBillboard(const Vec3& objectPosition, const Vec3& cameraPosition, void Mat4::createBillboard(const Vec3& objectPosition, const Vec3& cameraPosition,
@ -441,7 +441,7 @@ bool Mat4::decompose(Vec3* scale, Quaternion* rotation, Vec3* translation) const
} }
// Nothing left to do. // Nothing left to do.
if (scale == NULL && rotation == NULL) if (scale == nullptr && rotation == nullptr)
return true; return true;
// Extract the scale. // Extract the scale.
@ -469,7 +469,7 @@ bool Mat4::decompose(Vec3* scale, Quaternion* rotation, Vec3* translation) const
} }
// Nothing left to do. // Nothing left to do.
if (rotation == NULL) if (rotation == nullptr)
return true; return true;
// Scale too close to zero, can't decompose rotation. // Scale too close to zero, can't decompose rotation.
@ -559,17 +559,17 @@ float Mat4::determinant() const
void Mat4::getScale(Vec3* scale) const void Mat4::getScale(Vec3* scale) const
{ {
decompose(scale, NULL, NULL); decompose(scale, nullptr, nullptr);
} }
bool Mat4::getRotation(Quaternion* rotation) const bool Mat4::getRotation(Quaternion* rotation) const
{ {
return decompose(NULL, rotation, NULL); return decompose(nullptr, rotation, nullptr);
} }
void Mat4::getTranslation(Vec3* translation) const void Mat4::getTranslation(Vec3* translation) const
{ {
decompose(NULL, NULL, translation); decompose(nullptr, nullptr, translation);
} }
void Mat4::getUpVector(Vec3* dst) const void Mat4::getUpVector(Vec3* dst) const

View File

@ -401,9 +401,9 @@ void SIOClientImpl::onMessage(WebSocket* ws, const WebSocket::Data& data)
s_data = payload; s_data = payload;
SIOClient *c = NULL; SIOClient *c = nullptr;
c = getClient(endpoint); c = getClient(endpoint);
if (c == NULL) log("SIOClientImpl::onMessage client lookup returned NULL"); if (c == nullptr) log("SIOClientImpl::onMessage client lookup returned nullptr");
switch(control) switch(control)
{ {
@ -671,7 +671,7 @@ SIOClient* SocketIO::connect(const std::string& uri, SocketIO::SIODelegate& dele
//check if already connected to endpoint, handle //check if already connected to endpoint, handle
c = socket->getClient(path); c = socket->getClient(path);
if(c == NULL) if(c == nullptr)
{ {
c = new SIOClient(host, port, path, socket, delegate); c = new SIOClient(host, port, path, socket, delegate);

View File

@ -445,7 +445,7 @@ void WebSocket::onSubThreadStarted()
_path.c_str(), _host.c_str(), _host.c_str(), _path.c_str(), _host.c_str(), _host.c_str(),
name.c_str(), -1); name.c_str(), -1);
if(NULL == _wsInstance) { if(nullptr == _wsInstance) {
WsMessage* msg = new WsMessage(); WsMessage* msg = new WsMessage();
msg->what = WS_MSG_TO_UITHREAD_ERROR; msg->what = WS_MSG_TO_UITHREAD_ERROR;
_readyState = State::CLOSING; _readyState = State::CLOSING;

View File

@ -565,19 +565,21 @@ void GLView::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int
} }
} }
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here
float cursorX = (_mouseX - _viewPortRect.origin.x) / _scaleX;
float cursorY = (_viewPortRect.origin.y + _viewPortRect.size.height - _mouseY) / _scaleY;
if(GLFW_PRESS == action) if(GLFW_PRESS == action)
{ {
EventMouse event(EventMouse::MouseEventType::MOUSE_DOWN); EventMouse event(EventMouse::MouseEventType::MOUSE_DOWN);
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here event.setCursorPosition(cursorX, cursorY);
event.setCursorPosition(_mouseX, this->getViewPortRect().size.height - _mouseY);
event.setMouseButton(button); event.setMouseButton(button);
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
} }
else if(GLFW_RELEASE == action) else if(GLFW_RELEASE == action)
{ {
EventMouse event(EventMouse::MouseEventType::MOUSE_UP); EventMouse event(EventMouse::MouseEventType::MOUSE_UP);
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here event.setCursorPosition(cursorX, cursorY);
event.setCursorPosition(_mouseX, this->getViewPortRect().size.height - _mouseY);
event.setMouseButton(button); event.setMouseButton(button);
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
} }
@ -606,9 +608,25 @@ void GLView::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y)
this->handleTouchesMove(1, &id, &_mouseX, &_mouseY); this->handleTouchesMove(1, &id, &_mouseX, &_mouseY);
} }
EventMouse event(EventMouse::MouseEventType::MOUSE_MOVE);
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here //Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here
event.setCursorPosition(_mouseX, this->getViewPortRect().size.height - _mouseY); float cursorX = (_mouseX - _viewPortRect.origin.x) / _scaleX;
float cursorY = (_viewPortRect.origin.y + _viewPortRect.size.height - _mouseY) / _scaleY;
EventMouse event(EventMouse::MouseEventType::MOUSE_MOVE);
// Set current button
if (glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS)
{
event.setMouseButton(GLFW_MOUSE_BUTTON_LEFT);
}
else if (glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS)
{
event.setMouseButton(GLFW_MOUSE_BUTTON_RIGHT);
}
else if (glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_MIDDLE) == GLFW_PRESS)
{
event.setMouseButton(GLFW_MOUSE_BUTTON_MIDDLE);
}
event.setCursorPosition(cursorX, cursorY);
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
} }
@ -685,9 +703,9 @@ static bool glew_dynamic_binding()
const char *gl_extensions = (const char*)glGetString(GL_EXTENSIONS); const char *gl_extensions = (const char*)glGetString(GL_EXTENSIONS);
// If the current opengl driver doesn't have framebuffers methods, check if an extension exists // If the current opengl driver doesn't have framebuffers methods, check if an extension exists
if (glGenFramebuffers == NULL) if (glGenFramebuffers == nullptr)
{ {
log("OpenGL: glGenFramebuffers is NULL, try to detect an extension"); log("OpenGL: glGenFramebuffers is nullptr, try to detect an extension");
if (strstr(gl_extensions, "ARB_framebuffer_object")) if (strstr(gl_extensions, "ARB_framebuffer_object"))
{ {
log("OpenGL: ARB_framebuffer_object is supported"); log("OpenGL: ARB_framebuffer_object is supported");

View File

@ -393,7 +393,6 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
if (isKeyboardShown_) if (isKeyboardShown_)
{ {
[self handleTouchesAfterKeyboardShow]; [self handleTouchesAfterKeyboardShow];
return;
} }
UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0}; UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0};
@ -414,10 +413,6 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{ {
if (isKeyboardShown_)
{
return;
}
UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0}; UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0};
float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f}; float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};
float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f}; float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};
@ -436,11 +431,6 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{ {
if (isKeyboardShown_)
{
return;
}
UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0}; UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0};
float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f}; float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};
float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f}; float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};
@ -459,11 +449,6 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{ {
if (isKeyboardShown_)
{
return;
}
UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0}; UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0};
float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f}; float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};
float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f}; float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};

View File

@ -55,7 +55,7 @@ Application::Application()
Application::~Application() Application::~Application()
{ {
CC_ASSERT(this == sm_pSharedApplication); CC_ASSERT(this == sm_pSharedApplication);
sm_pSharedApplication = NULL; sm_pSharedApplication = nullptr;
} }
int Application::run() int Application::run()
@ -248,7 +248,7 @@ static void PVRFrameEnableControlWindow(bool bEnable)
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
0, 0,
&hKey, &hKey,
NULL)) nullptr))
{ {
return; return;
} }
@ -257,7 +257,7 @@ static void PVRFrameEnableControlWindow(bool bEnable)
const WCHAR* wszNewData = (bEnable) ? L"NO" : L"YES"; const WCHAR* wszNewData = (bEnable) ? L"NO" : L"YES";
WCHAR wszOldData[256] = {0}; WCHAR wszOldData[256] = {0};
DWORD dwSize = sizeof(wszOldData); DWORD dwSize = sizeof(wszOldData);
LSTATUS status = RegQueryValueExW(hKey, wszValue, 0, NULL, (LPBYTE)wszOldData, &dwSize); LSTATUS status = RegQueryValueExW(hKey, wszValue, 0, nullptr, (LPBYTE)wszOldData, &dwSize);
if (ERROR_FILE_NOT_FOUND == status // the key not exist if (ERROR_FILE_NOT_FOUND == status // the key not exist
|| (ERROR_SUCCESS == status // or the hide_gui value is exist || (ERROR_SUCCESS == status // or the hide_gui value is exist
&& 0 != wcscmp(wszNewData, wszOldData))) // but new data and old data not equal && 0 != wcscmp(wszNewData, wszOldData))) // but new data and old data not equal

View File

@ -35,12 +35,12 @@ NS_CC_BEGIN
void MessageBox(const char * pszMsg, const char * pszTitle) void MessageBox(const char * pszMsg, const char * pszTitle)
{ {
MessageBoxA(NULL, pszMsg, pszTitle, MB_OK); MessageBoxA(nullptr, pszMsg, pszTitle, MB_OK);
} }
void LuaLog(const char *pszMsg) void LuaLog(const char *pszMsg)
{ {
int bufflen = MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, NULL, 0); int bufflen = MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, nullptr, 0);
WCHAR* widebuff = new WCHAR[bufflen + 1]; WCHAR* widebuff = new WCHAR[bufflen + 1];
memset(widebuff, 0, sizeof(WCHAR) * (bufflen + 1)); memset(widebuff, 0, sizeof(WCHAR) * (bufflen + 1));
MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, widebuff, bufflen); MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, widebuff, bufflen);
@ -48,10 +48,10 @@ void LuaLog(const char *pszMsg)
OutputDebugStringW(widebuff); OutputDebugStringW(widebuff);
OutputDebugStringA("\n"); OutputDebugStringA("\n");
bufflen = WideCharToMultiByte(CP_ACP, 0, widebuff, -1, NULL, 0, NULL, NULL); bufflen = WideCharToMultiByte(CP_ACP, 0, widebuff, -1, nullptr, 0, nullptr, nullptr);
char* buff = new char[bufflen + 1]; char* buff = new char[bufflen + 1];
memset(buff, 0, sizeof(char) * (bufflen + 1)); memset(buff, 0, sizeof(char) * (bufflen + 1));
WideCharToMultiByte(CP_ACP, 0, widebuff, -1, buff, bufflen, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, widebuff, -1, buff, bufflen, nullptr, nullptr);
puts(buff); puts(buff);
delete[] widebuff; delete[] widebuff;

View File

@ -37,10 +37,10 @@ int Device::getDPI()
static int dpi = -1; static int dpi = -1;
if (dpi == -1) if (dpi == -1)
{ {
HDC hScreenDC = GetDC( NULL ); HDC hScreenDC = GetDC( nullptr );
int PixelsX = GetDeviceCaps( hScreenDC, HORZRES ); int PixelsX = GetDeviceCaps( hScreenDC, HORZRES );
int MMX = GetDeviceCaps( hScreenDC, HORZSIZE ); int MMX = GetDeviceCaps( hScreenDC, HORZSIZE );
ReleaseDC( NULL, hScreenDC ); ReleaseDC( nullptr, hScreenDC );
dpi = 254.0f*PixelsX/MMX/10; dpi = 254.0f*PixelsX/MMX/10;
} }
return dpi; return dpi;
@ -55,7 +55,7 @@ void Device::setAccelerometerInterval(float interval)
class BitmapDC class BitmapDC
{ {
public: public:
BitmapDC(HWND hWnd = NULL) BitmapDC(HWND hWnd = nullptr)
: _DC(nullptr) : _DC(nullptr)
, _bmp(nullptr) , _bmp(nullptr)
, _font((HFONT)GetStockObject(DEFAULT_GUI_FONT)) , _font((HFONT)GetStockObject(DEFAULT_GUI_FONT))
@ -79,7 +79,7 @@ public:
wchar_t * utf8ToUtf16(const std::string& str) wchar_t * utf8ToUtf16(const std::string& str)
{ {
wchar_t * pwszBuffer = NULL; wchar_t * pwszBuffer = nullptr;
do do
{ {
if (str.empty()) if (str.empty())
@ -99,7 +99,7 @@ public:
} }
bool setFont(const char * pFontName = NULL, int nSize = 0) bool setFont(const char * pFontName = nullptr, int nSize = 0)
{ {
bool bRet = false; bool bRet = false;
do do
@ -154,7 +154,7 @@ public:
SendMessage( _wnd, WM_FONTCHANGE, 0, 0); SendMessage( _wnd, WM_FONTCHANGE, 0, 0);
} }
delete [] pwszBuffer; delete [] pwszBuffer;
pwszBuffer = NULL; pwszBuffer = nullptr;
} }
} }
@ -214,11 +214,11 @@ public:
if (_bmp) if (_bmp)
{ {
DeleteObject(_bmp); DeleteObject(_bmp);
_bmp = NULL; _bmp = nullptr;
} }
if (nWidth > 0 && nHeight > 0) if (nWidth > 0 && nHeight > 0)
{ {
_bmp = CreateBitmap(nWidth, nHeight, 1, 32, NULL); _bmp = CreateBitmap(nWidth, nHeight, 1, 32, nullptr);
if (! _bmp) if (! _bmp)
{ {
return false; return false;
@ -364,7 +364,7 @@ private:
RemoveFontResource(pwszBuffer); RemoveFontResource(pwszBuffer);
SendMessage( _wnd, WM_FONTCHANGE, 0, 0); SendMessage( _wnd, WM_FONTCHANGE, 0, 0);
delete [] pwszBuffer; delete [] pwszBuffer;
pwszBuffer = NULL; pwszBuffer = nullptr;
} }
_curFontPath.clear(); _curFontPath.clear();
} }
@ -404,7 +404,7 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
} bi = {0}; } bi = {0};
bi.bmiHeader.biSize = sizeof(bi.bmiHeader); bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
CC_BREAK_IF(! GetDIBits(dc.getDC(), dc.getBitmap(), 0, 0, CC_BREAK_IF(! GetDIBits(dc.getDC(), dc.getBitmap(), 0, 0,
NULL, (LPBITMAPINFO)&bi, DIB_RGB_COLORS)); nullptr, (LPBITMAPINFO)&bi, DIB_RGB_COLORS));
width = (short)size.cx; width = (short)size.cx;
height = (short)size.cy; height = (short)size.cy;
@ -416,7 +416,7 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
(LPBITMAPINFO)&bi, DIB_RGB_COLORS); (LPBITMAPINFO)&bi, DIB_RGB_COLORS);
// change pixel's alpha value to 255, when it's RGB != 0 // change pixel's alpha value to 255, when it's RGB != 0
COLORREF * pPixel = NULL; COLORREF * pPixel = nullptr;
for (int y = 0; y < height; ++y) for (int y = 0; y < height; ++y)
{ {
pPixel = (COLORREF *)dataBuf + y * width; pPixel = (COLORREF *)dataBuf + y * width;

View File

@ -63,7 +63,7 @@ static void _checkPath()
GetCurrentDirectoryW(sizeof(utf16Path)-1, utf16Path); GetCurrentDirectoryW(sizeof(utf16Path)-1, utf16Path);
char utf8Path[CC_MAX_PATH] = {0}; char utf8Path[CC_MAX_PATH] = {0};
int nNum = WideCharToMultiByte(CP_UTF8, 0, utf16Path, -1, utf8Path, sizeof(utf8Path), NULL, NULL); int nNum = WideCharToMultiByte(CP_UTF8, 0, utf16Path, -1, utf8Path, sizeof(utf8Path), nullptr, nullptr);
s_resourcePath = convertPathFormatToUnixStyle(utf8Path); s_resourcePath = convertPathFormatToUnixStyle(utf8Path);
s_resourcePath.append("/"); s_resourcePath.append("/");
@ -72,13 +72,13 @@ static void _checkPath()
FileUtils* FileUtils::getInstance() FileUtils* FileUtils::getInstance()
{ {
if (s_sharedFileUtils == NULL) if (s_sharedFileUtils == nullptr)
{ {
s_sharedFileUtils = new FileUtilsWin32(); s_sharedFileUtils = new FileUtilsWin32();
if(!s_sharedFileUtils->init()) if(!s_sharedFileUtils->init())
{ {
delete s_sharedFileUtils; delete s_sharedFileUtils;
s_sharedFileUtils = NULL; s_sharedFileUtils = nullptr;
CCLOG("ERROR: Could not init CCFileUtilsWin32"); CCLOG("ERROR: Could not init CCFileUtilsWin32");
} }
} }
@ -147,10 +147,10 @@ static Data getData(const std::string& filename, bool forString)
WCHAR wszBuf[CC_MAX_PATH] = {0}; WCHAR wszBuf[CC_MAX_PATH] = {0};
MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0])); MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0]));
HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, NULL); HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, nullptr);
CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE); CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE);
size = ::GetFileSize(fileHandle, NULL); size = ::GetFileSize(fileHandle, nullptr);
if (forString) if (forString)
{ {
@ -163,7 +163,7 @@ static Data getData(const std::string& filename, bool forString)
} }
DWORD sizeRead = 0; DWORD sizeRead = 0;
BOOL successed = FALSE; BOOL successed = FALSE;
successed = ::ReadFile(fileHandle, buffer, size, &sizeRead, NULL); successed = ::ReadFile(fileHandle, buffer, size, &sizeRead, nullptr);
::CloseHandle(fileHandle); ::CloseHandle(fileHandle);
if (!successed) if (!successed)
@ -212,7 +212,7 @@ Data FileUtilsWin32::getDataFromFile(const std::string& filename)
unsigned char* FileUtilsWin32::getFileData(const std::string& filename, const char* mode, ssize_t* size) unsigned char* FileUtilsWin32::getFileData(const std::string& filename, const char* mode, ssize_t* size)
{ {
unsigned char * pBuffer = NULL; unsigned char * pBuffer = nullptr;
*size = 0; *size = 0;
do do
{ {
@ -222,15 +222,15 @@ unsigned char* FileUtilsWin32::getFileData(const std::string& filename, const ch
WCHAR wszBuf[CC_MAX_PATH] = {0}; WCHAR wszBuf[CC_MAX_PATH] = {0};
MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0])); MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0]));
HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, NULL); HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, nullptr);
CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE); CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE);
*size = ::GetFileSize(fileHandle, NULL); *size = ::GetFileSize(fileHandle, nullptr);
pBuffer = (unsigned char*) malloc(*size); pBuffer = (unsigned char*) malloc(*size);
DWORD sizeRead = 0; DWORD sizeRead = 0;
BOOL successed = FALSE; BOOL successed = FALSE;
successed = ::ReadFile(fileHandle, pBuffer, *size, &sizeRead, NULL); successed = ::ReadFile(fileHandle, pBuffer, *size, &sizeRead, nullptr);
::CloseHandle(fileHandle); ::CloseHandle(fileHandle);
if (!successed) if (!successed)
@ -275,7 +275,7 @@ string FileUtilsWin32::getWritablePath() const
{ {
// Get full path of executable, e.g. c:\Program Files (x86)\My Game Folder\MyGame.exe // Get full path of executable, e.g. c:\Program Files (x86)\My Game Folder\MyGame.exe
char full_path[CC_MAX_PATH + 1]; char full_path[CC_MAX_PATH + 1];
::GetModuleFileNameA(NULL, full_path, CC_MAX_PATH + 1); ::GetModuleFileNameA(nullptr, full_path, CC_MAX_PATH + 1);
// Debug app uses executable directory; Non-debug app uses local app data directory // Debug app uses executable directory; Non-debug app uses local app data directory
#ifndef _DEBUG #ifndef _DEBUG
@ -287,7 +287,7 @@ string FileUtilsWin32::getWritablePath() const
char app_data_path[CC_MAX_PATH + 1]; char app_data_path[CC_MAX_PATH + 1];
// Get local app data directory, e.g. C:\Documents and Settings\username\Local Settings\Application Data // Get local app data directory, e.g. C:\Documents and Settings\username\Local Settings\Application Data
if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, app_data_path))) if (SUCCEEDED(SHGetFolderPathA(nullptr, CSIDL_LOCAL_APPDATA, nullptr, SHGFP_TYPE_CURRENT, app_data_path)))
{ {
string ret((char*)app_data_path); string ret((char*)app_data_path);
@ -300,7 +300,7 @@ string FileUtilsWin32::getWritablePath() const
ret += "\\"; ret += "\\";
// Create directory // Create directory
if (SUCCEEDED(SHCreateDirectoryExA(NULL, ret.c_str(), NULL))) if (SUCCEEDED(SHCreateDirectoryExA(nullptr, ret.c_str(), nullptr)))
{ {
return convertPathFormatToUnixStyle(ret); return convertPathFormatToUnixStyle(ret);
} }

View File

@ -254,7 +254,7 @@ bool GLProgram::initWithPrecompiledProgramByteArray(const GLchar* vShaderByteArr
haveProgram = CCPrecompiledShaders::getInstance()->loadProgram(_program, vShaderByteArray, fShaderByteArray); haveProgram = CCPrecompiledShaders::getInstance()->loadProgram(_program, vShaderByteArray, fShaderByteArray);
CHECK_GL_ERROR_DEBUG(); CHECK_GL_ERROR_DEBUG();
_hashForUniforms = NULL; _hashForUniforms = nullptr;
CHECK_GL_ERROR_DEBUG(); CHECK_GL_ERROR_DEBUG();
@ -311,7 +311,7 @@ void GLProgram::parseVertexAttribs()
for(int i = 0; i < activeAttributes; ++i) for(int i = 0; i < activeAttributes; ++i)
{ {
// Query attribute info. // Query attribute info.
glGetActiveAttrib(_program, i, length, NULL, &attribute.size, &attribute.type, attribName); glGetActiveAttrib(_program, i, length, nullptr, &attribute.size, &attribute.type, attribName);
attribName[length] = '\0'; attribName[length] = '\0';
attribute.name = std::string(attribName); attribute.name = std::string(attribName);
@ -343,7 +343,7 @@ void GLProgram::parseUniforms()
for(int i = 0; i < activeUniforms; ++i) for(int i = 0; i < activeUniforms; ++i)
{ {
// Query uniform info. // Query uniform info.
glGetActiveUniform(_program, i, length, NULL, &uniform.size, &uniform.type, uniformName); glGetActiveUniform(_program, i, length, nullptr, &uniform.size, &uniform.type, uniformName);
uniformName[length] = '\0'; uniformName[length] = '\0';
// Only add uniforms that are not built-in. // Only add uniforms that are not built-in.

View File

@ -172,7 +172,7 @@ void MeshCommand::genMaterialID(GLuint texID, void* glProgramState, void* mesh,
void MeshCommand::MatrixPalleteCallBack( GLProgram* glProgram, Uniform* uniform) void MeshCommand::MatrixPalleteCallBack( GLProgram* glProgram, Uniform* uniform)
{ {
glProgram->setUniformLocationWith4fv(uniform->location, (const float*)_matrixPalette, _matrixPaletteSize); glUniform4fv( uniform->location, (GLsizei)_matrixPaletteSize, (const float*)_matrixPalette );
} }
void MeshCommand::preBatchDraw() void MeshCommand::preBatchDraw()
@ -183,12 +183,11 @@ void MeshCommand::preBatchDraw()
GL::bindTexture2D(_textureID); GL::bindTexture2D(_textureID);
GL::blendFunc(_blendType.src, _blendType.dst); GL::blendFunc(_blendType.src, _blendType.dst);
if (_vao == 0) if (Configuration::getInstance()->supportsShareableVAO() && _vao == 0)
buildVAO(); buildVAO();
if (_vao) if (_vao)
{ {
GL::bindVAO(_vao); GL::bindVAO(_vao);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
} }
else else
{ {
@ -265,8 +264,6 @@ void MeshCommand::execute()
void MeshCommand::buildVAO() void MeshCommand::buildVAO()
{ {
releaseVAO(); releaseVAO();
if (Configuration::getInstance()->supportsShareableVAO())
{
glGenVertexArrays(1, &_vao); glGenVertexArrays(1, &_vao);
GL::bindVAO(_vao); GL::bindVAO(_vao);
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
@ -285,10 +282,9 @@ void MeshCommand::buildVAO()
glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
} }
}
void MeshCommand::releaseVAO() void MeshCommand::releaseVAO()
{ {
if (Configuration::getInstance()->supportsShareableVAO() && _vao) if (_vao)
{ {
glDeleteVertexArrays(1, &_vao); glDeleteVertexArrays(1, &_vao);
_vao = 0; _vao = 0;
@ -299,7 +295,7 @@ void MeshCommand::releaseVAO()
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
void MeshCommand::listenRendererRecreated(EventCustom* event) void MeshCommand::listenRendererRecreated(EventCustom* event)
{ {
releaseVAO(); _vao = 0;
} }
#endif #endif

View File

@ -711,7 +711,7 @@ std::string Texture2D::getDescription() const
// implementation Texture2D (Image) // implementation Texture2D (Image)
bool Texture2D::initWithImage(Image *image) bool Texture2D::initWithImage(Image *image)
{ {
return initWithImage(image, PixelFormat::NONE); return initWithImage(image, g_defaultAlphaPixelFormat);
} }
bool Texture2D::initWithImage(Image *image, PixelFormat format) bool Texture2D::initWithImage(Image *image, PixelFormat format)
@ -736,14 +736,14 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format)
unsigned char* tempData = image->getData(); unsigned char* tempData = image->getData();
Size imageSize = Size((float)imageWidth, (float)imageHeight); Size imageSize = Size((float)imageWidth, (float)imageHeight);
PixelFormat pixelFormat = PixelFormat::NONE; PixelFormat pixelFormat = ((PixelFormat::NONE == format) || (PixelFormat::AUTO == format)) ? image->getRenderFormat() : format;
PixelFormat renderFormat = image->getRenderFormat(); PixelFormat renderFormat = image->getRenderFormat();
size_t tempDataLen = image->getDataLen(); size_t tempDataLen = image->getDataLen();
if (image->getNumberOfMipmaps() > 1) if (image->getNumberOfMipmaps() > 1)
{ {
if (format != PixelFormat::NONE) if (pixelFormat != image->getRenderFormat())
{ {
CCLOG("cocos2d: WARNING: This image has more than 1 mipmaps and we will not convert the data format"); CCLOG("cocos2d: WARNING: This image has more than 1 mipmaps and we will not convert the data format");
} }
@ -754,7 +754,7 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format)
} }
else if (image->isCompressed()) else if (image->isCompressed())
{ {
if (format != PixelFormat::NONE) if (pixelFormat != image->getRenderFormat())
{ {
CCLOG("cocos2d: WARNING: This image is compressed and we cann't convert it for now"); CCLOG("cocos2d: WARNING: This image is compressed and we cann't convert it for now");
} }
@ -764,15 +764,6 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format)
} }
else else
{ {
// compute pixel format
if (format != PixelFormat::NONE)
{
pixelFormat = format;
}else
{
pixelFormat = g_defaultAlphaPixelFormat;
}
unsigned char* outTempData = nullptr; unsigned char* outTempData = nullptr;
ssize_t outTempDataLen = 0; ssize_t outTempDataLen = 0;

View File

@ -15,7 +15,7 @@ void main(void)
); );
const char* cc3D_SkinPositionTex_vert = STRINGIFY( const char* cc3D_SkinPositionTex_vert = STRINGIFY(
attribute vec4 a_position; attribute vec3 a_position;
attribute vec4 a_blendWeight; attribute vec4 a_blendWeight;
attribute vec4 a_blendIndex; attribute vec4 a_blendIndex;
@ -70,10 +70,11 @@ vec4 getPosition()
vec4 _skinnedPosition; vec4 _skinnedPosition;
_skinnedPosition.x = dot(a_position, matrixPalette1); vec4 postion = vec4(a_position, 1.0);
_skinnedPosition.y = dot(a_position, matrixPalette2); _skinnedPosition.x = dot(postion, matrixPalette1);
_skinnedPosition.z = dot(a_position, matrixPalette3); _skinnedPosition.y = dot(postion, matrixPalette2);
_skinnedPosition.w = a_position.w; _skinnedPosition.z = dot(postion, matrixPalette3);
_skinnedPosition.w = postion.w;
return _skinnedPosition; return _skinnedPosition;
} }

View File

@ -5,9 +5,9 @@
-- @parent_module cc -- @parent_module cc
-------------------------------- --------------------------------
-- @function [parent=#Animate3D] getSpeed -- @function [parent=#Animate3D] setSpeed
-- @param self -- @param self
-- @return float#float ret (return value: float) -- @param #float float
-------------------------------- --------------------------------
-- @function [parent=#Animate3D] setWeight -- @function [parent=#Animate3D] setWeight
@ -15,19 +15,9 @@
-- @param #float float -- @param #float float
-------------------------------- --------------------------------
-- @function [parent=#Animate3D] getPlayBack -- @function [parent=#Animate3D] getSpeed
-- @param self -- @param self
-- @return bool#bool ret (return value: bool) -- @return float#float ret (return value: float)
--------------------------------
-- @function [parent=#Animate3D] setPlayBack
-- @param self
-- @param #bool bool
--------------------------------
-- @function [parent=#Animate3D] setSpeed
-- @param self
-- @param #float float
-------------------------------- --------------------------------
-- @function [parent=#Animate3D] getWeight -- @function [parent=#Animate3D] getWeight

View File

@ -10,7 +10,7 @@
-- @return float#float ret (return value: float) -- @return float#float ret (return value: float)
-------------------------------- --------------------------------
-- @function [parent=#Animation3D] getOrCreate -- @function [parent=#Animation3D] create
-- @param self -- @param self
-- @param #string str -- @param #string str
-- @param #string str -- @param #string str

View File

@ -672,12 +672,6 @@
-- @param self -- @param self
-- @param #cc.Ref ref -- @param #cc.Ref ref
--------------------------------
-- @function [parent=#Node] enumerateChildren
-- @param self
-- @param #string str
-- @param #function func
-------------------------------- --------------------------------
-- @function [parent=#Node] getonExitTransitionDidStartCallback -- @function [parent=#Node] getonExitTransitionDidStartCallback
-- @param self -- @param self

View File

@ -1211,16 +1211,6 @@
-- @field [parent=#cc] Mesh#Mesh Mesh preloaded module -- @field [parent=#cc] Mesh#Mesh Mesh preloaded module
--------------------------------------------------------
-- the cc SimpleAudioEngine
-- @field [parent=#cc] SimpleAudioEngine#SimpleAudioEngine SimpleAudioEngine preloaded module
--------------------------------------------------------
-- the cc ProtectedNode
-- @field [parent=#cc] ProtectedNode#ProtectedNode ProtectedNode preloaded module
-------------------------------------------------------- --------------------------------------------------------
-- the cc Animation3D -- the cc Animation3D
-- @field [parent=#cc] Animation3D#Animation3D Animation3D preloaded module -- @field [parent=#cc] Animation3D#Animation3D Animation3D preloaded module
@ -1231,4 +1221,14 @@
-- @field [parent=#cc] Animate3D#Animate3D Animate3D preloaded module -- @field [parent=#cc] Animate3D#Animate3D Animate3D preloaded module
--------------------------------------------------------
-- the cc SimpleAudioEngine
-- @field [parent=#cc] SimpleAudioEngine#SimpleAudioEngine SimpleAudioEngine preloaded module
--------------------------------------------------------
-- the cc ProtectedNode
-- @field [parent=#cc] ProtectedNode#ProtectedNode ProtectedNode preloaded module
return nil return nil

View File

@ -9245,59 +9245,6 @@ int lua_cocos2dx_Node_setUserObject(lua_State* tolua_S)
return 0; return 0;
} }
int lua_cocos2dx_Node_enumerateChildren(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Node* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_enumerateChildren'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 2)
{
std::string arg0;
std::function<bool (cocos2d::Node *)> arg1;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
do {
// Lambda binding for lua is not supported.
assert(false);
} while(0)
;
if(!ok)
return 0;
cobj->enumerateChildren(arg0, arg1);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "enumerateChildren",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_enumerateChildren'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Node_getonExitTransitionDidStartCallback(lua_State* tolua_S) int lua_cocos2dx_Node_getonExitTransitionDidStartCallback(lua_State* tolua_S)
{ {
int argc = 0; int argc = 0;
@ -10093,7 +10040,6 @@ int lua_register_cocos2dx_Node(lua_State* tolua_S)
tolua_function(tolua_S,"getGlobalZOrder",lua_cocos2dx_Node_getGlobalZOrder); tolua_function(tolua_S,"getGlobalZOrder",lua_cocos2dx_Node_getGlobalZOrder);
tolua_function(tolua_S,"draw",lua_cocos2dx_Node_draw); tolua_function(tolua_S,"draw",lua_cocos2dx_Node_draw);
tolua_function(tolua_S,"setUserObject",lua_cocos2dx_Node_setUserObject); tolua_function(tolua_S,"setUserObject",lua_cocos2dx_Node_setUserObject);
tolua_function(tolua_S,"enumerateChildren",lua_cocos2dx_Node_enumerateChildren);
tolua_function(tolua_S,"getonExitTransitionDidStartCallback",lua_cocos2dx_Node_getonExitTransitionDidStartCallback); tolua_function(tolua_S,"getonExitTransitionDidStartCallback",lua_cocos2dx_Node_getonExitTransitionDidStartCallback);
tolua_function(tolua_S,"removeFromParent",lua_cocos2dx_Node_removeFromParentAndCleanup); tolua_function(tolua_S,"removeFromParent",lua_cocos2dx_Node_removeFromParentAndCleanup);
tolua_function(tolua_S,"setPosition3D",lua_cocos2dx_Node_setPosition3D); tolua_function(tolua_S,"setPosition3D",lua_cocos2dx_Node_setPosition3D);
@ -63135,6 +63081,374 @@ int lua_register_cocos2dx_Mesh(lua_State* tolua_S)
return 1; return 1;
} }
int lua_cocos2dx_Animation3D_getDuration(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animation3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Animation3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animation3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animation3D_getDuration'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
double ret = cobj->getDuration();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getDuration",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animation3D_getDuration'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animation3D_create(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.Animation3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
if(!ok)
return 0;
cocos2d::Animation3D* ret = cocos2d::Animation3D::create(arg0);
object_to_luaval<cocos2d::Animation3D>(tolua_S, "cc.Animation3D",(cocos2d::Animation3D*)ret);
return 1;
}
if (argc == 2)
{
std::string arg0;
std::string arg1;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
ok &= luaval_to_std_string(tolua_S, 3,&arg1);
if(!ok)
return 0;
cocos2d::Animation3D* ret = cocos2d::Animation3D::create(arg0, arg1);
object_to_luaval<cocos2d::Animation3D>(tolua_S, "cc.Animation3D",(cocos2d::Animation3D*)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "create",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animation3D_create'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_Animation3D_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Animation3D)");
return 0;
}
int lua_register_cocos2dx_Animation3D(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.Animation3D");
tolua_cclass(tolua_S,"Animation3D","cc.Animation3D","cc.Ref",nullptr);
tolua_beginmodule(tolua_S,"Animation3D");
tolua_function(tolua_S,"getDuration",lua_cocos2dx_Animation3D_getDuration);
tolua_function(tolua_S,"create", lua_cocos2dx_Animation3D_create);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Animation3D).name();
g_luaType[typeName] = "cc.Animation3D";
g_typeCast["Animation3D"] = "cc.Animation3D";
return 1;
}
int lua_cocos2dx_Animate3D_setSpeed(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setSpeed'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0);
if(!ok)
return 0;
cobj->setSpeed(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setSpeed",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setSpeed'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_setWeight(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setWeight'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0);
if(!ok)
return 0;
cobj->setWeight(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setWeight",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setWeight'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_getSpeed(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getSpeed'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
double ret = cobj->getSpeed();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getSpeed",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getSpeed'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_getWeight(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getWeight'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
double ret = cobj->getWeight();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getWeight",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getWeight'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_create(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S)-1;
do
{
if (argc == 3)
{
cocos2d::Animation3D* arg0;
ok &= luaval_to_object<cocos2d::Animation3D>(tolua_S, 2, "cc.Animation3D",&arg0);
if (!ok) { break; }
double arg1;
ok &= luaval_to_number(tolua_S, 3,&arg1);
if (!ok) { break; }
double arg2;
ok &= luaval_to_number(tolua_S, 4,&arg2);
if (!ok) { break; }
cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0, arg1, arg2);
object_to_luaval<cocos2d::Animate3D>(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 1)
{
cocos2d::Animation3D* arg0;
ok &= luaval_to_object<cocos2d::Animation3D>(tolua_S, 2, "cc.Animation3D",&arg0);
if (!ok) { break; }
cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0);
object_to_luaval<cocos2d::Animate3D>(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret);
return 1;
}
} while (0);
ok = true;
CCLOG("%s has wrong number of arguments: %d, was expecting %d", "create",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_create'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_Animate3D_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Animate3D)");
return 0;
}
int lua_register_cocos2dx_Animate3D(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.Animate3D");
tolua_cclass(tolua_S,"Animate3D","cc.Animate3D","cc.ActionInterval",nullptr);
tolua_beginmodule(tolua_S,"Animate3D");
tolua_function(tolua_S,"setSpeed",lua_cocos2dx_Animate3D_setSpeed);
tolua_function(tolua_S,"setWeight",lua_cocos2dx_Animate3D_setWeight);
tolua_function(tolua_S,"getSpeed",lua_cocos2dx_Animate3D_getSpeed);
tolua_function(tolua_S,"getWeight",lua_cocos2dx_Animate3D_getWeight);
tolua_function(tolua_S,"create", lua_cocos2dx_Animate3D_create);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Animate3D).name();
g_luaType[typeName] = "cc.Animate3D";
g_typeCast["Animate3D"] = "cc.Animate3D";
return 1;
}
int lua_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic(lua_State* tolua_S) int lua_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic(lua_State* tolua_S)
{ {
int argc = 0; int argc = 0;
@ -64797,466 +65111,6 @@ int lua_register_cocos2dx_ProtectedNode(lua_State* tolua_S)
g_typeCast["ProtectedNode"] = "cc.ProtectedNode"; g_typeCast["ProtectedNode"] = "cc.ProtectedNode";
return 1; return 1;
} }
int lua_cocos2dx_Animation3D_getDuration(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animation3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Animation3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animation3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animation3D_getDuration'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
double ret = cobj->getDuration();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getDuration",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animation3D_getDuration'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animation3D_getOrCreate(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.Animation3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
if(!ok)
return 0;
cocos2d::Animation3D* ret = cocos2d::Animation3D::getOrCreate(arg0);
object_to_luaval<cocos2d::Animation3D>(tolua_S, "cc.Animation3D",(cocos2d::Animation3D*)ret);
return 1;
}
if (argc == 2)
{
std::string arg0;
std::string arg1;
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
ok &= luaval_to_std_string(tolua_S, 3,&arg1);
if(!ok)
return 0;
cocos2d::Animation3D* ret = cocos2d::Animation3D::getOrCreate(arg0, arg1);
object_to_luaval<cocos2d::Animation3D>(tolua_S, "cc.Animation3D",(cocos2d::Animation3D*)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "getOrCreate",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animation3D_getOrCreate'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_Animation3D_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Animation3D)");
return 0;
}
int lua_register_cocos2dx_Animation3D(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.Animation3D");
tolua_cclass(tolua_S,"Animation3D","cc.Animation3D","cc.Ref",nullptr);
tolua_beginmodule(tolua_S,"Animation3D");
tolua_function(tolua_S,"getDuration",lua_cocos2dx_Animation3D_getDuration);
tolua_function(tolua_S,"getOrCreate", lua_cocos2dx_Animation3D_getOrCreate);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Animation3D).name();
g_luaType[typeName] = "cc.Animation3D";
g_typeCast["Animation3D"] = "cc.Animation3D";
return 1;
}
int lua_cocos2dx_Animate3D_getSpeed(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getSpeed'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
double ret = cobj->getSpeed();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getSpeed",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getSpeed'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_setWeight(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setWeight'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0);
if(!ok)
return 0;
cobj->setWeight(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setWeight",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setWeight'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_getPlayBack(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getPlayBack'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
bool ret = cobj->getPlayBack();
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getPlayBack",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getPlayBack'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_setPlayBack(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setPlayBack'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
bool arg0;
ok &= luaval_to_boolean(tolua_S, 2,&arg0);
if(!ok)
return 0;
cobj->setPlayBack(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setPlayBack",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setPlayBack'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_setSpeed(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setSpeed'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
double arg0;
ok &= luaval_to_number(tolua_S, 2,&arg0);
if(!ok)
return 0;
cobj->setSpeed(arg0);
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setSpeed",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setSpeed'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_getWeight(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Animate3D* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getWeight'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
return 0;
double ret = cobj->getWeight();
tolua_pushnumber(tolua_S,(lua_Number)ret);
return 1;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getWeight",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getWeight'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Animate3D_create(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S)-1;
do
{
if (argc == 3)
{
cocos2d::Animation3D* arg0;
ok &= luaval_to_object<cocos2d::Animation3D>(tolua_S, 2, "cc.Animation3D",&arg0);
if (!ok) { break; }
double arg1;
ok &= luaval_to_number(tolua_S, 3,&arg1);
if (!ok) { break; }
double arg2;
ok &= luaval_to_number(tolua_S, 4,&arg2);
if (!ok) { break; }
cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0, arg1, arg2);
object_to_luaval<cocos2d::Animate3D>(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 1)
{
cocos2d::Animation3D* arg0;
ok &= luaval_to_object<cocos2d::Animation3D>(tolua_S, 2, "cc.Animation3D",&arg0);
if (!ok) { break; }
cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0);
object_to_luaval<cocos2d::Animate3D>(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret);
return 1;
}
} while (0);
ok = true;
CCLOG("%s has wrong number of arguments: %d, was expecting %d", "create",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_create'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_Animate3D_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Animate3D)");
return 0;
}
int lua_register_cocos2dx_Animate3D(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.Animate3D");
tolua_cclass(tolua_S,"Animate3D","cc.Animate3D","cc.ActionInterval",nullptr);
tolua_beginmodule(tolua_S,"Animate3D");
tolua_function(tolua_S,"getSpeed",lua_cocos2dx_Animate3D_getSpeed);
tolua_function(tolua_S,"setWeight",lua_cocos2dx_Animate3D_setWeight);
tolua_function(tolua_S,"getPlayBack",lua_cocos2dx_Animate3D_getPlayBack);
tolua_function(tolua_S,"setPlayBack",lua_cocos2dx_Animate3D_setPlayBack);
tolua_function(tolua_S,"setSpeed",lua_cocos2dx_Animate3D_setSpeed);
tolua_function(tolua_S,"getWeight",lua_cocos2dx_Animate3D_getWeight);
tolua_function(tolua_S,"create", lua_cocos2dx_Animate3D_create);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Animate3D).name();
g_luaType[typeName] = "cc.Animate3D";
g_typeCast["Animate3D"] = "cc.Animate3D";
return 1;
}
TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
{ {
tolua_open(tolua_S); tolua_open(tolua_S);

View File

@ -1570,9 +1570,6 @@ int register_all_cocos2dx(lua_State* tolua_S);

View File

@ -2604,7 +2604,7 @@ static int tolua_Cocos2d_glLineWidth00(lua_State* tolua_S)
#endif #endif
{ {
float arg0 = (float)tolua_tonumber(tolua_S, 1, 0); float arg0 = (float)tolua_tonumber(tolua_S, 1, 0);
glLineWidth((GLfloat)arg0 ); glLineWidth(arg0);
} }
return 0; return 0;
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
@ -2684,9 +2684,9 @@ static int tolua_Cocos2d_glPolygonOffset00(lua_State* tolua_S)
else else
#endif #endif
{ {
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0); float arg0 = (float)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0); float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
glPolygonOffset((GLfloat)arg0 , (GLfloat)arg1 ); glPolygonOffset(arg0, arg1);
} }
return 0; return 0;
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
@ -3165,7 +3165,7 @@ static int tolua_Cocos2d_glTexParameterf00(lua_State* tolua_S)
{ {
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0); unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
unsigned int arg1 = (unsigned int)tolua_tonumber(tolua_S, 2, 0); unsigned int arg1 = (unsigned int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0); float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
glTexParameterf((GLenum)arg0 , (GLenum)arg1 , (GLfloat)arg2 ); glTexParameterf((GLenum)arg0 , (GLenum)arg1 , (GLfloat)arg2 );
} }
return 0; return 0;
@ -3287,8 +3287,8 @@ static int tolua_Cocos2d_glUniform1f00(lua_State* tolua_S)
#endif #endif
{ {
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0); int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0); float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
glUniform1f((GLint)arg0 , (GLfloat)arg1 ); glUniform1f(arg0,arg1);
} }
return 0; return 0;
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
@ -3426,9 +3426,9 @@ static int tolua_Cocos2d_glUniform2f00(lua_State* tolua_S)
#endif #endif
{ {
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0); int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0); float arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0); float arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
glUniform2f((GLint)arg0 , (GLfloat)arg1 , (GLfloat)arg2); glUniform2f(arg0, arg1, arg2);
} }
return 0; return 0;
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
@ -3569,10 +3569,10 @@ static int tolua_Cocos2d_glUniform3f00(lua_State* tolua_S)
#endif #endif
{ {
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0); int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0); float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0); float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
int arg3 = (int)tolua_tonumber(tolua_S, 4, 0); float arg3 = (float)tolua_tonumber(tolua_S, 4, 0);
glUniform3f((GLint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 , (GLfloat)arg3 ); glUniform3f(arg0, arg1, arg2, arg3);
} }
return 0; return 0;
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
@ -3716,11 +3716,11 @@ static int tolua_Cocos2d_glUniform4f00(lua_State* tolua_S)
#endif #endif
{ {
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0); int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0); float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0); float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
int arg3 = (int)tolua_tonumber(tolua_S, 4, 0); float arg3 = (float)tolua_tonumber(tolua_S, 4, 0);
int arg4 = (int)tolua_tonumber(tolua_S, 5, 0); float arg4 = (float)tolua_tonumber(tolua_S, 5, 0);
glUniform4f((GLint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 , (GLfloat)arg3 , (GLfloat)arg4 ); glUniform4f(arg0 , arg1, arg2, arg3, arg4);
} }
return 0; return 0;
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
@ -4042,8 +4042,8 @@ static int tolua_Cocos2d_glVertexAttrib1f00(lua_State* tolua_S)
#endif #endif
{ {
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0); unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0); float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
glVertexAttrib1f((GLuint)arg0 , (GLfloat)arg1 ); glVertexAttrib1f(arg0 , arg1);
} }
return 0; return 0;
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
@ -4113,9 +4113,9 @@ static int tolua_Cocos2d_glVertexAttrib2f00(lua_State* tolua_S)
#endif #endif
{ {
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0); unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0); float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0); float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
glVertexAttrib2f((GLuint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 ); glVertexAttrib2f(arg0, arg1, arg2);
} }
return 0; return 0;
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
@ -4186,10 +4186,10 @@ static int tolua_Cocos2d_glVertexAttrib3f00(lua_State* tolua_S)
#endif #endif
{ {
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0); unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0); float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0); float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
int arg3 = (int)tolua_tonumber(tolua_S, 4, 0); float arg3 = (float)tolua_tonumber(tolua_S, 4, 0);
glVertexAttrib3f((GLuint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 , (GLfloat)arg3 ); glVertexAttrib3f(arg0 , arg1, arg2, arg3);
} }
return 0; return 0;
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
@ -4261,11 +4261,11 @@ static int tolua_Cocos2d_glVertexAttrib4f00(lua_State* tolua_S)
#endif #endif
{ {
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0); unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0); float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0); float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
int arg3 = (int)tolua_tonumber(tolua_S, 4, 0); float arg3 = (float)tolua_tonumber(tolua_S, 4, 0);
int arg4 = (int)tolua_tonumber(tolua_S, 5, 0); float arg4 = (float)tolua_tonumber(tolua_S, 5, 0);
glVertexAttrib4f((GLuint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 , (GLfloat)arg3 , (GLfloat)arg4 ); glVertexAttrib4f(arg0, arg1, arg2, arg3, arg4);
} }
return 0; return 0;
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
@ -5031,10 +5031,10 @@ static int tolua_cocos2d_DrawPrimitives_drawColor4F00(lua_State* tolua_S)
else else
#endif #endif
{ {
unsigned char r = (( unsigned char) tolua_tonumber(tolua_S,1,0)); float r = (float)tolua_tonumber(tolua_S,1,0);
unsigned char g = (( unsigned char) tolua_tonumber(tolua_S,2,0)); float g = (float)tolua_tonumber(tolua_S,2,0);
unsigned char b = (( unsigned char) tolua_tonumber(tolua_S,3,0)); float b = (float)tolua_tonumber(tolua_S,3,0);
unsigned char a = (( unsigned char) tolua_tonumber(tolua_S,4,0)); float a = (float)tolua_tonumber(tolua_S,4,0);
DrawPrimitives::setDrawColor4F(r,g,b,a); DrawPrimitives::setDrawColor4F(r,g,b,a);
} }
return 0; return 0;

View File

@ -176,7 +176,7 @@ static int lua_cocos2dx_ArmatureAnimation_setFrameEventCallFunc(lua_State* L)
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)wrapper, handler, ScriptHandlerMgr::HandlerType::ARMATURE_EVENT); ScriptHandlerMgr::getInstance()->addObjectHandler((void*)wrapper, handler, ScriptHandlerMgr::HandlerType::ARMATURE_EVENT);
self->setFrameEventCallFunc([=](Bone *bone, const std::string& frameEventName, int originFrameIndex, int currentFrameIndex){ self->setFrameEventCallFunc([=](cocostudio::Bone *bone, const std::string& frameEventName, int originFrameIndex, int currentFrameIndex){
if (0 != handler) if (0 != handler)
{ {

View File

@ -2215,6 +2215,66 @@ tolua_lerror:
#endif #endif
} }
static int lua_cocos2dx_Node_enumerateChildren(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Node* cobj = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Node",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Node*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Node_enumerateChildren'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 2)
{
#if COCOS2D_DEBUG >= 1
if (!tolua_isstring(tolua_S, 2, 0, &tolua_err) ||
!toluafix_isfunction(tolua_S,3,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
std::string name = (std::string)tolua_tocppstring(tolua_S,2,0);
LUA_FUNCTION handler = toluafix_ref_function(tolua_S,3,0);
cobj->enumerateChildren(name, [=](Node* node)->bool{
int id = node ? (int)node->_ID : -1;
int* luaID = node ? &node->_luaID : nullptr;
toluafix_pushusertype_ccobject(tolua_S, id, luaID, (void*)node,"cc.Node");
bool ret = LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 1);
LuaEngine::getInstance()->removeScriptHandler(handler);
return ret;
});
return 0;
}
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "enumerateChildren",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Node_enumerateChildren'.",&tolua_err);
#endif
return 0;
}
static int tolua_cocos2d_Spawn_create(lua_State* tolua_S) static int tolua_cocos2d_Spawn_create(lua_State* tolua_S)
{ {
if (NULL == tolua_S) if (NULL == tolua_S)
@ -3920,6 +3980,9 @@ static void extendNode(lua_State* tolua_S)
lua_pushstring(tolua_S, "setAnchorPoint"); lua_pushstring(tolua_S, "setAnchorPoint");
lua_pushcfunction(tolua_S, tolua_cocos2d_Node_setAnchorPoint); lua_pushcfunction(tolua_S, tolua_cocos2d_Node_setAnchorPoint);
lua_rawset(tolua_S, -3); lua_rawset(tolua_S, -3);
lua_pushstring(tolua_S, "enumerateChildren");
lua_pushcfunction(tolua_S, lua_cocos2dx_Node_enumerateChildren);
lua_rawset(tolua_S, -3);
} }
lua_pop(tolua_S, 1); lua_pop(tolua_S, 1);
} }

View File

@ -561,5 +561,13 @@ end
cc.KeyCode.KEY_BACK = cc.KeyCode.KEY_ESCAPE cc.KeyCode.KEY_BACK = cc.KeyCode.KEY_ESCAPE
cc.EventCode =
{
BEGAN = 0,
MOVED = 1,
ENDED = 2,
CANCELLED = 3,
}

View File

@ -48,7 +48,7 @@ static void localStorageCreateTable()
{ {
const char *sql_createtable = "CREATE TABLE IF NOT EXISTS data(key TEXT PRIMARY KEY,value TEXT);"; const char *sql_createtable = "CREATE TABLE IF NOT EXISTS data(key TEXT PRIMARY KEY,value TEXT);";
sqlite3_stmt *stmt; sqlite3_stmt *stmt;
int ok=sqlite3_prepare_v2(_db, sql_createtable, -1, &stmt, NULL); int ok=sqlite3_prepare_v2(_db, sql_createtable, -1, &stmt, nullptr);
ok |= sqlite3_step(stmt); ok |= sqlite3_step(stmt);
ok |= sqlite3_finalize(stmt); ok |= sqlite3_finalize(stmt);
@ -71,15 +71,15 @@ void localStorageInit( const std::string& fullpath/* = "" */)
// SELECT // SELECT
const char *sql_select = "SELECT value FROM data WHERE key=?;"; const char *sql_select = "SELECT value FROM data WHERE key=?;";
ret |= sqlite3_prepare_v2(_db, sql_select, -1, &_stmt_select, NULL); ret |= sqlite3_prepare_v2(_db, sql_select, -1, &_stmt_select, nullptr);
// REPLACE // REPLACE
const char *sql_update = "REPLACE INTO data (key, value) VALUES (?,?);"; const char *sql_update = "REPLACE INTO data (key, value) VALUES (?,?);";
ret |= sqlite3_prepare_v2(_db, sql_update, -1, &_stmt_update, NULL); ret |= sqlite3_prepare_v2(_db, sql_update, -1, &_stmt_update, nullptr);
// DELETE // DELETE
const char *sql_remove = "DELETE FROM data WHERE key=?;"; const char *sql_remove = "DELETE FROM data WHERE key=?;";
ret |= sqlite3_prepare_v2(_db, sql_remove, -1, &_stmt_remove, NULL); ret |= sqlite3_prepare_v2(_db, sql_remove, -1, &_stmt_remove, nullptr);
if( ret != SQLITE_OK ) { if( ret != SQLITE_OK ) {
printf("Error initializing DB\n"); printf("Error initializing DB\n");

View File

@ -263,9 +263,6 @@ void Button::loadTextureNormal(const std::string& normal,TextureResType texType)
updateFlippedX(); updateFlippedX();
updateFlippedY(); updateFlippedY();
_buttonNormalRenderer->setColor(this->getColor());
_buttonNormalRenderer->setOpacity(this->getOpacity());
updateContentSizeWithTextureSize(_normalTextureSize); updateContentSizeWithTextureSize(_normalTextureSize);
_normalTextureLoaded = true; _normalTextureLoaded = true;
_normalTextureAdaptDirty = true; _normalTextureAdaptDirty = true;
@ -314,9 +311,6 @@ void Button::loadTexturePressed(const std::string& selected,TextureResType texTy
updateFlippedX(); updateFlippedX();
updateFlippedY(); updateFlippedY();
_buttonDisableRenderer->setColor(this->getColor());
_buttonDisableRenderer->setOpacity(this->getOpacity());
_pressedTextureLoaded = true; _pressedTextureLoaded = true;
_pressedTextureAdaptDirty = true; _pressedTextureAdaptDirty = true;
} }
@ -363,8 +357,6 @@ void Button::loadTextureDisabled(const std::string& disabled,TextureResType texT
_disabledTextureSize = _buttonDisableRenderer->getContentSize(); _disabledTextureSize = _buttonDisableRenderer->getContentSize();
updateFlippedX(); updateFlippedX();
updateFlippedY(); updateFlippedY();
_buttonDisableRenderer->setColor(this->getColor());
_buttonDisableRenderer->setOpacity(this->getOpacity());
_disabledTextureLoaded = true; _disabledTextureLoaded = true;
_disabledTextureAdaptDirty = true; _disabledTextureAdaptDirty = true;

View File

@ -184,8 +184,6 @@ void CheckBox::loadTextureBackGround(const std::string& backGround,TextureResTyp
} }
updateFlippedX(); updateFlippedX();
updateFlippedY(); updateFlippedY();
_backGroundBoxRenderer->setColor(this->getColor());
_backGroundBoxRenderer->setOpacity(this->getOpacity());
updateContentSizeWithTextureSize(_backGroundBoxRenderer->getContentSize()); updateContentSizeWithTextureSize(_backGroundBoxRenderer->getContentSize());
_backGroundBoxRendererAdaptDirty = true; _backGroundBoxRendererAdaptDirty = true;
@ -212,8 +210,7 @@ void CheckBox::loadTextureBackGroundSelected(const std::string& backGroundSelect
} }
updateFlippedX(); updateFlippedX();
updateFlippedY(); updateFlippedY();
_backGroundSelectedBoxRenderer->setColor(this->getColor());
_backGroundSelectedBoxRenderer->setOpacity(this->getOpacity());
_backGroundSelectedBoxRendererAdaptDirty = true; _backGroundSelectedBoxRendererAdaptDirty = true;
} }
@ -238,8 +235,7 @@ void CheckBox::loadTextureFrontCross(const std::string& cross,TextureResType tex
} }
updateFlippedX(); updateFlippedX();
updateFlippedY(); updateFlippedY();
_frontCrossRenderer->setColor(this->getColor());
_frontCrossRenderer->setOpacity(this->getOpacity());
_frontCrossRendererAdaptDirty = true; _frontCrossRendererAdaptDirty = true;
} }
@ -264,8 +260,6 @@ void CheckBox::loadTextureBackGroundDisabled(const std::string& backGroundDisabl
} }
updateFlippedX(); updateFlippedX();
updateFlippedY(); updateFlippedY();
_backGroundBoxDisabledRenderer->setColor(this->getColor());
_backGroundBoxDisabledRenderer->setOpacity(this->getOpacity());
_backGroundBoxDisabledRendererAdaptDirty = true; _backGroundBoxDisabledRendererAdaptDirty = true;
} }
@ -291,8 +285,6 @@ void CheckBox::loadTextureFrontCrossDisabled(const std::string& frontCrossDisabl
} }
updateFlippedX(); updateFlippedX();
updateFlippedY(); updateFlippedY();
_frontCrossDisabledRenderer->setColor(this->getColor());
_frontCrossDisabledRenderer->setOpacity(this->getOpacity());
_frontCrossDisabledRendererAdaptDirty = true; _frontCrossDisabledRendererAdaptDirty = true;
} }

View File

@ -33,13 +33,13 @@ class Sprite;
namespace ui { namespace ui {
CC_DEPRECATED_ATTRIBUTE typedef enum typedef enum
{ {
CHECKBOX_STATE_EVENT_SELECTED, CHECKBOX_STATE_EVENT_SELECTED,
CHECKBOX_STATE_EVENT_UNSELECTED CHECKBOX_STATE_EVENT_UNSELECTED
}CheckBoxEventType; }CheckBoxEventType;
CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_SelectedStateEvent)(Ref*,CheckBoxEventType); typedef void (Ref::*SEL_SelectedStateEvent)(Ref*,CheckBoxEventType);
#define checkboxselectedeventselector(_SELECTOR) (SEL_SelectedStateEvent)(&_SELECTOR) #define checkboxselectedeventselector(_SELECTOR) (SEL_SelectedStateEvent)(&_SELECTOR)
/** /**

View File

@ -154,8 +154,6 @@ void ImageView::loadTexture(const std::string& fileName, TextureResType texType)
_imageTextureSize = _imageRenderer->getContentSize(); _imageTextureSize = _imageRenderer->getContentSize();
updateFlippedX(); updateFlippedX();
updateFlippedY(); updateFlippedY();
_imageRenderer->setColor(this->getColor());
_imageRenderer->setOpacity(this->getOpacity());
updateContentSizeWithTextureSize(_imageTextureSize); updateContentSizeWithTextureSize(_imageTextureSize);
_imageRendererAdaptDirty = true; _imageRendererAdaptDirty = true;

View File

@ -1648,7 +1648,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)c
if (direction == FocusDirection::LEFT) { if (direction == FocusDirection::LEFT) {
if (index == 0) if (index == 0)
{ {
return true * isLastWidgetInContainer(parent, direction); return isLastWidgetInContainer(parent, direction);
} }
else else
{ {
@ -1658,7 +1658,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)c
if (direction == FocusDirection::RIGHT) { if (direction == FocusDirection::RIGHT) {
if (index == container.size()-1) if (index == container.size()-1)
{ {
return true * isLastWidgetInContainer(parent, direction); return isLastWidgetInContainer(parent, direction);
} }
else else
{ {
@ -1681,7 +1681,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)c
{ {
if (index == 0) if (index == 0)
{ {
return true * isLastWidgetInContainer(parent, direction); return isLastWidgetInContainer(parent, direction);
} }
else else
@ -1693,7 +1693,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)c
{ {
if (index == container.size() - 1) if (index == container.size() - 1)
{ {
return true * isLastWidgetInContainer(parent, direction); return isLastWidgetInContainer(parent, direction);
} }
else else
{ {

View File

@ -32,13 +32,13 @@ NS_CC_BEGIN
namespace ui{ namespace ui{
CC_DEPRECATED_ATTRIBUTE typedef enum typedef enum
{ {
LISTVIEW_ONSELECTEDITEM_START, LISTVIEW_ONSELECTEDITEM_START,
LISTVIEW_ONSELECTEDITEM_END LISTVIEW_ONSELECTEDITEM_END
}ListViewEventType; }ListViewEventType;
CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_ListViewEvent)(Ref*,ListViewEventType); typedef void (Ref::*SEL_ListViewEvent)(Ref*,ListViewEventType);
#define listvieweventselector(_SELECTOR) (SEL_ListViewEvent)(&_SELECTOR) #define listvieweventselector(_SELECTOR) (SEL_ListViewEvent)(&_SELECTOR)
class ListView : public ScrollView class ListView : public ScrollView

View File

@ -160,8 +160,6 @@ void LoadingBar::loadTexture(const std::string& texture,TextureResType texType)
default: default:
break; break;
} }
_barRenderer->setColor(this->getColor());
_barRenderer->setOpacity(this->getOpacity());
_barRendererTextureSize = _barRenderer->getContentSize(); _barRendererTextureSize = _barRenderer->getContentSize();

View File

@ -31,12 +31,12 @@ NS_CC_BEGIN
namespace ui { namespace ui {
CC_DEPRECATED_ATTRIBUTE typedef enum typedef enum
{ {
PAGEVIEW_EVENT_TURNING, PAGEVIEW_EVENT_TURNING,
}PageViewEventType; }PageViewEventType;
CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_PageViewEvent)(Ref*, PageViewEventType); typedef void (Ref::*SEL_PageViewEvent)(Ref*, PageViewEventType);
#define pagevieweventselector(_SELECTOR)(SEL_PageViewEvent)(&_SELECTOR) #define pagevieweventselector(_SELECTOR)(SEL_PageViewEvent)(&_SELECTOR)
class PageView : public Layout class PageView : public Layout

View File

@ -66,7 +66,7 @@ RichElementText* RichElementText::create(int tag, const Color3B &color, GLubyte
return element; return element;
} }
CC_SAFE_DELETE(element); CC_SAFE_DELETE(element);
return NULL; return nullptr;
} }
bool RichElementText::init(int tag, const Color3B &color, GLubyte opacity, const std::string& text, const std::string& fontName, float fontSize) bool RichElementText::init(int tag, const Color3B &color, GLubyte opacity, const std::string& text, const std::string& fontName, float fontSize)
@ -90,7 +90,7 @@ RichElementImage* RichElementImage::create(int tag, const Color3B &color, GLubyt
return element; return element;
} }
CC_SAFE_DELETE(element); CC_SAFE_DELETE(element);
return NULL; return nullptr;
} }
bool RichElementImage::init(int tag, const Color3B &color, GLubyte opacity, const std::string& filePath) bool RichElementImage::init(int tag, const Color3B &color, GLubyte opacity, const std::string& filePath)
@ -112,7 +112,7 @@ RichElementCustomNode* RichElementCustomNode::create(int tag, const Color3B &col
return element; return element;
} }
CC_SAFE_DELETE(element); CC_SAFE_DELETE(element);
return NULL; return nullptr;
} }
bool RichElementCustomNode::init(int tag, const Color3B &color, GLubyte opacity, cocos2d::Node *customNode) bool RichElementCustomNode::init(int tag, const Color3B &color, GLubyte opacity, cocos2d::Node *customNode)
@ -149,7 +149,7 @@ RichText* RichText::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
bool RichText::init() bool RichText::init()
@ -204,7 +204,7 @@ void RichText::formatText()
for (ssize_t i=0; i<_richElements.size(); i++) for (ssize_t i=0; i<_richElements.size(); i++)
{ {
RichElement* element = _richElements.at(i); RichElement* element = _richElements.at(i);
Node* elementRenderer = NULL; Node* elementRenderer = nullptr;
switch (element->_type) switch (element->_type)
{ {
case RichElement::Type::TEXT: case RichElement::Type::TEXT:

View File

@ -33,7 +33,7 @@ class EventFocusListener;
namespace ui { namespace ui {
CC_DEPRECATED_ATTRIBUTE typedef enum typedef enum
{ {
SCROLLVIEW_EVENT_SCROLL_TO_TOP, SCROLLVIEW_EVENT_SCROLL_TO_TOP,
SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM, SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM,
@ -46,7 +46,7 @@ CC_DEPRECATED_ATTRIBUTE typedef enum
SCROLLVIEW_EVENT_BOUNCE_RIGHT SCROLLVIEW_EVENT_BOUNCE_RIGHT
}ScrollviewEventType; }ScrollviewEventType;
CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_ScrollViewEvent)(Ref*, ScrollviewEventType); typedef void (Ref::*SEL_ScrollViewEvent)(Ref*, ScrollviewEventType);
#define scrollvieweventselector(_SELECTOR) (SEL_ScrollViewEvent)(&_SELECTOR) #define scrollvieweventselector(_SELECTOR) (SEL_ScrollViewEvent)(&_SELECTOR)

View File

@ -148,8 +148,6 @@ void Slider::loadBarTexture(const std::string& fileName, TextureResType texType)
default: default:
break; break;
} }
_barRenderer->setColor(this->getColor());
_barRenderer->setOpacity(this->getOpacity());
_barRendererAdaptDirty = true; _barRendererAdaptDirty = true;
_progressBarRendererDirty = true; _progressBarRendererDirty = true;
@ -190,9 +188,6 @@ void Slider::loadProgressBarTexture(const std::string& fileName, TextureResType
break; break;
} }
_progressBarRenderer->setColor(this->getColor());
_progressBarRenderer->setOpacity(this->getOpacity());
_progressBarRenderer->setAnchorPoint(Vec2(0.0f, 0.5f)); _progressBarRenderer->setAnchorPoint(Vec2(0.0f, 0.5f));
_progressBarTextureSize = _progressBarRenderer->getContentSize(); _progressBarTextureSize = _progressBarRenderer->getContentSize();
_progressBarRendererDirty = true; _progressBarRendererDirty = true;
@ -314,8 +309,6 @@ void Slider::loadSlidBallTextureNormal(const std::string& normal,TextureResType
default: default:
break; break;
} }
_slidBallNormalRenderer->setColor(this->getColor());
_slidBallNormalRenderer->setOpacity(this->getOpacity());
} }
void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResType texType) void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResType texType)
@ -337,8 +330,6 @@ void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResTyp
default: default:
break; break;
} }
_slidBallPressedRenderer->setColor(this->getColor());
_slidBallPressedRenderer->setOpacity(this->getOpacity());
} }
void Slider::loadSlidBallTextureDisabled(const std::string& disabled,TextureResType texType) void Slider::loadSlidBallTextureDisabled(const std::string& disabled,TextureResType texType)
@ -360,8 +351,6 @@ void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResTyp
default: default:
break; break;
} }
_slidBallDisabledRenderer->setColor(this->getColor());
_slidBallDisabledRenderer->setOpacity(this->getOpacity());
} }
void Slider::setPercent(int percent) void Slider::setPercent(int percent)

View File

@ -33,12 +33,12 @@ class Sprite;
namespace ui { namespace ui {
CC_DEPRECATED_ATTRIBUTE typedef enum typedef enum
{ {
SLIDER_PERCENTCHANGED SLIDER_PERCENTCHANGED
}SliderEventType; }SliderEventType;
CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_SlidPercentChangedEvent)(Ref*,SliderEventType); typedef void (Ref::*SEL_SlidPercentChangedEvent)(Ref*,SliderEventType);
#define sliderpercentchangedselector(_SELECTOR) (SEL_SlidPercentChangedEvent)(&_SELECTOR) #define sliderpercentchangedselector(_SELECTOR) (SEL_SlidPercentChangedEvent)(&_SELECTOR)
/** /**

View File

@ -88,8 +88,6 @@ void TextBMFont::setFntFile(const std::string& fileName)
_fntFileName = fileName; _fntFileName = fileName;
_labelBMFontRenderer->setBMFontFilePath(fileName); _labelBMFontRenderer->setBMFontFilePath(fileName);
_labelBMFontRenderer->setColor(this->getColor());
_labelBMFontRenderer->setOpacity(this->getOpacity());
_fntFileHasInit = true; _fntFileHasInit = true;
setString(_stringValue); setString(_stringValue);
} }

View File

@ -584,6 +584,8 @@ bool TextField::onTouchBegan(Touch *touch, Event *unusedEvent)
if (_hitted) if (_hitted)
{ {
_textFieldRenderer->attachWithIME(); _textFieldRenderer->attachWithIME();
} else {
this->didNotSelectSelf();
} }
return pass; return pass;
} }

View File

@ -91,7 +91,7 @@ protected:
bool _deleteBackward; bool _deleteBackward;
}; };
CC_DEPRECATED_ATTRIBUTE typedef enum typedef enum
{ {
TEXTFIELD_EVENT_ATTACH_WITH_IME, TEXTFIELD_EVENT_ATTACH_WITH_IME,
TEXTFIELD_EVENT_DETACH_WITH_IME, TEXTFIELD_EVENT_DETACH_WITH_IME,
@ -99,7 +99,7 @@ CC_DEPRECATED_ATTRIBUTE typedef enum
TEXTFIELD_EVENT_DELETE_BACKWARD, TEXTFIELD_EVENT_DELETE_BACKWARD,
}TextFiledEventType; }TextFiledEventType;
CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_TextFieldEvent)(Ref*, TextFiledEventType); typedef void (Ref::*SEL_TextFieldEvent)(Ref*, TextFiledEventType);
#define textfieldeventselector(_SELECTOR) (SEL_TextFieldEvent)(&_SELECTOR) #define textfieldeventselector(_SELECTOR) (SEL_TextFieldEvent)(&_SELECTOR)
/** class UITextField : public Widget /** class UITextField : public Widget

View File

@ -37,7 +37,7 @@ class EventListenerTouchOneByOne;
namespace ui { namespace ui {
CC_DEPRECATED_ATTRIBUTE typedef enum typedef enum
{ {
TOUCH_EVENT_BEGAN, TOUCH_EVENT_BEGAN,
TOUCH_EVENT_MOVED, TOUCH_EVENT_MOVED,
@ -45,7 +45,7 @@ CC_DEPRECATED_ATTRIBUTE typedef enum
TOUCH_EVENT_CANCELED TOUCH_EVENT_CANCELED
}TouchEventType; }TouchEventType;
CC_DEPRECATED_ATTRIBUTE typedef void (Ref::*SEL_TouchEvent)(Ref*,TouchEventType); typedef void (Ref::*SEL_TouchEvent)(Ref*,TouchEventType);
#define toucheventselector(_SELECTOR) (SEL_TouchEvent)(&_SELECTOR) #define toucheventselector(_SELECTOR) (SEL_TouchEvent)(&_SELECTOR)

View File

@ -59,7 +59,7 @@ Control* Control::create()
else else
{ {
CC_SAFE_DELETE(pRet); CC_SAFE_DELETE(pRet);
return NULL; return nullptr;
} }
} }
@ -154,7 +154,7 @@ void Control::addTargetWithActionForControlEvents(Ref* target, Handler action, E
* *
* @param target The target object that is, the object to which the action * @param target The target object that is, the object to which the action
* message is sent. It cannot be nil. The target is not retained. * message is sent. It cannot be nil. The target is not retained.
* @param action A selector identifying an action message. It cannot be NULL. * @param action A selector identifying an action message. It cannot be nullptr.
* @param controlEvent A control event for which the action message is sent. * @param controlEvent A control event for which the action message is sent.
* See "CCControlEvent" for constants. * See "CCControlEvent" for constants.
*/ */
@ -320,7 +320,7 @@ bool Control::isHighlighted() const
bool Control::hasVisibleParents() const bool Control::hasVisibleParents() const
{ {
auto parent = this->getParent(); auto parent = this->getParent();
for( auto c = parent; c != NULL; c = c->getParent() ) for( auto c = parent; c != nullptr; c = c->getParent() )
{ {
if( !c->isVisible() ) if( !c->isVisible() )
{ {

View File

@ -135,7 +135,7 @@ void ControlColourPicker::setColor(const Color3B& color)
void ControlColourPicker::setEnabled(bool enabled) void ControlColourPicker::setEnabled(bool enabled)
{ {
Control::setEnabled(enabled); Control::setEnabled(enabled);
if (_huePicker != NULL) if (_huePicker != nullptr)
{ {
_huePicker->setEnabled(enabled); _huePicker->setEnabled(enabled);
} }

View File

@ -118,7 +118,7 @@ void ControlHuePicker::setHuePercentage(float hueValueInPercent)
void ControlHuePicker::setEnabled(bool enabled) void ControlHuePicker::setEnabled(bool enabled)
{ {
Control::setEnabled(enabled); Control::setEnabled(enabled);
if (_slider != NULL) if (_slider != nullptr)
{ {
_slider->setOpacity(enabled ? 255 : 128); _slider->setOpacity(enabled ? 255 : 128);
} }

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