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
Added TextField::getStringLength()
Add shadow, outline, glow filter support for UIText
Fix UITextField IME can't auto detach
QiuleiWang
Fix the bug that calculated height of multi-line string was incorrect on iOS
@ -907,6 +908,9 @@ Developers:
Teivaz
Custom uniform search optimization
chareice
Make `setup.py` work on zsh
Retired Core Developers:
WenSheng Yang
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] GLProgramState: can use uniform location to get/set uniform values
[NEW] HttpClient: added sendImmediate()

View File

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

View File

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

View File

@ -714,23 +714,19 @@ public:
virtual Node* getChildByName(const std::string& name) const;
/** 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:
* `/` : 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 the search should be performed on the tree's node
* and be performed recursively across the entire node tree.
* `//`: Can only be placed at the begin of the search string. This indicates that it will search recursively.
* `..`: 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
* enumerateChildren("/MyName", ...): This searches the root's children 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("//MyName", ...): This searches the children recursively and matches any node with the name `MyName`.
* 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("Abby/Normal", ...): This searches the node's grandchildren and returns any node whose name is `Normal`
* 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`.
* @endcode
*

View File

@ -66,12 +66,12 @@ Animate3D* Animate3D::clone() const
auto animate = const_cast<Animate3D*>(this);
auto copy = Animate3D::create(animate->_animation);
copy->_speed = _speed;
copy->_absSpeed = _absSpeed;
copy->_weight = _weight;
copy->_elapsed = _elapsed;
copy->_start = _start;
copy->_last = _last;
copy->_playBack = _playBack;
copy->_playReverse = _playReverse;
copy->setDuration(animate->getDuration());
return copy;
@ -81,7 +81,7 @@ Animate3D* Animate3D::clone() const
Animate3D* Animate3D::reverse() const
{
auto animate = clone();
animate->_playBack = !animate->_playBack;
animate->_playReverse = !animate->_playReverse;
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.
void Animate3D::step(float dt)
{
ActionInterval::step(dt * _speed);
ActionInterval::step(dt * _absSpeed);
}
void Animate3D::update(float t)
{
if (_target)
if (_target && _weight > 0.f)
{
float transDst[3], rotDst[4], scaleDst[3];
float* trans = nullptr, *rot = nullptr, *scale = nullptr;
if (_playBack)
if (_playReverse)
t = 1 - t;
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()
: _speed(1)
: _absSpeed(1.f)
, _weight(1.f)
, _start(0.f)
, _last(1.f)
, _animation(nullptr)
, _playBack(false)
, _playReverse(false)
{
}

View File

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

View File

@ -30,7 +30,7 @@
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 key = fullPath + "#" + animationName;

View File

@ -59,8 +59,10 @@ public:
~Curve();
};
/**read all animation or only the animation with given animationName? animationName == "" read all.*/
static Animation3D* getOrCreate(const std::string& filename, const std::string& animationName = "");
/**read all animation or only the animation with given animationName? animationName == "" read the first.*/
static Animation3D* create(const std::string& filename, const std::string& animationName = "");
CC_DEPRECATED_ATTRIBUTE static Animation3D* getOrCreate(const std::string& filename, const std::string& animationName = ""){ return create(filename, animationName); }
/**get duration*/
float getDuration() const { return _duration; }

View File

@ -447,8 +447,7 @@ bool Bundle3D::loadBinary(const std::string& path)
return false;
}
// Create bundle reader
//CC_SAFE_DELETE(_bundleReader);
// Initialise bundle reader
_binaryReader.init( (char*)_binaryBuffer->getBytes(), _binaryBuffer->getSize() );
// Read identifier info
@ -463,8 +462,11 @@ bool Bundle3D::loadBinary(const std::string& path)
// Read version
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) {
clear();
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]);
return false;
}
}
// Read ref table size
if (_binaryReader.read(&_referenceCount, 4, 1) != 1)
@ -766,17 +768,37 @@ bool Bundle3D::loadAnimationDataBinary(Animation3DData* animationdata)
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")
{
return GL_UNSIGNED_INT;
}
else if (str == "GL_FLOAT")
{
return GL_FLOAT;
}
else
{
assert(0);
CCASSERT(false, "Wrong GL type");
return 0;
}
}

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@ public:
}
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>& 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:
@ -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);
/**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*/
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);
/**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*/
void buildBuffer();

View File

@ -193,7 +193,7 @@ bool Sprite3D::loadFromC3x(const std::string& path)
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);
_skin = MeshSkin::create(fullPath, "");
@ -342,7 +342,7 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
_meshCommand.setDepthTestEnabled(true);
if (_skin)
{
_meshCommand.setMatrixPaletteSize(_skin->getMatrixPaletteSize());
_meshCommand.setMatrixPaletteSize((int)_skin->getMatrixPaletteSize());
_meshCommand.setMatrixPalette(_skin->getMatrixPalette());
}
//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};
MultiByteToWideChar(CP_UTF8, 0, buf, -1, wszBuf, sizeof(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);
fflush(stdout);
#else
@ -337,7 +337,7 @@ bool Console::listenOnTCP(int port)
#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));
return false;
}
@ -359,9 +359,9 @@ bool Console::listenOnTCP(int port)
#else
close(listenfd);
#endif
} while ( (res = res->ai_next) != NULL);
} while ( (res = res->ai_next) != nullptr);
if (res == NULL) {
if (res == nullptr) {
perror("net_listen:");
freeaddrinfo(ressave);
return false;
@ -372,14 +372,14 @@ bool Console::listenOnTCP(int port)
if (res->ai_family == AF_INET) {
char buf[INET_ADDRSTRLEN] = "";
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));
else
perror("inet_ntop");
} else if (res->ai_family == AF_INET6) {
char buf[INET6_ADDRSTRLEN] = "";
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));
else
perror("inet_ntop");
@ -1042,7 +1042,7 @@ void Console::loop()
copy_set = _read_set;
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 )
{

View File

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

View File

@ -614,7 +614,7 @@ void EventDispatcher::removeEventListener(EventListener* listener)
if (l->getAssociatedNode() != nullptr)
{
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)
@ -1277,7 +1277,7 @@ void EventDispatcher::removeEventListenersForListenerID(const EventListener::Lis
if (l->getAssociatedNode() != nullptr)
{
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)

View File

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

View File

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

View File

@ -181,7 +181,7 @@ void tgaFlipImage( tImageTGA *info )
unsigned char *row = (unsigned char *)malloc(rowbytes);
int y;
if (row == NULL) return;
if (row == nullptr) return;
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);
// check to make sure we have the memory required
if (info->imageData == NULL)
if (info->imageData == nullptr)
{
info->status = TGA_ERROR_MEMORY;
break;

View File

@ -261,6 +261,10 @@ THE SOFTWARE.
//3d
#include "3d/CCSprite3D.h"
#include "3d/CCMesh.h"
#include "3d/CCMeshSkin.h"
#include "3d/CCAnimate3D.h"
#include "3d/CCAnimation3D.h"
#include "3d/CCSprite3DMaterial.h"
// Audio
#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 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 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 ccGLEnable( int flags ) { /* ignore */ };
CC_DEPRECATED_ATTRIBUTE typedef int ccGLServerState;

View File

@ -97,7 +97,7 @@ unsigned int __Dictionary::count()
__Array* __Dictionary::allKeys()
{
int iKeyCount = this->count();
if (iKeyCount <= 0) return NULL;
if (iKeyCount <= 0) return nullptr;
__Array* array = __Array::createWithCapacity(iKeyCount);
@ -127,7 +127,7 @@ __Array* __Dictionary::allKeys()
__Array* __Dictionary::allKeysForObject(Ref* object)
{
int iKeyCount = this->count();
if (iKeyCount <= 0) return NULL;
if (iKeyCount <= 0) return nullptr;
__Array* array = __Array::create();
DictElement *pElement, *tmp;
@ -161,16 +161,16 @@ __Array* __Dictionary::allKeysForObject(Ref* object)
Ref* __Dictionary::objectForKey(const std::string& key)
{
// if dictionary wasn't initialized, return NULL directly.
if (_dictType == kDictUnknown) return NULL;
// if dictionary wasn't initialized, return nullptr directly.
if (_dictType == kDictUnknown) return nullptr;
// __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.
CCASSERT(_dictType == kDictStr, "this dictionary does not use string as key.");
Ref* pRetObject = NULL;
DictElement *pElement = NULL;
Ref* pRetObject = nullptr;
DictElement *pElement = nullptr;
HASH_FIND_STR(_elements, key.c_str(), pElement);
if (pElement != NULL)
if (pElement != nullptr)
{
pRetObject = pElement->_object;
}
@ -179,16 +179,16 @@ Ref* __Dictionary::objectForKey(const std::string& key)
Ref* __Dictionary::objectForKey(intptr_t key)
{
// if dictionary wasn't initialized, return NULL directly.
if (_dictType == kDictUnknown) return NULL;
// if dictionary wasn't initialized, return nullptr directly.
if (_dictType == kDictUnknown) return nullptr;
// __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.
CCASSERT(_dictType == kDictInt, "this dictionary does not use integer as key.");
Ref* pRetObject = NULL;
DictElement *pElement = NULL;
Ref* pRetObject = nullptr;
DictElement *pElement = nullptr;
HASH_FIND_PTR(_elements, &key, pElement);
if (pElement != NULL)
if (pElement != nullptr)
{
pRetObject = pElement->_object;
}
@ -198,7 +198,7 @@ Ref* __Dictionary::objectForKey(intptr_t key)
const __String* __Dictionary::valueForKey(const std::string& key)
{
__String* pStr = dynamic_cast<__String*>(objectForKey(key));
if (pStr == NULL)
if (pStr == nullptr)
{
pStr = __String::create("");
}
@ -208,7 +208,7 @@ const __String* __Dictionary::valueForKey(const std::string& key)
const __String* __Dictionary::valueForKey(intptr_t key)
{
__String* pStr = dynamic_cast<__String*>(objectForKey(key));
if (pStr == NULL)
if (pStr == nullptr)
{
pStr = __String::create("");
}
@ -217,7 +217,7 @@ const __String* __Dictionary::valueForKey(intptr_t 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)
{
_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.");
DictElement *pElement = NULL;
DictElement *pElement = nullptr;
HASH_FIND_STR(_elements, key.c_str(), pElement);
if (pElement == NULL)
if (pElement == nullptr)
{
setObjectUnSafe(pObject, key);
}
@ -243,7 +243,7 @@ void __Dictionary::setObject(Ref* pObject, const std::string& key)
void __Dictionary::setObject(Ref* pObject, intptr_t key)
{
CCASSERT(pObject != NULL, "Invalid Argument!");
CCASSERT(pObject != nullptr, "Invalid Argument!");
if (_dictType == kDictUnknown)
{
_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.");
DictElement *pElement = NULL;
DictElement *pElement = nullptr;
HASH_FIND_PTR(_elements, &key, pElement);
if (pElement == NULL)
if (pElement == nullptr)
{
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(key.length() > 0, "Invalid Argument!");
DictElement *pElement = NULL;
DictElement *pElement = nullptr;
HASH_FIND_STR(_elements, key.c_str(), 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");
DictElement *pElement = NULL;
DictElement *pElement = nullptr;
HASH_FIND_PTR(_elements, &key, pElement);
removeObjectForElememt(pElement);
}
@ -311,7 +311,7 @@ void __Dictionary::setObjectUnSafe(Ref* pObject, const intptr_t key)
void __Dictionary::removeObjectsForKeys(__Array* pKey__Array)
{
Ref* pObj = NULL;
Ref* pObj = nullptr;
CCARRAY_FOREACH(pKey__Array, pObj)
{
__String* pStr = static_cast<__String*>(pObj);
@ -321,7 +321,7 @@ void __Dictionary::removeObjectsForKeys(__Array* pKey__Array)
void __Dictionary::removeObjectForElememt(DictElement* pElement)
{
if (pElement != NULL)
if (pElement != nullptr)
{
HASH_DEL(_elements, pElement);
pElement->_object->release();
@ -345,7 +345,7 @@ Ref* __Dictionary::randomObject()
{
if (_dictType == kDictUnknown)
{
return NULL;
return nullptr;
}
Ref* key = allKeys()->getRandomObject();
@ -360,7 +360,7 @@ Ref* __Dictionary::randomObject()
}
else
{
return NULL;
return nullptr;
}
}
@ -566,9 +566,9 @@ __Dictionary* __Dictionary::clone() const
{
__Dictionary* newDict = __Dictionary::create();
DictElement* element = NULL;
Ref* tmpObj = NULL;
Clonable* obj = NULL;
DictElement* element = nullptr;
Ref* tmpObj = nullptr;
Clonable* obj = nullptr;
if (_dictType == kDictInt)
{
CCDICT_FOREACH(this, element)

View File

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

View File

@ -69,7 +69,7 @@ bool __String::initWithFormatAndValist(const char* format, va_list ap)
{
bool bRet = false;
char* pBuf = (char*)malloc(kMaxStringLen);
if (pBuf != NULL)
if (pBuf != nullptr)
{
vsnprintf(pBuf, kMaxStringLen, format, ap);
_string = pBuf;
@ -170,7 +170,7 @@ void __String::appendWithFormat(const char* format, ...)
va_start(ap, format);
char* pBuf = (char*)malloc(kMaxStringLen);
if (pBuf != NULL)
if (pBuf != nullptr)
{
vsnprintf(pBuf, kMaxStringLen, format, ap);
_string.append(pBuf);
@ -207,7 +207,7 @@ bool __String::isEqual(const Ref* pObject)
{
bool bRet = false;
const __String* pStr = dynamic_cast<const __String*>(pObject);
if (pStr != NULL)
if (pStr != nullptr)
{
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* ret = NULL;
if (data != NULL)
__String* ret = nullptr;
if (data != nullptr)
{
char* pStr = (char*)malloc(nLen+1);
if (pStr != NULL)
if (pStr != nullptr)
{
pStr[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) {
if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL) == 0) {
if(pSpriteFrame != NULL) {
if(pSpriteFrame != nullptr) {
((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::NORMAL);
}
} else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED) == 0) {
if(pSpriteFrame != NULL) {
if(pSpriteFrame != nullptr) {
((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::HIGH_LIGHTED);
}
} else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED) == 0) {
if(pSpriteFrame != NULL) {
if(pSpriteFrame != nullptr) {
((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::DISABLED);
}
} else {

View File

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

View File

@ -9,7 +9,7 @@ namespace cocosbuilder {
void MenuItemLoader::onHandlePropTypeBlock(Node * pNode, Node * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * ccbReader) {
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)->setTarget(pBlockData->_target, pBlockData->mSELMenuHandler);

View File

@ -71,7 +71,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * ccbRe
// #endif
// Forward properties for sub ccb files
if (dynamic_cast<CCBFile*>(pNode) != NULL)
if (dynamic_cast<CCBFile*>(pNode) != nullptr)
{
CCBFile *ccbNode = (CCBFile*)pNode;
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
__Array *extraPropsNames = (__Array*)pNode->getUserObject();
Ref* pObj = NULL;
Ref* pObj = nullptr;
bool bFound = false;
CCARRAY_FOREACH(extraPropsNames, pObj)
{
@ -346,7 +346,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * ccbRe
case CCBReader::PropertyType::BLOCK_CONTROL:
{
BlockControlData * blockControlData = this->parsePropTypeBlockControl(pNode, pParent, ccbReader);
if(setProp && blockControlData != NULL) {
if(setProp && blockControlData != nullptr) {
this->onHandlePropTypeBlockControl(pNode, pParent, propertyName.c_str(), blockControlData, ccbReader);
}
CC_SAFE_DELETE(blockControlData);
@ -574,14 +574,14 @@ SpriteFrame * NodeLoader::parsePropTypeSpriteFrame(Node * pNode, Node * pParent,
std::string spriteSheet = ccbReader->readCachedString();
std::string spriteFile = ccbReader->readCachedString();
SpriteFrame *spriteFrame = NULL;
SpriteFrame *spriteFrame = nullptr;
if (spriteFile.length() != 0)
{
if (spriteSheet.length() == 0)
{
spriteFile = ccbReader->getCCBRootPath() + spriteFile;
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);
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 animation = ccbReader->readCachedString();
Animation * ccAnimation = NULL;
Animation * ccAnimation = nullptr;
// Support for stripping relative file paths, since ios doesn't currently
// know what to do with them, since its pulling from bundle.
@ -642,7 +642,7 @@ Texture2D * NodeLoader::parsePropTypeTexture(Node * pNode, Node * pParent, CCBRe
}
else
{
return NULL;
return nullptr;
}
}
@ -761,7 +761,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead
if(selectorTarget != CCBReader::TargetType::NONE)
{
Ref* target = NULL;
Ref* target = nullptr;
if(!ccbReader->isJSControlled())
{
if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT)
@ -773,7 +773,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead
target = ccbReader->getOwner();
}
if(target != NULL)
if(target != nullptr)
{
if(selectorName.length() > 0)
{
@ -781,7 +781,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead
CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(target);
if(targetAsCCBSelectorResolver != NULL)
if(targetAsCCBSelectorResolver != nullptr)
{
selMenuHandler = targetAsCCBSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName.c_str());
}
@ -789,7 +789,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead
if(selMenuHandler == 0)
{
CCBSelectorResolver * ccbSelectorResolver = ccbReader->getCCBSelectorResolver();
if(ccbSelectorResolver != NULL)
if(ccbSelectorResolver != nullptr)
{
selMenuHandler = ccbSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName.c_str());
}
@ -809,7 +809,7 @@ BlockData * NodeLoader::parsePropTypeBlock(Node * pNode, Node * pParent, CCBRead
CCLOG("Unexpected empty selector.");
}
} else {
CCLOG("Unexpected NULL target for selector.");
CCLOG("Unexpected nullptr target for selector.");
}
}
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)
@ -844,7 +844,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP
{
if(!ccbReader->isJSControlled())
{
Ref* target = NULL;
Ref* target = nullptr;
if(selectorTarget == CCBReader::TargetType::DOCUMENT_ROOT)
{
target = ccbReader->getAnimationManager()->getRootNode();
@ -854,7 +854,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP
target = ccbReader->getOwner();
}
if(target != NULL)
if(target != nullptr)
{
if(selectorName.length() > 0)
{
@ -862,7 +862,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP
CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(target);
if(targetAsCCBSelectorResolver != NULL)
if(targetAsCCBSelectorResolver != nullptr)
{
selControlHandler = targetAsCCBSelectorResolver->onResolveCCBCCControlSelector(target, selectorName.c_str());
}
@ -870,7 +870,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP
if(selControlHandler == 0)
{
CCBSelectorResolver * ccbSelectorResolver = ccbReader->getCCBSelectorResolver();
if(ccbSelectorResolver != NULL)
if(ccbSelectorResolver != nullptr)
{
selControlHandler = ccbSelectorResolver->onResolveCCBCCControlSelector(target, selectorName.c_str());
}
@ -894,7 +894,7 @@ BlockControlData * NodeLoader::parsePropTypeBlockControl(Node * pNode, Node * pP
CCLOG("Unexpected empty selector.");
}
} else {
CCLOG("Unexpected NULL target for selector.");
CCLOG("Unexpected nullptr target for selector.");
}
}
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) {
@ -960,7 +960,7 @@ Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader
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 callback

View File

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

View File

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

View File

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

View File

@ -68,7 +68,7 @@ VisibleFrame* VisibleFrame::create()
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
return nullptr;
}
VisibleFrame::VisibleFrame()
@ -104,7 +104,7 @@ TextureFrame* TextureFrame::create()
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
return nullptr;
}
TextureFrame::TextureFrame()
@ -155,7 +155,7 @@ RotationFrame* RotationFrame::create()
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
return nullptr;
}
RotationFrame::RotationFrame()
@ -204,7 +204,7 @@ SkewFrame* SkewFrame::create()
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
return nullptr;
}
SkewFrame::SkewFrame()
@ -261,7 +261,7 @@ RotationSkewFrame* RotationSkewFrame::create()
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
return nullptr;
}
RotationSkewFrame::RotationSkewFrame()
@ -314,7 +314,7 @@ PositionFrame* PositionFrame::create()
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
return nullptr;
}
PositionFrame::PositionFrame()
@ -366,7 +366,7 @@ ScaleFrame* ScaleFrame::create()
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
return nullptr;
}
ScaleFrame::ScaleFrame()
@ -421,7 +421,7 @@ AnchorPointFrame* AnchorPointFrame::create()
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
return nullptr;
}
AnchorPointFrame::AnchorPointFrame()
@ -457,7 +457,7 @@ InnerActionFrame* InnerActionFrame::create()
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
return nullptr;
}
InnerActionFrame::InnerActionFrame()
@ -493,7 +493,7 @@ ColorFrame* ColorFrame::create()
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
return nullptr;
}
ColorFrame::ColorFrame()
@ -559,7 +559,7 @@ EventFrame* EventFrame::create()
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
return nullptr;
}
EventFrame::EventFrame()
@ -594,7 +594,7 @@ ZOrderFrame* ZOrderFrame::create()
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
return nullptr;
}
ZOrderFrame::ZOrderFrame()
@ -605,7 +605,7 @@ ZOrderFrame::ZOrderFrame()
void ZOrderFrame::onEnter(Frame *nextFrame)
{
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)
node->setRotation(rotation);
if(rotationSkewX != 0)
node->setRotationX(rotationSkewX);
node->setRotationSkewX(rotationSkewX);
if(rotationSkewY != 0)
node->setRotationY(rotationSkewY);
node->setRotationSkewY(rotationSkewY);
if(skewx != 0)
node->setSkewX(skewx);
if(skewy != 0)
@ -296,19 +296,17 @@ void NodeReader::initNode(Node* node, const rapidjson::Value& json)
if(width != 0 || height != 0)
node->setContentSize(Size(width, height));
if(zorder != 0)
node->setZOrder(zorder);
node->setLocalZOrder(zorder);
if(visible != true)
node->setVisible(visible);
if(alpha != 255)
{
node->setOpacity(alpha);
node->setCascadeOpacityEnabled(true);
}
if(red != 255 || green != 255 || blue != 255)
{
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)
{
_frames.eraseObject(frame);
frame->setTimeline(NULL);
frame->setTimeline(nullptr);
}
void Timeline::setNode(Node* node)
@ -131,8 +131,8 @@ void Timeline::apply(int frameIndex)
void Timeline::binarySearchKeyFrame(int frameIndex)
{
Frame *from = NULL;
Frame *to = NULL;
Frame *from = nullptr;
Frame *to = nullptr;
long length = _frames.size();
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->updateTransform();
bool blendDirty = bone->isBlendDirty();
BlendFunc func = bone->getBlendFunc();
if (blendDirty)
if (func.src != _blendFunc.src || func.dst != _blendFunc.dst)
{
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();
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)
{
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)
{
if(str != NULL)
if(str != nullptr)
{
textureData->height = atof(str);
}
}
else if (key.compare(A_PIVOT_X) == 0)
{
if(str != NULL)
if(str != nullptr)
{
textureData->pivotX = atof(str);
}
}
else if (key.compare(A_PIVOT_Y) == 0)
{
if(str != NULL)
if(str != nullptr)
{
textureData->pivotY = atof(str);
}

View File

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

View File

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

View File

@ -92,7 +92,7 @@ Type stExpCocoNode::GetType(CocoLoader* pCoco)
char* stExpCocoNode::GetName(CocoLoader* pCoco)
{
char* szName = NULL ;
char* szName = nullptr ;
if(m_ObjIndex >= 0)
{
stExpCocoObjectDesc* tpCocoObjectDesc = pCoco->GetCocoObjectDescArray();
@ -147,9 +147,9 @@ stExpCocoNode* stExpCocoNode::GetChildArray(CocoLoader* pCoco)
CocoLoader::CocoLoader()
{
m_pRootNode = NULL;
m_pObjectDescArray = NULL;
m_pMemoryBuff = NULL;
m_pRootNode = nullptr;
m_pObjectDescArray = nullptr;
m_pMemoryBuff = nullptr;
}
CocoLoader::~CocoLoader()
@ -157,7 +157,7 @@ CocoLoader::~CocoLoader()
if(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];
uLongf dwSrcSize = m_pFileHeader->m_nCompressSize;
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;
}
@ -198,7 +198,7 @@ stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(const char* szObjDesc)
return &m_pObjectDescArray[i];
}
}
return NULL;
return nullptr;
}
stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(int vIndex)
@ -207,7 +207,7 @@ stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(int vIndex)
{
return &m_pObjectDescArray[vIndex];
}
return NULL;
return nullptr;
}
char* CocoLoader::GetMemoryAddr_AttribDesc()

View File

@ -115,7 +115,7 @@ void TriggerMng::parse(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCoc
#if CC_ENABLE_SCRIPT_BINDING
ScriptEngineProtocol* engine = ScriptEngineManager::getInstance()->getScriptEngine();
bool useBindings = engine != NULL;
bool useBindings = engine != nullptr;
if (useBindings)
{
@ -234,7 +234,7 @@ bool TriggerMng::isEmpty(void) const
const char *str2 = pActionArray[i3].GetValue(pCocoLoader);
if (key2.compare("classname") == 0)
{
if (str2 != NULL)
if (str2 != nullptr)
{
action.AddMember("classname", str2, allocator);
}
@ -255,7 +255,7 @@ bool TriggerMng::isEmpty(void) const
const char *str3 = pDataItemArray[i5].GetValue(pCocoLoader);
if (key3.compare("key") == 0)
{
if (str3 != NULL)
if (str3 != nullptr)
{
dataitem.AddMember("key", str3, allocator);
}
@ -310,7 +310,7 @@ bool TriggerMng::isEmpty(void) const
const char *str4 = pConditionArray[i7].GetValue(pCocoLoader);
if (key4.compare("classname") == 0)
{
if (str4 != NULL)
if (str4 != nullptr)
{
cond.AddMember("classname", str4, allocator);
}
@ -331,7 +331,7 @@ bool TriggerMng::isEmpty(void) const
const char *str5 = pDataItemArray[i9].GetValue(pCocoLoader);
if (key5.compare("key") == 0)
{
if (str5 != NULL)
if (str5 != nullptr)
{
dataitem.AddMember("key", str5, allocator);
}
@ -380,7 +380,7 @@ bool TriggerMng::isEmpty(void) const
stExpCocoNode *pEventArray = pEventsArray->GetChildArray(pCocoLoader);
std::string key6 = pEventArray[0].GetName(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);
eventsItem.PushBack(event, allocator);
@ -390,7 +390,7 @@ bool TriggerMng::isEmpty(void) const
}
else if (key1.compare("id") == 0)
{
if (str1 != NULL)
if (str1 != nullptr)
{
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);
if (key.compare("id") == 0)
{
if (str0 != NULL)
if (str0 != nullptr)
{
_id = atoi(str0); //(unsigned int)(DICTOOL->getIntValue_json(val, "id"));
}
@ -292,7 +292,7 @@ void TriggerObj::serialize(const rapidjson::Value &val)
continue;
}
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->init();
_acts.pushBack(act);

View File

@ -152,7 +152,7 @@ namespace cocostudio
if (button->isScale9Enabled()) {
button->setCapInsets(Rect(capsx, capsy, capsWidth, capsHeight));
button->setSize(Size(scale9Width, scale9Height));
button->setContentSize(Size(scale9Width, scale9Height));
}
button->setTitleColor(Color3B(cri, cgi, cbi));
@ -203,7 +203,7 @@ namespace cocostudio
{
float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width);
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);

View File

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

View File

@ -19,7 +19,7 @@ namespace cocostudio
static const char* P_Scale9Height = "scale9Height";
static ImageViewReader* instanceImageViewReader = NULL;
static ImageViewReader* instanceImageViewReader = nullptr;
IMPLEMENT_CLASS_WIDGET_READER_INFO(ImageViewReader)
@ -128,7 +128,7 @@ namespace cocostudio
float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width,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);

View File

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

View File

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

View File

@ -19,7 +19,7 @@ namespace cocostudio
static const char* P_Direction = "direction";
static const char* P_Percent = "percent";
static LoadingBarReader* instanceLoadingBar = NULL;
static LoadingBarReader* instanceLoadingBar = nullptr;
IMPLEMENT_CLASS_WIDGET_READER_INFO(LoadingBarReader)
@ -130,7 +130,7 @@ namespace cocostudio
float width = DICTOOL->getFloatValue_json(options, P_Width);
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_ProgressBarData = "progressBarData";
static const char* P_BarFileName = "barFileName";
static SliderReader* instanceSliderReader = NULL;
static SliderReader* instanceSliderReader = nullptr;
IMPLEMENT_CLASS_WIDGET_READER_INFO(SliderReader)
@ -125,7 +123,7 @@ namespace cocostudio
} //end of for loop
if (slider->isScale9Enabled()) {
slider->setSize(Size(barLength, slider->getContentSize().height));
slider->setContentSize(Size(barLength, slider->getContentSize().height));
}
slider->setPercent(percent);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -174,7 +174,7 @@ namespace cocostudio
}else if(key == P_Visbile){ \
widget->setVisible(valueToBool(value)); \
}else if(key == P_ZOrder){ \
widget->setZOrder(valueToInt(value)); \
widget->setLocalZOrder(valueToInt(value)); \
}else if(key == P_LayoutParameter){ \
stExpCocoNode *layoutCocosNode = stChildArray[i].GetChildArray(cocoLoader); \
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,
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,
@ -441,7 +441,7 @@ bool Mat4::decompose(Vec3* scale, Quaternion* rotation, Vec3* translation) const
}
// Nothing left to do.
if (scale == NULL && rotation == NULL)
if (scale == nullptr && rotation == nullptr)
return true;
// Extract the scale.
@ -469,7 +469,7 @@ bool Mat4::decompose(Vec3* scale, Quaternion* rotation, Vec3* translation) const
}
// Nothing left to do.
if (rotation == NULL)
if (rotation == nullptr)
return true;
// Scale too close to zero, can't decompose rotation.
@ -559,17 +559,17 @@ float Mat4::determinant() const
void Mat4::getScale(Vec3* scale) const
{
decompose(scale, NULL, NULL);
decompose(scale, nullptr, nullptr);
}
bool Mat4::getRotation(Quaternion* rotation) const
{
return decompose(NULL, rotation, NULL);
return decompose(nullptr, rotation, nullptr);
}
void Mat4::getTranslation(Vec3* translation) const
{
decompose(NULL, NULL, translation);
decompose(nullptr, nullptr, translation);
}
void Mat4::getUpVector(Vec3* dst) const

View File

@ -401,9 +401,9 @@ void SIOClientImpl::onMessage(WebSocket* ws, const WebSocket::Data& data)
s_data = payload;
SIOClient *c = NULL;
SIOClient *c = nullptr;
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)
{
@ -671,7 +671,7 @@ SIOClient* SocketIO::connect(const std::string& uri, SocketIO::SIODelegate& dele
//check if already connected to endpoint, handle
c = socket->getClient(path);
if(c == NULL)
if(c == nullptr)
{
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(),
name.c_str(), -1);
if(NULL == _wsInstance) {
if(nullptr == _wsInstance) {
WsMessage* msg = new WsMessage();
msg->what = WS_MSG_TO_UITHREAD_ERROR;
_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)
{
EventMouse event(EventMouse::MouseEventType::MOUSE_DOWN);
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here
event.setCursorPosition(_mouseX, this->getViewPortRect().size.height - _mouseY);
event.setCursorPosition(cursorX, cursorY);
event.setMouseButton(button);
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
}
else if(GLFW_RELEASE == action)
{
EventMouse event(EventMouse::MouseEventType::MOUSE_UP);
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here
event.setCursorPosition(_mouseX, this->getViewPortRect().size.height - _mouseY);
event.setCursorPosition(cursorX, cursorY);
event.setMouseButton(button);
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
}
@ -606,9 +608,25 @@ void GLView::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y)
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
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);
}
@ -685,9 +703,9 @@ static bool glew_dynamic_binding()
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 (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"))
{
log("OpenGL: ARB_framebuffer_object is supported");

View File

@ -393,7 +393,6 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
if (isKeyboardShown_)
{
[self handleTouchesAfterKeyboardShow];
return;
}
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
{
if (isKeyboardShown_)
{
return;
}
UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0};
float xs[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
{
if (isKeyboardShown_)
{
return;
}
UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0};
float xs[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
{
if (isKeyboardShown_)
{
return;
}
UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0};
float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};
float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};

View File

@ -55,7 +55,7 @@ Application::Application()
Application::~Application()
{
CC_ASSERT(this == sm_pSharedApplication);
sm_pSharedApplication = NULL;
sm_pSharedApplication = nullptr;
}
int Application::run()
@ -248,7 +248,7 @@ static void PVRFrameEnableControlWindow(bool bEnable)
KEY_ALL_ACCESS,
0,
&hKey,
NULL))
nullptr))
{
return;
}
@ -257,7 +257,7 @@ static void PVRFrameEnableControlWindow(bool bEnable)
const WCHAR* wszNewData = (bEnable) ? L"NO" : L"YES";
WCHAR wszOldData[256] = {0};
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
|| (ERROR_SUCCESS == status // or the hide_gui value is exist
&& 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)
{
MessageBoxA(NULL, pszMsg, pszTitle, MB_OK);
MessageBoxA(nullptr, pszMsg, pszTitle, MB_OK);
}
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];
memset(widebuff, 0, sizeof(WCHAR) * (bufflen + 1));
MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, widebuff, bufflen);
@ -48,10 +48,10 @@ void LuaLog(const char *pszMsg)
OutputDebugStringW(widebuff);
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];
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);
delete[] widebuff;

View File

@ -37,10 +37,10 @@ int Device::getDPI()
static int dpi = -1;
if (dpi == -1)
{
HDC hScreenDC = GetDC( NULL );
HDC hScreenDC = GetDC( nullptr );
int PixelsX = GetDeviceCaps( hScreenDC, HORZRES );
int MMX = GetDeviceCaps( hScreenDC, HORZSIZE );
ReleaseDC( NULL, hScreenDC );
ReleaseDC( nullptr, hScreenDC );
dpi = 254.0f*PixelsX/MMX/10;
}
return dpi;
@ -55,7 +55,7 @@ void Device::setAccelerometerInterval(float interval)
class BitmapDC
{
public:
BitmapDC(HWND hWnd = NULL)
BitmapDC(HWND hWnd = nullptr)
: _DC(nullptr)
, _bmp(nullptr)
, _font((HFONT)GetStockObject(DEFAULT_GUI_FONT))
@ -79,7 +79,7 @@ public:
wchar_t * utf8ToUtf16(const std::string& str)
{
wchar_t * pwszBuffer = NULL;
wchar_t * pwszBuffer = nullptr;
do
{
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;
do
@ -154,7 +154,7 @@ public:
SendMessage( _wnd, WM_FONTCHANGE, 0, 0);
}
delete [] pwszBuffer;
pwszBuffer = NULL;
pwszBuffer = nullptr;
}
}
@ -214,11 +214,11 @@ public:
if (_bmp)
{
DeleteObject(_bmp);
_bmp = NULL;
_bmp = nullptr;
}
if (nWidth > 0 && nHeight > 0)
{
_bmp = CreateBitmap(nWidth, nHeight, 1, 32, NULL);
_bmp = CreateBitmap(nWidth, nHeight, 1, 32, nullptr);
if (! _bmp)
{
return false;
@ -364,7 +364,7 @@ private:
RemoveFontResource(pwszBuffer);
SendMessage( _wnd, WM_FONTCHANGE, 0, 0);
delete [] pwszBuffer;
pwszBuffer = NULL;
pwszBuffer = nullptr;
}
_curFontPath.clear();
}
@ -404,7 +404,7 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
} bi = {0};
bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
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;
height = (short)size.cy;
@ -416,7 +416,7 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
(LPBITMAPINFO)&bi, DIB_RGB_COLORS);
// 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)
{
pPixel = (COLORREF *)dataBuf + y * width;

View File

@ -63,7 +63,7 @@ static void _checkPath()
GetCurrentDirectoryW(sizeof(utf16Path)-1, utf16Path);
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.append("/");
@ -72,13 +72,13 @@ static void _checkPath()
FileUtils* FileUtils::getInstance()
{
if (s_sharedFileUtils == NULL)
if (s_sharedFileUtils == nullptr)
{
s_sharedFileUtils = new FileUtilsWin32();
if(!s_sharedFileUtils->init())
{
delete s_sharedFileUtils;
s_sharedFileUtils = NULL;
s_sharedFileUtils = nullptr;
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};
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);
size = ::GetFileSize(fileHandle, NULL);
size = ::GetFileSize(fileHandle, nullptr);
if (forString)
{
@ -163,7 +163,7 @@ static Data getData(const std::string& filename, bool forString)
}
DWORD sizeRead = 0;
BOOL successed = FALSE;
successed = ::ReadFile(fileHandle, buffer, size, &sizeRead, NULL);
successed = ::ReadFile(fileHandle, buffer, size, &sizeRead, nullptr);
::CloseHandle(fileHandle);
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 * pBuffer = NULL;
unsigned char * pBuffer = nullptr;
*size = 0;
do
{
@ -222,15 +222,15 @@ unsigned char* FileUtilsWin32::getFileData(const std::string& filename, const ch
WCHAR wszBuf[CC_MAX_PATH] = {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);
*size = ::GetFileSize(fileHandle, NULL);
*size = ::GetFileSize(fileHandle, nullptr);
pBuffer = (unsigned char*) malloc(*size);
DWORD sizeRead = 0;
BOOL successed = FALSE;
successed = ::ReadFile(fileHandle, pBuffer, *size, &sizeRead, NULL);
successed = ::ReadFile(fileHandle, pBuffer, *size, &sizeRead, nullptr);
::CloseHandle(fileHandle);
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
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
#ifndef _DEBUG
@ -287,7 +287,7 @@ string FileUtilsWin32::getWritablePath() const
char app_data_path[CC_MAX_PATH + 1];
// 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);
@ -300,7 +300,7 @@ string FileUtilsWin32::getWritablePath() const
ret += "\\";
// Create directory
if (SUCCEEDED(SHCreateDirectoryExA(NULL, ret.c_str(), NULL)))
if (SUCCEEDED(SHCreateDirectoryExA(nullptr, ret.c_str(), nullptr)))
{
return convertPathFormatToUnixStyle(ret);
}

View File

@ -254,7 +254,7 @@ bool GLProgram::initWithPrecompiledProgramByteArray(const GLchar* vShaderByteArr
haveProgram = CCPrecompiledShaders::getInstance()->loadProgram(_program, vShaderByteArray, fShaderByteArray);
CHECK_GL_ERROR_DEBUG();
_hashForUniforms = NULL;
_hashForUniforms = nullptr;
CHECK_GL_ERROR_DEBUG();
@ -311,7 +311,7 @@ void GLProgram::parseVertexAttribs()
for(int i = 0; i < activeAttributes; ++i)
{
// 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';
attribute.name = std::string(attribName);
@ -343,7 +343,7 @@ void GLProgram::parseUniforms()
for(int i = 0; i < activeUniforms; ++i)
{
// 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';
// 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)
{
glProgram->setUniformLocationWith4fv(uniform->location, (const float*)_matrixPalette, _matrixPaletteSize);
glUniform4fv( uniform->location, (GLsizei)_matrixPaletteSize, (const float*)_matrixPalette );
}
void MeshCommand::preBatchDraw()
@ -183,12 +183,11 @@ void MeshCommand::preBatchDraw()
GL::bindTexture2D(_textureID);
GL::blendFunc(_blendType.src, _blendType.dst);
if (_vao == 0)
if (Configuration::getInstance()->supportsShareableVAO() && _vao == 0)
buildVAO();
if (_vao)
{
GL::bindVAO(_vao);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
}
else
{
@ -265,8 +264,6 @@ void MeshCommand::execute()
void MeshCommand::buildVAO()
{
releaseVAO();
if (Configuration::getInstance()->supportsShareableVAO())
{
glGenVertexArrays(1, &_vao);
GL::bindVAO(_vao);
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
@ -284,11 +281,10 @@ void MeshCommand::buildVAO()
GL::bindVAO(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
}
void MeshCommand::releaseVAO()
{
if (Configuration::getInstance()->supportsShareableVAO() && _vao)
if (_vao)
{
glDeleteVertexArrays(1, &_vao);
_vao = 0;
@ -299,7 +295,7 @@ void MeshCommand::releaseVAO()
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
void MeshCommand::listenRendererRecreated(EventCustom* event)
{
releaseVAO();
_vao = 0;
}
#endif

View File

@ -711,7 +711,7 @@ std::string Texture2D::getDescription() const
// implementation Texture2D (Image)
bool Texture2D::initWithImage(Image *image)
{
return initWithImage(image, PixelFormat::NONE);
return initWithImage(image, g_defaultAlphaPixelFormat);
}
bool Texture2D::initWithImage(Image *image, PixelFormat format)
@ -736,14 +736,14 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format)
unsigned char* tempData = image->getData();
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();
size_t tempDataLen = image->getDataLen();
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");
}
@ -754,7 +754,7 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format)
}
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");
}
@ -764,15 +764,6 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format)
}
else
{
// compute pixel format
if (format != PixelFormat::NONE)
{
pixelFormat = format;
}else
{
pixelFormat = g_defaultAlphaPixelFormat;
}
unsigned char* outTempData = nullptr;
ssize_t outTempDataLen = 0;

View File

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

View File

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

View File

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

View File

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

View File

@ -1211,16 +1211,6 @@
-- @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
-- @field [parent=#cc] Animation3D#Animation3D Animation3D preloaded module
@ -1231,4 +1221,14 @@
-- @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

View File

@ -9245,59 +9245,6 @@ int lua_cocos2dx_Node_setUserObject(lua_State* tolua_S)
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 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,"draw",lua_cocos2dx_Node_draw);
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,"removeFromParent",lua_cocos2dx_Node_removeFromParentAndCleanup);
tolua_function(tolua_S,"setPosition3D",lua_cocos2dx_Node_setPosition3D);
@ -63135,6 +63081,374 @@ int lua_register_cocos2dx_Mesh(lua_State* tolua_S)
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 argc = 0;
@ -64797,466 +65111,6 @@ int lua_register_cocos2dx_ProtectedNode(lua_State* tolua_S)
g_typeCast["ProtectedNode"] = "cc.ProtectedNode";
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_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
{
float arg0 = (float)tolua_tonumber(tolua_S, 1, 0);
glLineWidth((GLfloat)arg0 );
glLineWidth(arg0);
}
return 0;
#ifndef TOLUA_RELEASE
@ -2684,9 +2684,9 @@ static int tolua_Cocos2d_glPolygonOffset00(lua_State* tolua_S)
else
#endif
{
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
glPolygonOffset((GLfloat)arg0 , (GLfloat)arg1 );
float arg0 = (float)tolua_tonumber(tolua_S, 1, 0);
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
glPolygonOffset(arg0, arg1);
}
return 0;
#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 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 );
}
return 0;
@ -3287,8 +3287,8 @@ static int tolua_Cocos2d_glUniform1f00(lua_State* tolua_S)
#endif
{
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
glUniform1f((GLint)arg0 , (GLfloat)arg1 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
glUniform1f(arg0,arg1);
}
return 0;
#ifndef TOLUA_RELEASE
@ -3426,9 +3426,9 @@ static int tolua_Cocos2d_glUniform2f00(lua_State* tolua_S)
#endif
{
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
glUniform2f((GLint)arg0 , (GLfloat)arg1 , (GLfloat)arg2);
float arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
float arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
glUniform2f(arg0, arg1, arg2);
}
return 0;
#ifndef TOLUA_RELEASE
@ -3569,10 +3569,10 @@ static int tolua_Cocos2d_glUniform3f00(lua_State* tolua_S)
#endif
{
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
int arg3 = (int)tolua_tonumber(tolua_S, 4, 0);
glUniform3f((GLint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 , (GLfloat)arg3 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
float arg3 = (float)tolua_tonumber(tolua_S, 4, 0);
glUniform3f(arg0, arg1, arg2, arg3);
}
return 0;
#ifndef TOLUA_RELEASE
@ -3716,11 +3716,11 @@ static int tolua_Cocos2d_glUniform4f00(lua_State* tolua_S)
#endif
{
int arg0 = (int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
int arg3 = (int)tolua_tonumber(tolua_S, 4, 0);
int arg4 = (int)tolua_tonumber(tolua_S, 5, 0);
glUniform4f((GLint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 , (GLfloat)arg3 , (GLfloat)arg4 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
float arg3 = (float)tolua_tonumber(tolua_S, 4, 0);
float arg4 = (float)tolua_tonumber(tolua_S, 5, 0);
glUniform4f(arg0 , arg1, arg2, arg3, arg4);
}
return 0;
#ifndef TOLUA_RELEASE
@ -4042,8 +4042,8 @@ static int tolua_Cocos2d_glVertexAttrib1f00(lua_State* tolua_S)
#endif
{
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
glVertexAttrib1f((GLuint)arg0 , (GLfloat)arg1 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
glVertexAttrib1f(arg0 , arg1);
}
return 0;
#ifndef TOLUA_RELEASE
@ -4113,9 +4113,9 @@ static int tolua_Cocos2d_glVertexAttrib2f00(lua_State* tolua_S)
#endif
{
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
glVertexAttrib2f((GLuint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
glVertexAttrib2f(arg0, arg1, arg2);
}
return 0;
#ifndef TOLUA_RELEASE
@ -4186,10 +4186,10 @@ static int tolua_Cocos2d_glVertexAttrib3f00(lua_State* tolua_S)
#endif
{
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
int arg3 = (int)tolua_tonumber(tolua_S, 4, 0);
glVertexAttrib3f((GLuint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 , (GLfloat)arg3 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
float arg3 = (float)tolua_tonumber(tolua_S, 4, 0);
glVertexAttrib3f(arg0 , arg1, arg2, arg3);
}
return 0;
#ifndef TOLUA_RELEASE
@ -4261,11 +4261,11 @@ static int tolua_Cocos2d_glVertexAttrib4f00(lua_State* tolua_S)
#endif
{
unsigned int arg0 = (unsigned int)tolua_tonumber(tolua_S, 1, 0);
int arg1 = (int)tolua_tonumber(tolua_S, 2, 0);
int arg2 = (int)tolua_tonumber(tolua_S, 3, 0);
int arg3 = (int)tolua_tonumber(tolua_S, 4, 0);
int arg4 = (int)tolua_tonumber(tolua_S, 5, 0);
glVertexAttrib4f((GLuint)arg0 , (GLfloat)arg1 , (GLfloat)arg2 , (GLfloat)arg3 , (GLfloat)arg4 );
float arg1 = (float)tolua_tonumber(tolua_S, 2, 0);
float arg2 = (float)tolua_tonumber(tolua_S, 3, 0);
float arg3 = (float)tolua_tonumber(tolua_S, 4, 0);
float arg4 = (float)tolua_tonumber(tolua_S, 5, 0);
glVertexAttrib4f(arg0, arg1, arg2, arg3, arg4);
}
return 0;
#ifndef TOLUA_RELEASE
@ -5031,10 +5031,10 @@ static int tolua_cocos2d_DrawPrimitives_drawColor4F00(lua_State* tolua_S)
else
#endif
{
unsigned char r = (( unsigned char) tolua_tonumber(tolua_S,1,0));
unsigned char g = (( unsigned char) tolua_tonumber(tolua_S,2,0));
unsigned char b = (( unsigned char) tolua_tonumber(tolua_S,3,0));
unsigned char a = (( unsigned char) tolua_tonumber(tolua_S,4,0));
float r = (float)tolua_tonumber(tolua_S,1,0);
float g = (float)tolua_tonumber(tolua_S,2,0);
float b = (float)tolua_tonumber(tolua_S,3,0);
float a = (float)tolua_tonumber(tolua_S,4,0);
DrawPrimitives::setDrawColor4F(r,g,b,a);
}
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);
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)
{

View File

@ -2215,6 +2215,66 @@ tolua_lerror:
#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)
{
if (NULL == tolua_S)
@ -3920,6 +3980,9 @@ static void extendNode(lua_State* tolua_S)
lua_pushstring(tolua_S, "setAnchorPoint");
lua_pushcfunction(tolua_S, tolua_cocos2d_Node_setAnchorPoint);
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);
}

View File

@ -561,5 +561,13 @@ end
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);";
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_finalize(stmt);
@ -71,15 +71,15 @@ void localStorageInit( const std::string& fullpath/* = "" */)
// SELECT
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
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
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 ) {
printf("Error initializing DB\n");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -59,7 +59,7 @@ Control* Control::create()
else
{
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
* 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.
* See "CCControlEvent" for constants.
*/
@ -320,7 +320,7 @@ bool Control::isHighlighted() const
bool Control::hasVisibleParents() const
{
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() )
{

View File

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

View File

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

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