diff --git a/AUTHORS b/AUTHORS index 5ca95070e5..aa9402cb1c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -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 @@ -906,6 +907,9 @@ Developers: Teivaz Custom uniform search optimization + + chareice + Make `setup.py` work on zsh Retired Core Developers: WenSheng Yang diff --git a/CHANGELOG b/CHANGELOG index f811f77d6e..814fecd67e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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() diff --git a/cocos/2d/CCActionInterval.h b/cocos/2d/CCActionInterval.h index b735a1fb3b..d112f04e1f 100644 --- a/cocos/2d/CCActionInterval.h +++ b/cocos/2d/CCActionInterval.h @@ -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() {} diff --git a/cocos/2d/CCLayer.cpp b/cocos/2d/CCLayer.cpp index 558cbdde19..753f744c88 100644 --- a/cocos/2d/CCLayer.cpp +++ b/cocos/2d/CCLayer.cpp @@ -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() diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 61b3b9d8ce..2a52bd1a2d 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -842,23 +842,13 @@ void Node::enumerateChildren(const std::string &name, std::function 2 && name[0] == '/' && name[1] == '/') { - if (length > 2 && name[1] == '/') - { - searchFromRootRecursive = true; - subStrStartPos = 2; - subStrlength -= 2; - } - else - { - searchFromRoot = true; - subStrStartPos = 1; - subStrlength -= 1; - } + searchRecursively = true; + subStrStartPos = 2; + subStrlength -= 2; } // End with '/..'? @@ -872,7 +862,7 @@ void Node::enumerateChildren(const std::string &name, std::functiondoEnumerate(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) diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 80007d7758..7b26969cea 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -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 * diff --git a/cocos/3d/CCAnimate3D.cpp b/cocos/3d/CCAnimate3D.cpp index 5f13d70cc7..da1e2c6a80 100644 --- a/cocos/3d/CCAnimate3D.cpp +++ b/cocos/3d/CCAnimate3D.cpp @@ -66,12 +66,12 @@ Animate3D* Animate3D::clone() const auto animate = const_cast(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) { } diff --git a/cocos/3d/CCAnimate3D.h b/cocos/3d/CCAnimate3D.h index fbda6328b5..b8011e3946 100644 --- a/cocos/3d/CCAnimate3D.h +++ b/cocos/3d/CCAnimate3D.h @@ -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 _boneCurves; //weak ref }; diff --git a/cocos/3d/CCAnimation3D.cpp b/cocos/3d/CCAnimation3D.cpp index 9455a3e47e..611b130fe1 100644 --- a/cocos/3d/CCAnimation3D.cpp +++ b/cocos/3d/CCAnimation3D.cpp @@ -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; diff --git a/cocos/3d/CCAnimation3D.h b/cocos/3d/CCAnimation3D.h index a6f2a30a96..1d18cf6b0a 100644 --- a/cocos/3d/CCAnimation3D.h +++ b/cocos/3d/CCAnimation3D.h @@ -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; } diff --git a/cocos/3d/CCBundle3D.cpp b/cocos/3d/CCBundle3D.cpp index 754aa67f60..991aaec32d 100644 --- a/cocos/3d/CCBundle3D.cpp +++ b/cocos/3d/CCBundle3D.cpp @@ -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,20 +462,23 @@ bool Bundle3D::loadBinary(const std::string& path) // Read version unsigned char ver[2]; - if (_binaryReader.read(ver, 1, 2) == 2) - { - if (ver[0] != 0) { - clear(); - CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]); - return false; - } - - if (ver[1] <= 0 || ver[1] > 2) { - clear(); - CCLOGINFO(false, "Unsupported version: (%d, %d)", ver[0], ver[1]); - return false; - } + 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]); + return false; + } + + if (ver[1] <= 0 || ver[1] > 2) { + clear(); + 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; } } diff --git a/cocos/3d/CCBundleReader.cpp b/cocos/3d/CCBundleReader.cpp index 2bdeda2c43..b3974b07f5 100644 --- a/cocos/3d/CCBundleReader.cpp +++ b/cocos/3d/CCBundleReader.cpp @@ -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; diff --git a/cocos/3d/CCBundleReader.h b/cocos/3d/CCBundleReader.h index b991412d8f..4efc71f368 100644 --- a/cocos/3d/CCBundleReader.h +++ b/cocos/3d/CCBundleReader.h @@ -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 *values { return false; } + if (*length > 0 && values) { values->resize(*length); diff --git a/cocos/3d/CCMesh.cpp b/cocos/3d/CCMesh.cpp index c6b46bbef4..c0511afad1 100644 --- a/cocos/3d/CCMesh.cpp +++ b/cocos/3d/CCMesh.cpp @@ -125,7 +125,7 @@ bool RenderMeshData::init(const std::vector& positions, return true; } -bool RenderMeshData::init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount) +bool RenderMeshData::init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs) { _vertexs = vertices; _indices = indices; @@ -174,10 +174,10 @@ Mesh* Mesh::create(const std::vector& positions, const std::vector return nullptr; } -Mesh* Mesh::create(const std::vector &vertices, int vertexSizeInFloat, const std::vector &indices, int numIndex, const std::vector &attribs, int attribCount) +Mesh* Mesh::create(const std::vector &vertices, int vertexSizeInFloat, const std::vector &indices, const std::vector &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& positions, const std::vector& n if (!bRet) return false; - restore(); + buildBuffer(); return true; } -bool Mesh::init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount) +bool Mesh::init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& 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(); } diff --git a/cocos/3d/CCMesh.h b/cocos/3d/CCMesh.h index c65caa5991..eb6a959286 100644 --- a/cocos/3d/CCMesh.h +++ b/cocos/3d/CCMesh.h @@ -49,7 +49,7 @@ public: } bool hasVertexAttrib(int attrib); bool init(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices); - bool init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount); + bool init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs); protected: @@ -90,7 +90,10 @@ public: static Mesh* create(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices); /**create mesh with vertex attributes*/ - static Mesh* create(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount); + CC_DEPRECATED_ATTRIBUTE static Mesh* create(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount) { return create(vertices, vertexSizeInFloat, indices, attribs); } + + /**create mesh with vertex attributes*/ + static Mesh* create(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs); /**get vertex buffer*/ inline GLuint getVertexBuffer() const { return _vertexBuffer; } @@ -124,7 +127,7 @@ CC_CONSTRUCTOR_ACCESS: bool init(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices); /**init mesh*/ - bool init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount); + bool init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs); /**build buffer*/ void buildBuffer(); diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp index f92e4dc475..a1244d2efb 100644 --- a/cocos/3d/CCSprite3D.cpp +++ b/cocos/3d/CCSprite3D.cpp @@ -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 diff --git a/cocos/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index 744d31ac80..e06185654c 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -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, ©_set, NULL, NULL, &timeout_copy); + int nready = select(_maxfd+1, ©_set, nullptr, nullptr, &timeout_copy); if( nready == -1 ) { diff --git a/cocos/base/CCController-iOS.mm b/cocos/base/CCController-iOS.mm index 26f83d4d64..e53f85bccf 100644 --- a/cocos/base/CCController-iOS.mm +++ b/cocos/base/CCController-iOS.mm @@ -114,8 +114,6 @@ public: GCController* _gcController; }; -std::vector Controller::s_allController; - void Controller::startDiscoveryController() { [GCController startWirelessControllerDiscoveryWithCompletionHandler: nil]; diff --git a/cocos/base/CCEventDispatcher.cpp b/cocos/base/CCEventDispatcher.cpp index f45200fe6e..5c5fc374b6 100644 --- a/cocos/base/CCEventDispatcher.cpp +++ b/cocos/base/CCEventDispatcher.cpp @@ -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) diff --git a/cocos/base/CCEventMouse.cpp b/cocos/base/CCEventMouse.cpp index c1013d4d26..447862de49 100644 --- a/cocos/base/CCEventMouse.cpp +++ b/cocos/base/CCEventMouse.cpp @@ -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) diff --git a/cocos/base/CCRef.cpp b/cocos/base/CCRef.cpp index 140bde422b..747b08ccdf 100644 --- a/cocos/base/CCRef.cpp +++ b/cocos/base/CCRef.cpp @@ -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); } diff --git a/cocos/base/TGAlib.cpp b/cocos/base/TGAlib.cpp index 5c097f6c46..16462d5a60 100644 --- a/cocos/base/TGAlib.cpp +++ b/cocos/base/TGAlib.cpp @@ -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; diff --git a/cocos/cocos2d.h b/cocos/cocos2d.h index 1e795488b2..56fab797a8 100644 --- a/cocos/cocos2d.h +++ b/cocos/cocos2d.h @@ -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" diff --git a/cocos/deprecated/CCDeprecated.h b/cocos/deprecated/CCDeprecated.h index 685a47fc4b..b1837b6d17 100644 --- a/cocos/deprecated/CCDeprecated.h +++ b/cocos/deprecated/CCDeprecated.h @@ -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; diff --git a/cocos/deprecated/CCDictionary.cpp b/cocos/deprecated/CCDictionary.cpp index 96ae7dcc7a..23919b6daf 100644 --- a/cocos/deprecated/CCDictionary.cpp +++ b/cocos/deprecated/CCDictionary.cpp @@ -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) diff --git a/cocos/deprecated/CCSet.cpp b/cocos/deprecated/CCSet.cpp index 081b7a5de6..28c1d9bedb 100644 --- a/cocos/deprecated/CCSet.cpp +++ b/cocos/deprecated/CCSet.cpp @@ -66,7 +66,7 @@ __Set * __Set::create() { __Set * pRet = new __Set(); - if (pRet != NULL) + if (pRet != nullptr) { pRet->autorelease(); } diff --git a/cocos/deprecated/CCString.cpp b/cocos/deprecated/CCString.cpp index 8492573d70..06bf28d7de 100644 --- a/cocos/deprecated/CCString.cpp +++ b/cocos/deprecated/CCString.cpp @@ -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(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) diff --git a/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp b/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp index ba20f8fd13..7cd0f56cf4 100644 --- a/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp @@ -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 { diff --git a/cocos/editor-support/cocosbuilder/CCMenuItemImageLoader.cpp b/cocos/editor-support/cocosbuilder/CCMenuItemImageLoader.cpp index 21bb3b0b6b..cd093fdb59 100644 --- a/cocos/editor-support/cocosbuilder/CCMenuItemImageLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCMenuItemImageLoader.cpp @@ -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 { diff --git a/cocos/editor-support/cocosbuilder/CCMenuItemLoader.cpp b/cocos/editor-support/cocosbuilder/CCMenuItemLoader.cpp index 1388c3f4ef..6afd3304e2 100644 --- a/cocos/editor-support/cocosbuilder/CCMenuItemLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCMenuItemLoader.cpp @@ -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); diff --git a/cocos/editor-support/cocosbuilder/CCNodeLoader.cpp b/cocos/editor-support/cocosbuilder/CCNodeLoader.cpp index f97adba07f..fd8b7a9765 100644 --- a/cocos/editor-support/cocosbuilder/CCNodeLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCNodeLoader.cpp @@ -71,7 +71,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * ccbRe // #endif // Forward properties for sub ccb files - if (dynamic_cast(pNode) != NULL) + if (dynamic_cast(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(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(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 diff --git a/cocos/editor-support/cocosbuilder/CCNodeLoaderLibrary.cpp b/cocos/editor-support/cocosbuilder/CCNodeLoaderLibrary.cpp index ff497635e0..339058bce8 100644 --- a/cocos/editor-support/cocosbuilder/CCNodeLoaderLibrary.cpp +++ b/cocos/editor-support/cocosbuilder/CCNodeLoaderLibrary.cpp @@ -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(); diff --git a/cocos/editor-support/cocosbuilder/CCSpriteLoader.cpp b/cocos/editor-support/cocosbuilder/CCSpriteLoader.cpp index 0194ffd6b2..ab6df19a96 100644 --- a/cocos/editor-support/cocosbuilder/CCSpriteLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCSpriteLoader.cpp @@ -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); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp index 7ec73711d8..4c123c2f30 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp @@ -278,8 +278,8 @@ void ActionTimeline::emitFrameEvent(Frame* frame) void ActionTimeline::gotoFrame(int frameIndex) { - int size = _timelineList.size(); - for(int i = 0; igotoFrame(frameIndex); } @@ -287,8 +287,8 @@ void ActionTimeline::gotoFrame(int frameIndex) void ActionTimeline::stepToFrame(int frameIndex) { - int size = _timelineList.size(); - for(int i = 0; istepToFrame(frameIndex); } diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp index 657db83656..5ccc31f8d9 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp @@ -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); } diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp index 3078dcd54a..6d180fc4e2 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCNodeReader.cpp @@ -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); } diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp index 7516cbc255..c9f04cc985 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp @@ -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; diff --git a/cocos/editor-support/cocostudio/CCArmature.cpp b/cocos/editor-support/cocostudio/CCArmature.cpp index c7a465485c..d385cc1f4c 100644 --- a/cocos/editor-support/cocostudio/CCArmature.cpp +++ b/cocos/editor-support/cocostudio/CCArmature.cpp @@ -402,9 +402,9 @@ void Armature::draw(cocos2d::Renderer *renderer, const Mat4 &transform, uint32_t Skin *skin = static_cast(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()); } diff --git a/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp b/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp index 64ca8917b9..88be54e2cb 100644 --- a/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp +++ b/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp @@ -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); } diff --git a/cocos/editor-support/cocostudio/CCSGUIReader.cpp b/cocos/editor-support/cocostudio/CCSGUIReader.cpp index 9204b255de..7221c51809 100644 --- a/cocos/editor-support/cocostudio/CCSGUIReader.cpp +++ b/cocos/editor-support/cocostudio/CCSGUIReader.cpp @@ -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(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(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(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); diff --git a/cocos/editor-support/cocostudio/CCSSceneReader.cpp b/cocos/editor-support/cocostudio/CCSSceneReader.cpp index c6ca142de4..92177e9284 100644 --- a/cocos/editor-support/cocostudio/CCSSceneReader.cpp +++ b/cocos/editor-support/cocostudio/CCSSceneReader.cpp @@ -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") { diff --git a/cocos/editor-support/cocostudio/CocoLoader.cpp b/cocos/editor-support/cocostudio/CocoLoader.cpp index 8a0aeced5b..38e0fb1d2f 100644 --- a/cocos/editor-support/cocostudio/CocoLoader.cpp +++ b/cocos/editor-support/cocostudio/CocoLoader.cpp @@ -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() diff --git a/cocos/editor-support/cocostudio/TriggerMng.cpp b/cocos/editor-support/cocostudio/TriggerMng.cpp index 5e90a13d71..779b5dca86 100755 --- a/cocos/editor-support/cocostudio/TriggerMng.cpp +++ b/cocos/editor-support/cocostudio/TriggerMng.cpp @@ -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); } diff --git a/cocos/editor-support/cocostudio/TriggerObj.cpp b/cocos/editor-support/cocostudio/TriggerObj.cpp index 444780de5e..7fec68a848 100755 --- a/cocos/editor-support/cocostudio/TriggerObj.cpp +++ b/cocos/editor-support/cocostudio/TriggerObj.cpp @@ -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(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); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp index c96a1dfbe7..0587e91454 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp @@ -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); diff --git a/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp index 691097d1eb..85a6775411 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp @@ -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) diff --git a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp index 4e8be4ac45..2558a17d85 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp @@ -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); diff --git a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp index 155e41d523..42c504a1d2 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp @@ -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) diff --git a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp index 0870898954..89e5c72344 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp @@ -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) diff --git a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp index 3c09400c96..f283ac4c56 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp @@ -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)); /**/ diff --git a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp index a4531be2e8..e15cd2b52f 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp @@ -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); diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp index b4ff2c7561..45fccfda69 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp @@ -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) diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp index 99c6f3735a..a13dffde8a 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp @@ -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) diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp index 5d844a5cff..117a4d3216 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp @@ -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"; diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp index 9f8ff87c42..786856e408 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextReader/TextReader.cpp @@ -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) diff --git a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp index 01652acff0..f68f2af107 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp @@ -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); diff --git a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.h b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.h index 319b525190..ca62aab066 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.h @@ -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(); \ diff --git a/cocos/math/Mat4.cpp b/cocos/math/Mat4.cpp index cd6217f1ad..ff598d3da8 100644 --- a/cocos/math/Mat4.cpp +++ b/cocos/math/Mat4.cpp @@ -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 diff --git a/cocos/network/SocketIO.cpp b/cocos/network/SocketIO.cpp index 0afb564976..ac36095145 100644 --- a/cocos/network/SocketIO.cpp +++ b/cocos/network/SocketIO.cpp @@ -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); diff --git a/cocos/network/WebSocket.cpp b/cocos/network/WebSocket.cpp index 4035af022d..e0729b7f98 100644 --- a/cocos/network/WebSocket.cpp +++ b/cocos/network/WebSocket.cpp @@ -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; diff --git a/cocos/platform/desktop/CCGLView.cpp b/cocos/platform/desktop/CCGLView.cpp index 702244a29e..a934875204 100644 --- a/cocos/platform/desktop/CCGLView.cpp +++ b/cocos/platform/desktop/CCGLView.cpp @@ -564,20 +564,22 @@ 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); } @@ -605,10 +607,26 @@ void GLView::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y) intptr_t id = 0; this->handleTouchesMove(1, &id, &_mouseX, &_mouseY); } + + //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; 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); + // 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"); diff --git a/cocos/platform/ios/CCEAGLView.mm b/cocos/platform/ios/CCEAGLView.mm index af72e0b787..fcbddd02e7 100644 --- a/cocos/platform/ios/CCEAGLView.mm +++ b/cocos/platform/ios/CCEAGLView.mm @@ -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}; diff --git a/cocos/platform/win32/CCApplication.cpp b/cocos/platform/win32/CCApplication.cpp index 2afa94595b..1192732492 100644 --- a/cocos/platform/win32/CCApplication.cpp +++ b/cocos/platform/win32/CCApplication.cpp @@ -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 diff --git a/cocos/platform/win32/CCCommon.cpp b/cocos/platform/win32/CCCommon.cpp index a95ed75d00..a1e2319055 100644 --- a/cocos/platform/win32/CCCommon.cpp +++ b/cocos/platform/win32/CCCommon.cpp @@ -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; diff --git a/cocos/platform/win32/CCDevice.cpp b/cocos/platform/win32/CCDevice.cpp index ab9b3e489b..778b58aaa7 100644 --- a/cocos/platform/win32/CCDevice.cpp +++ b/cocos/platform/win32/CCDevice.cpp @@ -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; diff --git a/cocos/platform/win32/CCFileUtilsWin32.cpp b/cocos/platform/win32/CCFileUtilsWin32.cpp index 2d036c5dfc..a652850879 100644 --- a/cocos/platform/win32/CCFileUtilsWin32.cpp +++ b/cocos/platform/win32/CCFileUtilsWin32.cpp @@ -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); } diff --git a/cocos/renderer/CCGLProgram.cpp b/cocos/renderer/CCGLProgram.cpp index d5b492e941..7533d991be 100644 --- a/cocos/renderer/CCGLProgram.cpp +++ b/cocos/renderer/CCGLProgram.cpp @@ -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. diff --git a/cocos/renderer/CCMeshCommand.cpp b/cocos/renderer/CCMeshCommand.cpp index b47be15d73..e37e607cb6 100644 --- a/cocos/renderer/CCMeshCommand.cpp +++ b/cocos/renderer/CCMeshCommand.cpp @@ -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,30 +264,27 @@ void MeshCommand::execute() void MeshCommand::buildVAO() { releaseVAO(); - if (Configuration::getInstance()->supportsShareableVAO()) - { - glGenVertexArrays(1, &_vao); - GL::bindVAO(_vao); - glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); - auto flags = _glProgramState->getVertexAttribsFlags(); - for (int i = 0; flags > 0; i++) { - int flag = 1 << i; - if (flag & flags) - glEnableVertexAttribArray(i); - flags &= ~flag; - } - _glProgramState->applyAttributes(false); - - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer); - - GL::bindVAO(0); - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glGenVertexArrays(1, &_vao); + GL::bindVAO(_vao); + glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); + auto flags = _glProgramState->getVertexAttribsFlags(); + for (int i = 0; flags > 0; i++) { + int flag = 1 << i; + if (flag & flags) + glEnableVertexAttribArray(i); + flags &= ~flag; } + _glProgramState->applyAttributes(false); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer); + + 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 diff --git a/cocos/renderer/CCTexture2D.cpp b/cocos/renderer/CCTexture2D.cpp index 571edffa06..e41a610dd5 100644 --- a/cocos/renderer/CCTexture2D.cpp +++ b/cocos/renderer/CCTexture2D.cpp @@ -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; diff --git a/cocos/renderer/ccShader_3D_PositionTex.vert b/cocos/renderer/ccShader_3D_PositionTex.vert index 95af35228c..92a359922b 100644 --- a/cocos/renderer/ccShader_3D_PositionTex.vert +++ b/cocos/renderer/ccShader_3D_PositionTex.vert @@ -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; } diff --git a/cocos/scripting/lua-bindings/auto/api/Animate3D.lua b/cocos/scripting/lua-bindings/auto/api/Animate3D.lua index ce1be4d011..4657cc4cb8 100644 --- a/cocos/scripting/lua-bindings/auto/api/Animate3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/Animate3D.lua @@ -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 diff --git a/cocos/scripting/lua-bindings/auto/api/Animation3D.lua b/cocos/scripting/lua-bindings/auto/api/Animation3D.lua index 8fa94f84ef..7eacf8e403 100644 --- a/cocos/scripting/lua-bindings/auto/api/Animation3D.lua +++ b/cocos/scripting/lua-bindings/auto/api/Animation3D.lua @@ -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 diff --git a/cocos/scripting/lua-bindings/auto/api/Node.lua b/cocos/scripting/lua-bindings/auto/api/Node.lua index 61e80c160e..846ddc9af9 100644 --- a/cocos/scripting/lua-bindings/auto/api/Node.lua +++ b/cocos/scripting/lua-bindings/auto/api/Node.lua @@ -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 diff --git a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua index 63856c59c7..1e6649afb8 100644 --- a/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua +++ b/cocos/scripting/lua-bindings/auto/api/lua_cocos2dx_auto_api.lua @@ -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 diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index a39fcf6c5a..3a95708463 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -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 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(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(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(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(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret); + return 1; + } + } while (0); + ok = true; + do + { + if (argc == 1) + { + cocos2d::Animation3D* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.Animation3D",&arg0); + if (!ok) { break; } + cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0); + object_to_luaval(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(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(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(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(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret); - return 1; - } - } while (0); - ok = true; - do - { - if (argc == 1) - { - cocos2d::Animation3D* arg0; - ok &= luaval_to_object(tolua_S, 2, "cc.Animation3D",&arg0); - if (!ok) { break; } - cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0); - object_to_luaval(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); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index 6c0de0b61b..a2d480bf97 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -1570,9 +1570,6 @@ int register_all_cocos2dx(lua_State* tolua_S); - - - diff --git a/cocos/scripting/lua-bindings/manual/LuaOpengl.cpp b/cocos/scripting/lua-bindings/manual/LuaOpengl.cpp index 2b5aba203b..8d7e5c100b 100644 --- a/cocos/scripting/lua-bindings/manual/LuaOpengl.cpp +++ b/cocos/scripting/lua-bindings/manual/LuaOpengl.cpp @@ -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; diff --git a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_coco_studio_manual.cpp b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_coco_studio_manual.cpp index a16eec37f0..5291ac5a92 100644 --- a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_coco_studio_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_coco_studio_manual.cpp @@ -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) { diff --git a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp index 518658a019..098ec2717b 100644 --- a/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/lua_cocos2dx_manual.cpp @@ -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); } diff --git a/cocos/scripting/lua-bindings/script/Cocos2dConstants.lua b/cocos/scripting/lua-bindings/script/Cocos2dConstants.lua index 059cccc32c..85279e9c30 100644 --- a/cocos/scripting/lua-bindings/script/Cocos2dConstants.lua +++ b/cocos/scripting/lua-bindings/script/Cocos2dConstants.lua @@ -561,5 +561,13 @@ end cc.KeyCode.KEY_BACK = cc.KeyCode.KEY_ESCAPE +cc.EventCode = +{ + BEGAN = 0, + MOVED = 1, + ENDED = 2, + CANCELLED = 3, +} + diff --git a/cocos/storage/local-storage/LocalStorage.cpp b/cocos/storage/local-storage/LocalStorage.cpp index 3c485fa226..f925b12d71 100644 --- a/cocos/storage/local-storage/LocalStorage.cpp +++ b/cocos/storage/local-storage/LocalStorage.cpp @@ -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"); diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index 39718575f3..6cfdbecc86 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -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; diff --git a/cocos/ui/UICheckBox.cpp b/cocos/ui/UICheckBox.cpp index 47b4e040bb..4ddb8799ab 100644 --- a/cocos/ui/UICheckBox.cpp +++ b/cocos/ui/UICheckBox.cpp @@ -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; } diff --git a/cocos/ui/UICheckBox.h b/cocos/ui/UICheckBox.h index 05c77d836b..b1b6a28177 100644 --- a/cocos/ui/UICheckBox.h +++ b/cocos/ui/UICheckBox.h @@ -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) /** diff --git a/cocos/ui/UIImageView.cpp b/cocos/ui/UIImageView.cpp index cfc5d76d62..6f3471e0b7 100644 --- a/cocos/ui/UIImageView.cpp +++ b/cocos/ui/UIImageView.cpp @@ -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; diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index cf3f8acc7d..7064ec73d5 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -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 { diff --git a/cocos/ui/UIListView.h b/cocos/ui/UIListView.h index 42a4d5050d..2409bd3763 100644 --- a/cocos/ui/UIListView.h +++ b/cocos/ui/UIListView.h @@ -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 diff --git a/cocos/ui/UILoadingBar.cpp b/cocos/ui/UILoadingBar.cpp index 6cc2f658f0..6e7e34415d 100644 --- a/cocos/ui/UILoadingBar.cpp +++ b/cocos/ui/UILoadingBar.cpp @@ -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(); diff --git a/cocos/ui/UIPageView.h b/cocos/ui/UIPageView.h index f3544f0a47..70c764ee6a 100644 --- a/cocos/ui/UIPageView.h +++ b/cocos/ui/UIPageView.h @@ -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 diff --git a/cocos/ui/UIRichText.cpp b/cocos/ui/UIRichText.cpp index 1f4050039f..6bff82c007 100644 --- a/cocos/ui/UIRichText.cpp +++ b/cocos/ui/UIRichText.cpp @@ -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: diff --git a/cocos/ui/UIScrollView.h b/cocos/ui/UIScrollView.h index 39ec4dc8bd..c02d68fd1e 100644 --- a/cocos/ui/UIScrollView.h +++ b/cocos/ui/UIScrollView.h @@ -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) diff --git a/cocos/ui/UISlider.cpp b/cocos/ui/UISlider.cpp index 38b5bf678c..642749d540 100644 --- a/cocos/ui/UISlider.cpp +++ b/cocos/ui/UISlider.cpp @@ -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) diff --git a/cocos/ui/UISlider.h b/cocos/ui/UISlider.h index 451cd6ca2c..f8a711dcf1 100644 --- a/cocos/ui/UISlider.h +++ b/cocos/ui/UISlider.h @@ -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) /** diff --git a/cocos/ui/UITextBMFont.cpp b/cocos/ui/UITextBMFont.cpp index 52187ecda1..02ad64ea84 100644 --- a/cocos/ui/UITextBMFont.cpp +++ b/cocos/ui/UITextBMFont.cpp @@ -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); } diff --git a/cocos/ui/UITextField.cpp b/cocos/ui/UITextField.cpp index 90b65063ca..7d6cf660f7 100644 --- a/cocos/ui/UITextField.cpp +++ b/cocos/ui/UITextField.cpp @@ -584,6 +584,8 @@ bool TextField::onTouchBegan(Touch *touch, Event *unusedEvent) if (_hitted) { _textFieldRenderer->attachWithIME(); + } else { + this->didNotSelectSelf(); } return pass; } diff --git a/cocos/ui/UITextField.h b/cocos/ui/UITextField.h index b343ed4a7d..cc7ef355a8 100644 --- a/cocos/ui/UITextField.h +++ b/cocos/ui/UITextField.h @@ -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 diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index a0cc42b27a..935d6f8628 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -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) diff --git a/extensions/GUI/CCControlExtension/CCControl.cpp b/extensions/GUI/CCControlExtension/CCControl.cpp index 128443fa5f..3975d514e0 100644 --- a/extensions/GUI/CCControlExtension/CCControl.cpp +++ b/extensions/GUI/CCControlExtension/CCControl.cpp @@ -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() ) { diff --git a/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp b/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp index 6d342e7946..19978cfd65 100644 --- a/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlColourPicker.cpp @@ -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); } diff --git a/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp b/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp index 9850aacff8..96721a80b6 100644 --- a/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp @@ -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); } diff --git a/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp b/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp index 13698bcbdf..b77cfeb9e8 100644 --- a/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp +++ b/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp @@ -48,7 +48,7 @@ ControlPotentiometer::~ControlPotentiometer() ControlPotentiometer* ControlPotentiometer::create(const char* backgroundFile, const char* progressFile, const char* thumbFile) { ControlPotentiometer* pRet = new ControlPotentiometer(); - if (pRet != NULL) + if (pRet != nullptr) { // Prepare track for potentiometer Sprite *backgroundSprite = Sprite::create(backgroundFile); @@ -97,7 +97,7 @@ bool ControlPotentiometer::initWithTrackSprite_ProgressTimer_ThumbSprite(Sprite* void ControlPotentiometer::setEnabled(bool enabled) { Control::setEnabled(enabled); - if (_thumbSprite != NULL) + if (_thumbSprite != nullptr) { _thumbSprite->setOpacity((enabled) ? 255 : 128); } diff --git a/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp b/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp index d23eba4ab2..ade1f462d4 100644 --- a/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp @@ -50,10 +50,10 @@ ControlSaturationBrightnessPicker::~ControlSaturationBrightnessPicker() { removeAllChildrenWithCleanup(true); - _background = NULL; - _overlay = NULL; - _shadow = NULL; - _slider = NULL; + _background = nullptr; + _overlay = nullptr; + _shadow = nullptr; + _slider = nullptr; } bool ControlSaturationBrightnessPicker::initWithTargetAndPos(Node* target, Vec2 pos) @@ -88,7 +88,7 @@ ControlSaturationBrightnessPicker* ControlSaturationBrightnessPicker::create(Nod void ControlSaturationBrightnessPicker::setEnabled(bool enabled) { Control::setEnabled(enabled); - if (_slider != NULL) + if (_slider != nullptr) { _slider->setOpacity(enabled ? 255 : 128); } diff --git a/extensions/GUI/CCControlExtension/CCControlSlider.cpp b/extensions/GUI/CCControlExtension/CCControlSlider.cpp index 42cf2dae6a..4e64f1e462 100644 --- a/extensions/GUI/CCControlExtension/CCControlSlider.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSlider.cpp @@ -169,7 +169,7 @@ bool ControlSlider::initWithSprites(Sprite * backgroundSprite, Sprite* progressS void ControlSlider::setEnabled(bool enabled) { Control::setEnabled(enabled); - if (_thumbSprite != NULL) + if (_thumbSprite != nullptr) { _thumbSprite->setOpacity((enabled) ? 255 : 128); } @@ -271,8 +271,8 @@ void ControlSlider::onTouchEnded(Touch *pTouch, Event *pEvent) void ControlSlider::needsLayout() { - if (NULL == _thumbSprite || NULL == _selectedThumbSprite || NULL == _backgroundSprite - || NULL == _progressSprite) + if (nullptr == _thumbSprite || nullptr == _selectedThumbSprite || nullptr == _backgroundSprite + || nullptr == _progressSprite) { return; } diff --git a/extensions/GUI/CCControlExtension/CCControlStepper.cpp b/extensions/GUI/CCControlExtension/CCControlStepper.cpp index f96d27496d..dfb3a86564 100644 --- a/extensions/GUI/CCControlExtension/CCControlStepper.cpp +++ b/extensions/GUI/CCControlExtension/CCControlStepper.cpp @@ -118,7 +118,7 @@ bool ControlStepper::initWithMinusSpriteAndPlusSprite(Sprite *minusSprite, Sprit ControlStepper* ControlStepper::create(Sprite *minusSprite, Sprite *plusSprite) { ControlStepper* pRet = new ControlStepper(); - if (pRet != NULL && pRet->initWithMinusSpriteAndPlusSprite(minusSprite, plusSprite)) + if (pRet != nullptr && pRet->initWithMinusSpriteAndPlusSprite(minusSprite, plusSprite)) { pRet->autorelease(); } diff --git a/extensions/GUI/CCControlExtension/CCControlSwitch.cpp b/extensions/GUI/CCControlExtension/CCControlSwitch.cpp index d8b73a587e..3f3aad0743 100644 --- a/extensions/GUI/CCControlExtension/CCControlSwitch.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSwitch.cpp @@ -291,13 +291,13 @@ ControlSwitch::~ControlSwitch() bool ControlSwitch::initWithMaskSprite(Sprite *maskSprite, Sprite * onSprite, Sprite * offSprite, Sprite * thumbSprite) { - return initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, NULL, NULL); + return initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, nullptr, nullptr); } ControlSwitch* ControlSwitch::create(Sprite *maskSprite, Sprite * onSprite, Sprite * offSprite, Sprite * thumbSprite) { ControlSwitch* pRet = new ControlSwitch(); - if (pRet && pRet->initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, NULL, NULL)) + if (pRet && pRet->initWithMaskSprite(maskSprite, onSprite, offSprite, thumbSprite, nullptr, nullptr)) { pRet->autorelease(); } @@ -382,7 +382,7 @@ void ControlSwitch::setOn(bool isOn, bool animated) void ControlSwitch::setEnabled(bool enabled) { _enabled = enabled; - if (_switchSprite != NULL) + if (_switchSprite != nullptr) { _switchSprite->setOpacity((enabled) ? 255 : 128); } diff --git a/extensions/GUI/CCControlExtension/CCControlUtils.cpp b/extensions/GUI/CCControlExtension/CCControlUtils.cpp index 414e43bd86..f2c868d20c 100644 --- a/extensions/GUI/CCControlExtension/CCControlUtils.cpp +++ b/extensions/GUI/CCControlExtension/CCControlUtils.cpp @@ -31,7 +31,7 @@ Sprite* ControlUtils::addSpriteToTargetWithPosAndAnchor(const char* spriteName, Sprite *sprite =Sprite::createWithSpriteFrameName(spriteName); if (!sprite) - return NULL; + return nullptr; sprite->setPosition(pos); sprite->setAnchorPoint(anchor); diff --git a/extensions/GUI/CCControlExtension/CCInvocation.cpp b/extensions/GUI/CCControlExtension/CCInvocation.cpp index a93429303e..f105392831 100644 --- a/extensions/GUI/CCControlExtension/CCInvocation.cpp +++ b/extensions/GUI/CCControlExtension/CCInvocation.cpp @@ -31,7 +31,7 @@ NS_CC_EXT_BEGIN Invocation* Invocation::create(Ref* target, Control::Handler action, Control::EventType controlEvent) { Invocation* pRet = new Invocation(target, action, controlEvent); - if (pRet != NULL) + if (pRet != nullptr) { pRet->autorelease(); } diff --git a/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp b/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp index 43664de763..8d55e46003 100644 --- a/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp +++ b/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp @@ -71,7 +71,7 @@ Scale9Sprite::~Scale9Sprite() bool Scale9Sprite::init() { - return this->initWithBatchNode(NULL, Rect::ZERO, Rect::ZERO); + return this->initWithBatchNode(nullptr, Rect::ZERO, Rect::ZERO); } bool Scale9Sprite::initWithBatchNode(SpriteBatchNode* batchnode, const Rect& rect, const Rect& capInsets) @@ -389,13 +389,13 @@ void Scale9Sprite::setContentSize(const Size &size) void Scale9Sprite::updatePositions() { - // Check that instances are non-NULL + // Check that instances are non-nullptr if(!((_topLeft) && (_topRight) && (_bottomRight) && (_bottomLeft) && (_centre))) { - // if any of the above sprites are NULL, return + // if any of the above sprites are nullptr, return return; } @@ -462,7 +462,7 @@ Scale9Sprite* Scale9Sprite::create(const std::string& file, const Rect& rect, c return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } bool Scale9Sprite::initWithFile(const std::string& file, const Rect& rect) @@ -480,7 +480,7 @@ Scale9Sprite* Scale9Sprite::create(const std::string& file, const Rect& rect) return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } @@ -499,7 +499,7 @@ Scale9Sprite* Scale9Sprite::create(const Rect& capInsets, const std::string& fil return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } bool Scale9Sprite::initWithFile(const std::string& file) @@ -518,16 +518,16 @@ Scale9Sprite* Scale9Sprite::create(const std::string& file) return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } bool Scale9Sprite::initWithSpriteFrame(SpriteFrame* spriteFrame, const Rect& capInsets) { Texture2D* texture = spriteFrame->getTexture(); - CCASSERT(texture != NULL, "CCTexture must be not nil"); + CCASSERT(texture != nullptr, "CCTexture must be not nil"); SpriteBatchNode *batchnode = SpriteBatchNode::createWithTexture(texture, 9); - CCASSERT(batchnode != NULL, "CCSpriteBatchNode must be not nil"); + CCASSERT(batchnode != nullptr, "CCSpriteBatchNode must be not nil"); bool pReturn = this->initWithBatchNode(batchnode, spriteFrame->getRect(), spriteFrame->isRotated(), capInsets); return pReturn; @@ -542,11 +542,11 @@ Scale9Sprite* Scale9Sprite::createWithSpriteFrame(SpriteFrame* spriteFrame, cons return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } bool Scale9Sprite::initWithSpriteFrame(SpriteFrame* spriteFrame) { - CCASSERT(spriteFrame != NULL, "Invalid spriteFrame for sprite"); + CCASSERT(spriteFrame != nullptr, "Invalid spriteFrame for sprite"); bool pReturn = this->initWithSpriteFrame(spriteFrame, Rect::ZERO); return pReturn; } @@ -560,17 +560,17 @@ Scale9Sprite* Scale9Sprite::createWithSpriteFrame(SpriteFrame* spriteFrame) return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } bool Scale9Sprite::initWithSpriteFrameName(const std::string& spriteFrameName, const Rect& capInsets) { - CCASSERT((SpriteFrameCache::getInstance()) != NULL, "SpriteFrameCache::getInstance() must be non-NULL"); + CCASSERT((SpriteFrameCache::getInstance()) != nullptr, "SpriteFrameCache::getInstance() must be non-nullptr"); SpriteFrame *frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName); - CCASSERT(frame != NULL, "CCSpriteFrame must be non-NULL"); + CCASSERT(frame != nullptr, "CCSpriteFrame must be non-nullptr"); - if (NULL == frame) return false; + if (nullptr == frame) return false; bool pReturn = this->initWithSpriteFrame(frame, capInsets); return pReturn; @@ -585,7 +585,7 @@ Scale9Sprite* Scale9Sprite::createWithSpriteFrameName(const std::string& spriteF return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } bool Scale9Sprite::initWithSpriteFrameName(const std::string& spriteFrameName) @@ -605,7 +605,7 @@ Scale9Sprite* Scale9Sprite::createWithSpriteFrameName(const std::string& spriteF CC_SAFE_DELETE(pReturn); log("Could not allocate Scale9Sprite()"); - return NULL; + return nullptr; } @@ -618,7 +618,7 @@ Scale9Sprite* Scale9Sprite::resizableSpriteWithCapInsets(const Rect& capInsets) return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } Scale9Sprite* Scale9Sprite::create() @@ -630,7 +630,7 @@ Scale9Sprite* Scale9Sprite::create() return pReturn; } CC_SAFE_DELETE(pReturn); - return NULL; + return nullptr; } /** sets the opacity. diff --git a/extensions/GUI/CCEditBox/CCEditBox.cpp b/extensions/GUI/CCEditBox/CCEditBox.cpp index ceea82382d..97c34951c7 100644 --- a/extensions/GUI/CCEditBox/CCEditBox.cpp +++ b/extensions/GUI/CCEditBox/CCEditBox.cpp @@ -62,18 +62,18 @@ void EditBox::touchDownAction(Ref *sender, Control::EventType controlEvent) _editBoxImpl->openKeyboard(); } -EditBox* EditBox::create(const Size& size, Scale9Sprite* pNormal9SpriteBg, Scale9Sprite* pPressed9SpriteBg/* = NULL*/, Scale9Sprite* pDisabled9SpriteBg/* = NULL*/) +EditBox* EditBox::create(const Size& size, Scale9Sprite* pNormal9SpriteBg, Scale9Sprite* pPressed9SpriteBg/* = nullptr*/, Scale9Sprite* pDisabled9SpriteBg/* = nullptr*/) { EditBox* pRet = new EditBox(); - if (pRet != NULL && pRet->initWithSizeAndBackgroundSprite(size, pNormal9SpriteBg)) + if (pRet != nullptr && pRet->initWithSizeAndBackgroundSprite(size, pNormal9SpriteBg)) { - if (pPressed9SpriteBg != NULL) + if (pPressed9SpriteBg != nullptr) { pRet->setBackgroundSpriteForState(pPressed9SpriteBg, Control::State::HIGH_LIGHTED); } - if (pDisabled9SpriteBg != NULL) + if (pDisabled9SpriteBg != nullptr) { pRet->setBackgroundSpriteForState(pDisabled9SpriteBg, Control::State::DISABLED); } @@ -108,7 +108,7 @@ bool EditBox::initWithSizeAndBackgroundSprite(const Size& size, Scale9Sprite* pP void EditBox::setDelegate(EditBoxDelegate* pDelegate) { _delegate = pDelegate; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setDelegate(pDelegate); } @@ -121,10 +121,10 @@ EditBoxDelegate* EditBox::getDelegate() void EditBox::setText(const char* pText) { - if (pText != NULL) + if (pText != nullptr) { _text = pText; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setText(pText); } @@ -133,10 +133,10 @@ void EditBox::setText(const char* pText) const char* EditBox::getText(void) { - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { const char* pText = _editBoxImpl->getText(); - if(pText != NULL) + if(pText != nullptr) return pText; } @@ -147,9 +147,9 @@ void EditBox::setFont(const char* pFontName, int fontSize) { _fontName = pFontName; _fontSize = fontSize; - if (pFontName != NULL) + if (pFontName != nullptr) { - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setFont(pFontName, fontSize); } @@ -159,7 +159,7 @@ void EditBox::setFont(const char* pFontName, int fontSize) void EditBox::setFontName(const char* pFontName) { _fontName = pFontName; - if (_editBoxImpl != NULL && _fontSize != -1) + if (_editBoxImpl != nullptr && _fontSize != -1) { _editBoxImpl->setFont(pFontName, _fontSize); } @@ -168,7 +168,7 @@ void EditBox::setFontName(const char* pFontName) void EditBox::setFontSize(int fontSize) { _fontSize = fontSize; - if (_editBoxImpl != NULL && _fontName.length() > 0) + if (_editBoxImpl != nullptr && _fontName.length() > 0) { _editBoxImpl->setFont(_fontName.c_str(), _fontSize); } @@ -177,7 +177,7 @@ void EditBox::setFontSize(int fontSize) void EditBox::setFontColor(const Color3B& color) { _colText = color; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setFontColor(color); } @@ -187,9 +187,9 @@ void EditBox::setPlaceholderFont(const char* pFontName, int fontSize) { _placeholderFontName = pFontName; _placeholderFontSize = fontSize; - if (pFontName != NULL) + if (pFontName != nullptr) { - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setPlaceholderFont(pFontName, fontSize); } @@ -199,7 +199,7 @@ void EditBox::setPlaceholderFont(const char* pFontName, int fontSize) void EditBox::setPlaceholderFontName(const char* pFontName) { _placeholderFontName = pFontName; - if (_editBoxImpl != NULL && _placeholderFontSize != -1) + if (_editBoxImpl != nullptr && _placeholderFontSize != -1) { _editBoxImpl->setPlaceholderFont(pFontName, _fontSize); } @@ -208,7 +208,7 @@ void EditBox::setPlaceholderFontName(const char* pFontName) void EditBox::setPlaceholderFontSize(int fontSize) { _placeholderFontSize = fontSize; - if (_editBoxImpl != NULL && _placeholderFontName.length() > 0) + if (_editBoxImpl != nullptr && _placeholderFontName.length() > 0) { _editBoxImpl->setPlaceholderFont(_placeholderFontName.c_str(), _fontSize); } @@ -217,7 +217,7 @@ void EditBox::setPlaceholderFontSize(int fontSize) void EditBox::setPlaceholderFontColor(const Color3B& color) { _colText = color; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setPlaceholderFontColor(color); } @@ -225,10 +225,10 @@ void EditBox::setPlaceholderFontColor(const Color3B& color) void EditBox::setPlaceHolder(const char* pText) { - if (pText != NULL) + if (pText != nullptr) { _placeHolder = pText; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setPlaceHolder(pText); } @@ -243,7 +243,7 @@ const char* EditBox::getPlaceHolder(void) void EditBox::setInputMode(EditBox::InputMode inputMode) { _editBoxInputMode = inputMode; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setInputMode(inputMode); } @@ -252,7 +252,7 @@ void EditBox::setInputMode(EditBox::InputMode inputMode) void EditBox::setMaxLength(int maxLength) { _maxLength = maxLength; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setMaxLength(maxLength); } @@ -267,7 +267,7 @@ int EditBox::getMaxLength() void EditBox::setInputFlag(EditBox::InputFlag inputFlag) { _editBoxInputFlag = inputFlag; - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setInputFlag(inputFlag); } @@ -275,7 +275,7 @@ void EditBox::setInputFlag(EditBox::InputFlag inputFlag) void EditBox::setReturnType(EditBox::KeyboardReturnType returnType) { - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setReturnType(returnType); } @@ -285,7 +285,7 @@ void EditBox::setReturnType(EditBox::KeyboardReturnType returnType) void EditBox::setPosition(const Vec2& pos) { ControlButton::setPosition(pos); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setPosition(pos); } @@ -294,7 +294,7 @@ void EditBox::setPosition(const Vec2& pos) void EditBox::setVisible(bool visible) { ControlButton::setVisible(visible); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setVisible(visible); } @@ -303,7 +303,7 @@ void EditBox::setVisible(bool visible) void EditBox::setContentSize(const Size& size) { ControlButton::setContentSize(size); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setContentSize(size); } @@ -312,7 +312,7 @@ void EditBox::setContentSize(const Size& size) void EditBox::setAnchorPoint(const Vec2& anchorPoint) { ControlButton::setAnchorPoint(anchorPoint); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->setAnchorPoint(anchorPoint); } @@ -321,7 +321,7 @@ void EditBox::setAnchorPoint(const Vec2& anchorPoint) void EditBox::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) { ControlButton::visit(renderer, parentTransform, parentFlags); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->visit(); } @@ -338,7 +338,7 @@ void EditBox::onEnter(void) #endif ControlButton::onEnter(); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->onEnter(); } @@ -358,7 +358,7 @@ void EditBox::updatePosition(float dt) void EditBox::onExit(void) { ControlButton::onExit(); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { // remove system edit control _editBoxImpl->closeKeyboard(); @@ -390,7 +390,7 @@ void EditBox::keyboardWillShow(IMEKeyboardNotificationInfo& info) _adjustHeight = info.end.getMaxY() - rectTracked.getMinY(); // CCLOG("CCEditBox:needAdjustVerticalPosition(%f)", _adjustHeight); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->doAnimationWhenKeyboardMove(info.duration, _adjustHeight); } @@ -404,7 +404,7 @@ void EditBox::keyboardDidShow(IMEKeyboardNotificationInfo& info) void EditBox::keyboardWillHide(IMEKeyboardNotificationInfo& info) { // CCLOG("CCEditBox::keyboardWillHide"); - if (_editBoxImpl != NULL) + if (_editBoxImpl != nullptr) { _editBoxImpl->doAnimationWhenKeyboardMove(info.duration, -_adjustHeight); } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp index d98082746f..3ae5275689 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp @@ -93,12 +93,12 @@ bool EditBoxImplWin::initWithSize(const Size& size) void EditBoxImplWin::setFont(const char* pFontName, int fontSize) { - if(_label != NULL) { + if(_label != nullptr) { _label->setSystemFontName(pFontName); _label->setSystemFontSize(fontSize); } - if(_labelPlaceHolder != NULL) { + if(_labelPlaceHolder != nullptr) { _labelPlaceHolder->setSystemFontName(pFontName); _labelPlaceHolder->setSystemFontSize(fontSize); } @@ -112,7 +112,7 @@ void EditBoxImplWin::setFontColor(const Color3B& color) void EditBoxImplWin::setPlaceholderFont(const char* pFontName, int fontSize) { - if(_labelPlaceHolder != NULL) { + if(_labelPlaceHolder != nullptr) { _labelPlaceHolder->setSystemFontName(pFontName); _labelPlaceHolder->setSystemFontSize(fontSize); } @@ -156,7 +156,7 @@ bool EditBoxImplWin::isEditing() void EditBoxImplWin::setText(const char* pText) { - if (pText != NULL) + if (pText != nullptr) { _text = pText; @@ -199,7 +199,7 @@ const char* EditBoxImplWin::getText(void) void EditBoxImplWin::setPlaceHolder(const char* pText) { - if (pText != NULL) + if (pText != nullptr) { _placeHolder = pText; if (_placeHolder.length() > 0 && _text.length() == 0) @@ -236,13 +236,13 @@ void EditBoxImplWin::visit(void) void EditBoxImplWin::openKeyboard() { - if (_delegate != NULL) + if (_delegate != nullptr) { _delegate->editBoxEditingDidBegin(_editBox); } EditBox* pEditBox = this->getEditBox(); - if (NULL != pEditBox && 0 != pEditBox->getScriptEditBoxHandler()) + if (nullptr != pEditBox && 0 != pEditBox->getScriptEditBoxHandler()) { CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "began",pEditBox); ScriptEvent event(kCommonEvent,(void*)&data); @@ -265,7 +265,7 @@ void EditBoxImplWin::openKeyboard() if (didChange) setText(pText); - if (_delegate != NULL) { + if (_delegate != nullptr) { if (didChange) _delegate->editBoxTextChanged(_editBox, getText()); _delegate->editBoxEditingDidEnd(_editBox); diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index 69a1742b40..d45c9f62a8 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -75,7 +75,7 @@ ScrollView::~ScrollView() } -ScrollView* ScrollView::create(Size size, Node* container/* = NULL*/) +ScrollView* ScrollView::create(Size size, Node* container/* = nullptr*/) { ScrollView* pRet = new ScrollView(); if (pRet && pRet->initWithViewSize(size, container)) @@ -104,7 +104,7 @@ ScrollView* ScrollView::create() } -bool ScrollView::initWithViewSize(Size size, Node *container/* = NULL*/) +bool ScrollView::initWithViewSize(Size size, Node *container/* = nullptr*/) { if (Layer::init()) { @@ -123,7 +123,7 @@ bool ScrollView::initWithViewSize(Size size, Node *container/* = NULL*/) _touches.reserve(EventTouch::MAX_TOUCHES); - _delegate = NULL; + _delegate = nullptr; _bounceable = true; _clippingToBounds = true; //_container->setContentSize(Size::ZERO); @@ -142,7 +142,7 @@ bool ScrollView::initWithViewSize(Size size, Node *container/* = NULL*/) bool ScrollView::init() { - return this->initWithViewSize(Size(200, 200), NULL); + return this->initWithViewSize(Size(200, 200), nullptr); } bool ScrollView::isNodeVisible(Node* node) @@ -225,7 +225,7 @@ void ScrollView::setContentOffset(Vec2 offset, bool animated/* = false*/) _container->setPosition(offset); - if (_delegate != NULL) + if (_delegate != nullptr) { _delegate->scrollViewDidScroll(this); } @@ -269,7 +269,7 @@ void ScrollView::setZoomScale(float s) newCenter = _container->convertToWorldSpace(oldCenter); const Vec2 offset = center - newCenter; - if (_delegate != NULL) + if (_delegate != nullptr) { _delegate->scrollViewDidZoom(this); } @@ -329,9 +329,9 @@ Node * ScrollView::getContainer() void ScrollView::setContainer(Node * pContainer) { - // Make sure that '_container' has a non-NULL value since there are + // Make sure that '_container' has a non-nullptr value since there are // lots of logic that use '_container'. - if (NULL == pContainer) + if (nullptr == pContainer) return; this->removeAllChildrenWithCleanup(true); @@ -430,7 +430,7 @@ void ScrollView::stoppedAnimatedScroll(Node * node) { this->unschedule(schedule_selector(ScrollView::performedAnimatedScroll)); // After the animation stopped, "scrollViewDidScroll" should be invoked, this could fix the bug of lack of tableview cells. - if (_delegate != NULL) + if (_delegate != nullptr) { _delegate->scrollViewDidScroll(this); } @@ -444,7 +444,7 @@ void ScrollView::performedAnimatedScroll(float dt) return; } - if (_delegate != NULL) + if (_delegate != nullptr) { _delegate->scrollViewDidScroll(this); } @@ -458,7 +458,7 @@ const Size& ScrollView::getContentSize() const void ScrollView::setContentSize(const Size & size) { - if (this->getContainer() != NULL) + if (this->getContainer() != nullptr) { this->getContainer()->setContentSize(size); this->updateInset(); @@ -467,7 +467,7 @@ void ScrollView::setContentSize(const Size & size) void ScrollView::updateInset() { - if (this->getContainer() != NULL) + if (this->getContainer() != nullptr) { _maxInset = this->maxContainerOffset(); _maxInset = Vec2(_maxInset.x + _viewSize.width * INSET_RATIO, @@ -812,7 +812,7 @@ Rect ScrollView::getViewRect() float scaleX = this->getScaleX(); float scaleY = this->getScaleY(); - for (Node *p = _parent; p != NULL; p = p->getParent()) { + for (Node *p = _parent; p != nullptr; p = p->getParent()) { scaleX *= p->getScaleX(); scaleY *= p->getScaleY(); } diff --git a/extensions/GUI/CCScrollView/CCTableView.cpp b/extensions/GUI/CCScrollView/CCTableView.cpp index 3ba3c9c216..b074fc4e88 100644 --- a/extensions/GUI/CCScrollView/CCTableView.cpp +++ b/extensions/GUI/CCScrollView/CCTableView.cpp @@ -35,7 +35,7 @@ TableView* TableView::create() TableView* TableView::create(TableViewDataSource* dataSource, Size size) { - return TableView::create(dataSource, size, NULL); + return TableView::create(dataSource, size, nullptr); } TableView* TableView::create(TableViewDataSource* dataSource, Size size, Node *container) @@ -50,7 +50,7 @@ TableView* TableView::create(TableViewDataSource* dataSource, Size size, Node *c return table; } -bool TableView::initWithViewSize(Size size, Node* container/* = NULL*/) +bool TableView::initWithViewSize(Size size, Node* container/* = nullptr*/) { if (ScrollView::initWithViewSize(size,container)) { @@ -103,7 +103,7 @@ void TableView::reloadData() _oldDirection = Direction::NONE; for(const auto &cell : _cellsUsed) { - if(_tableViewDelegate != NULL) { + if(_tableViewDelegate != nullptr) { _tableViewDelegate->tableCellWillRecycle(this, cell); } @@ -242,7 +242,7 @@ TableViewCell *TableView::dequeueCell() TableViewCell *cell; if (_cellsFreed.empty()) { - cell = NULL; + cell = nullptr; } else { cell = _cellsFreed.at(0); cell->retain(); @@ -396,7 +396,7 @@ long TableView::__indexFromOffset(Vec2 offset) void TableView::_moveCellOutOfSight(TableViewCell *cell) { - if(_tableViewDelegate != NULL) { + if(_tableViewDelegate != nullptr) { _tableViewDelegate->tableCellWillRecycle(this, cell); } @@ -464,7 +464,7 @@ void TableView::scrollViewDidScroll(ScrollView* view) }); } - if(_tableViewDelegate != NULL) { + if(_tableViewDelegate != nullptr) { _tableViewDelegate->scrollViewDidScroll(this); } @@ -577,13 +577,13 @@ void TableView::onTouchEnded(Touch *pTouch, Event *pEvent) Rect bb = this->getBoundingBox(); bb.origin = _parent->convertToWorldSpace(bb.origin); - if (bb.containsPoint(pTouch->getLocation()) && _tableViewDelegate != NULL) + if (bb.containsPoint(pTouch->getLocation()) && _tableViewDelegate != nullptr) { _tableViewDelegate->tableCellUnhighlight(this, _touchedCell); _tableViewDelegate->tableCellTouched(this, _touchedCell); } - _touchedCell = NULL; + _touchedCell = nullptr; } ScrollView::onTouchEnded(pTouch, pEvent); @@ -608,26 +608,26 @@ bool TableView::onTouchBegan(Touch *pTouch, Event *pEvent) index = this->_indexFromOffset(point); if (index == CC_INVALID_INDEX) { - _touchedCell = NULL; + _touchedCell = nullptr; } else { _touchedCell = this->cellAtIndex(index); } - if (_touchedCell && _tableViewDelegate != NULL) + if (_touchedCell && _tableViewDelegate != nullptr) { _tableViewDelegate->tableCellHighlight(this, _touchedCell); } } else if (_touchedCell) { - if(_tableViewDelegate != NULL) + if(_tableViewDelegate != nullptr) { _tableViewDelegate->tableCellUnhighlight(this, _touchedCell); } - _touchedCell = NULL; + _touchedCell = nullptr; } return touchResult; @@ -639,12 +639,12 @@ void TableView::onTouchMoved(Touch *pTouch, Event *pEvent) if (_touchedCell && isTouchMoved()) { - if(_tableViewDelegate != NULL) + if(_tableViewDelegate != nullptr) { _tableViewDelegate->tableCellUnhighlight(this, _touchedCell); } - _touchedCell = NULL; + _touchedCell = nullptr; } } @@ -654,12 +654,12 @@ void TableView::onTouchCancelled(Touch *pTouch, Event *pEvent) if (_touchedCell) { - if(_tableViewDelegate != NULL) + if(_tableViewDelegate != nullptr) { _tableViewDelegate->tableCellUnhighlight(this, _touchedCell); } - _touchedCell = NULL; + _touchedCell = nullptr; } } diff --git a/extensions/assets-manager/AssetsManager.cpp b/extensions/assets-manager/AssetsManager.cpp index 637cd18c98..52073d2f07 100644 --- a/extensions/assets-manager/AssetsManager.cpp +++ b/extensions/assets-manager/AssetsManager.cpp @@ -77,7 +77,7 @@ struct ProgressMessage // Implementation of AssetsManager -AssetsManager::AssetsManager(const char* packageUrl/* =NULL */, const char* versionFileUrl/* =NULL */, const char* storagePath/* =NULL */) +AssetsManager::AssetsManager(const char* packageUrl/* =nullptr */, const char* versionFileUrl/* =nullptr */, const char* storagePath/* =nullptr */) : _storagePath(storagePath) , _version("") , _packageUrl(packageUrl) @@ -309,9 +309,9 @@ bool AssetsManager::uncompress() &fileInfo, fileName, MAX_FILENAME, - NULL, + nullptr, 0, - NULL, + nullptr, 0) != UNZ_OK) { CCLOG("can not read file info"); @@ -455,7 +455,7 @@ bool AssetsManager::createDirectory(const char *path) return true; #else - BOOL ret = CreateDirectoryA(path, NULL); + BOOL ret = CreateDirectoryA(path, nullptr); if (!ret && ERROR_ALREADY_EXISTS != GetLastError()) { return false; @@ -632,7 +632,7 @@ void AssetsManager::createStoragePath() { // Remove downloaded files #if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) - DIR *dir = NULL; + DIR *dir = nullptr; dir = opendir (_storagePath.c_str()); if (!dir) diff --git a/extensions/physics-nodes/CCPhysicsDebugNode.cpp b/extensions/physics-nodes/CCPhysicsDebugNode.cpp index 18f55cefe4..2fbc2c4fb9 100644 --- a/extensions/physics-nodes/CCPhysicsDebugNode.cpp +++ b/extensions/physics-nodes/CCPhysicsDebugNode.cpp @@ -70,7 +70,7 @@ static Vec2 cpVert2Point(const cpVect &vert) static Vec2* cpVertArray2ccpArrayN(const cpVect* cpVertArray, unsigned int count) { - if (count == 0) return NULL; + if (count == 0) return nullptr; Vec2* pPoints = new Vec2[count]; for (unsigned int i = 0; i < count; ++i) diff --git a/extensions/physics-nodes/CCPhysicsSprite.cpp b/extensions/physics-nodes/CCPhysicsSprite.cpp index 0c896a5677..a335a1b385 100644 --- a/extensions/physics-nodes/CCPhysicsSprite.cpp +++ b/extensions/physics-nodes/CCPhysicsSprite.cpp @@ -172,7 +172,7 @@ const Vec2& PhysicsSprite::getPosition() const void PhysicsSprite::getPosition(float* x, float* y) const { - if (x == NULL || y == NULL) { + if (x == nullptr || y == nullptr) { return; } const Vec2& pos = getPosFromPhysics(); diff --git a/extensions/proj.win32/Win32InputBox.cpp b/extensions/proj.win32/Win32InputBox.cpp index bc115dfc54..da1cb12301 100644 --- a/extensions/proj.win32/Win32InputBox.cpp +++ b/extensions/proj.win32/Win32InputBox.cpp @@ -138,11 +138,11 @@ INT_PTR CWin32InputBox::InputBoxEx(WIN32INPUTBOX_PARAM *param) #else HRSRC rcDlg = ::FindResource(hModule, MAKEINTRESOURCE(param->DlgTemplateName), RT_DIALOG); #endif - if (rcDlg == NULL) + if (rcDlg == nullptr) return 0; HGLOBAL hglobalDlg = ::LoadResource(hModule, rcDlg); - if (hglobalDlg == NULL) + if (hglobalDlg == nullptr) return 0; dlgTemplate = (LPDLGTEMPLATE) hglobalDlg; @@ -336,16 +336,16 @@ std::string CWin32InputBox::AnsiToUtf8(std::string strAnsi) std::string ret; if (strAnsi.length() > 0) { - int nWideStrLength = MultiByteToWideChar(CP_ACP, 0, strAnsi.c_str(), -1, NULL, 0); + int nWideStrLength = MultiByteToWideChar(CP_ACP, 0, strAnsi.c_str(), -1, nullptr, 0); WCHAR* pwszBuf = (WCHAR*)malloc((nWideStrLength+1)*sizeof(WCHAR)); memset(pwszBuf, 0, (nWideStrLength+1)*sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, strAnsi.c_str(), -1, pwszBuf, (nWideStrLength+1)*sizeof(WCHAR)); - int nUtf8Length = WideCharToMultiByte( CP_UTF8,0,pwszBuf,-1,NULL,0,NULL,FALSE ); + int nUtf8Length = WideCharToMultiByte( CP_UTF8,0,pwszBuf,-1,nullptr,0,nullptr,FALSE ); char* pszUtf8Buf = (char*)malloc((nUtf8Length+1)*sizeof(char)); memset(pszUtf8Buf, 0, (nUtf8Length+1)*sizeof(char)); - WideCharToMultiByte(CP_UTF8, 0, pwszBuf, -1, pszUtf8Buf, (nUtf8Length+1)*sizeof(char), NULL, FALSE); + WideCharToMultiByte(CP_UTF8, 0, pwszBuf, -1, pszUtf8Buf, (nUtf8Length+1)*sizeof(char), nullptr, FALSE); ret = pszUtf8Buf; free(pszUtf8Buf); @@ -359,16 +359,16 @@ std::string CWin32InputBox::Utf8ToAnsi(std::string strUTF8) std::string ret; if (strUTF8.length() > 0) { - int nWideStrLength = MultiByteToWideChar(CP_UTF8, 0, strUTF8.c_str(), -1, NULL, 0); + int nWideStrLength = MultiByteToWideChar(CP_UTF8, 0, strUTF8.c_str(), -1, nullptr, 0); WCHAR* pwszBuf = (WCHAR*)malloc((nWideStrLength+1)*sizeof(WCHAR)); memset(pwszBuf, 0, (nWideStrLength+1)*sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, strUTF8.c_str(), -1, pwszBuf, (nWideStrLength+1)*sizeof(WCHAR)); - int nAnsiStrLength = WideCharToMultiByte( CP_ACP,0,pwszBuf,-1,NULL,0,NULL,FALSE ); + int nAnsiStrLength = WideCharToMultiByte( CP_ACP,0,pwszBuf,-1,nullptr,0,nullptr,FALSE ); char* pszAnsiBuf = (char*)malloc((nAnsiStrLength+1)*sizeof(char)); memset(pszAnsiBuf, 0, (nAnsiStrLength+1)*sizeof(char)); - WideCharToMultiByte(CP_ACP, 0, pwszBuf, -1, pszAnsiBuf, (nAnsiStrLength+1)*sizeof(char), NULL, FALSE); + WideCharToMultiByte(CP_ACP, 0, pwszBuf, -1, pszAnsiBuf, (nAnsiStrLength+1)*sizeof(char), nullptr, FALSE); ret = pszAnsiBuf; free(pszAnsiBuf); diff --git a/setup.py b/setup.py index 9a309edd02..e4343529d9 100755 --- a/setup.py +++ b/setup.py @@ -79,6 +79,7 @@ class SetEnvVar(object): MAC_CHECK_FILES = [ '.bash_profile', '.bash_login', '.profile' ] LINUX_CHECK_FILES = [ '.bashrc' ] + ZSH_CHECK_FILES = ['.zshrc' ] RE_FORMAT = r'^export[ \t]+%s=(.+)' def __init__(self): @@ -96,13 +97,23 @@ class SetEnvVar(object): def _is_mac(self): return sys.platform == 'darwin' - def _get_filepath_for_setup(self): + def _is_zsh(self): + return os.environ.get('SHELL')[-3:] == "zsh" + def _get_unix_file_list(self): file_list = None - if self._isLinux(): + + if self._is_zsh(): + file_list = SetEnvVar.ZSH_CHECK_FILES + elif self._isLinux(): file_list = SetEnvVar.LINUX_CHECK_FILES elif self._is_mac(): file_list = SetEnvVar.MAC_CHECK_FILES + + return file_list + + def _get_filepath_for_setup(self): + file_list = self._get_unix_file_list(); file_to_write = None if file_list is None: @@ -213,11 +224,7 @@ class SetEnvVar(object): ret = os.environ[var] except Exception: if not self._isWindows(): - file_list = None - if self._isLinux(): - file_list = SetEnvVar.LINUX_CHECK_FILES - elif self._is_mac(): - file_list = SetEnvVar.MAC_CHECK_FILES + file_list = self._get_unix_file_list() if file_list is not None: home = os.path.expanduser('~') diff --git a/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp b/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp index 0ae621cd24..9f3943f535 100644 --- a/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp +++ b/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp @@ -28,7 +28,7 @@ Layer* createActionManagerLayer(int nIndex) case 4: return new ResumeTest(); } - return NULL; + return nullptr; } Layer* nextActionManagerAction() @@ -129,14 +129,14 @@ void CrashTest::onEnter() child->runAction(Sequence::create( DelayTime::create(1.4f), FadeOut::create(1.1f), - NULL) + nullptr) ); //After 1.5 second, self will be removed. runAction( Sequence::create( DelayTime::create(1.4f), CallFunc::create( CC_CALLBACK_0(CrashTest::removeThis,this)), - NULL) + nullptr) ); } @@ -168,7 +168,7 @@ void LogicTest::onEnter() grossini->runAction( Sequence::create( MoveBy::create(1, Vec2(150,0)), CallFuncN::create(CC_CALLBACK_1(LogicTest::bugMe,this)), - NULL) + nullptr) ); } @@ -246,7 +246,7 @@ void StopActionTest::onEnter() auto pMove = MoveBy::create(2, Vec2(200, 0)); auto pCallback = CallFunc::create(CC_CALLBACK_0(StopActionTest::stopAction,this)); - auto pSequence = Sequence::create(pMove, pCallback, NULL); + auto pSequence = Sequence::create(pMove, pCallback, nullptr); pSequence->setTag(kTagSequence); auto pChild = Sprite::create(s_pathGrossini); diff --git a/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp b/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp index 30a1355732..83232ee376 100644 --- a/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp +++ b/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp @@ -93,9 +93,9 @@ void SpriteEase::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); auto a2 = _grossini->runAction(RepeatForever::create(seq1)); @@ -149,9 +149,9 @@ void SpriteEaseInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create( move_ease_inout1, delay, move_ease_inout_back1, delay->clone(), NULL); - auto seq2 = Sequence::create( move_ease_inout2, delay->clone(), move_ease_inout_back2, delay->clone(), NULL); - auto seq3 = Sequence::create( move_ease_inout3, delay->clone(), move_ease_inout_back3, delay->clone(), NULL); + auto seq1 = Sequence::create( move_ease_inout1, delay, move_ease_inout_back1, delay->clone(), nullptr); + auto seq2 = Sequence::create( move_ease_inout2, delay->clone(), move_ease_inout_back2, delay->clone(), nullptr); + auto seq3 = Sequence::create( move_ease_inout3, delay->clone(), move_ease_inout_back3, delay->clone(), nullptr); _tamara->runAction(RepeatForever::create(seq1)); _kathia->runAction(RepeatForever::create(seq2)); @@ -185,9 +185,9 @@ void SpriteEaseExponential::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); @@ -218,8 +218,8 @@ void SpriteEaseExponentialInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create( move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create( move_ease, delay, move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create( move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create( move_ease, delay, move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -254,9 +254,9 @@ void SpriteEaseSine::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); @@ -288,8 +288,8 @@ void SpriteEaseSineInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -323,9 +323,9 @@ void SpriteEaseElastic::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -361,9 +361,9 @@ void SpriteEaseElasticInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move_ease_inout1, delay, move_ease_inout_back1, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_inout2, delay->clone(), move_ease_inout_back2, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_inout3, delay->clone(), move_ease_inout_back3, delay->clone(), NULL); + auto seq1 = Sequence::create(move_ease_inout1, delay, move_ease_inout_back1, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_inout2, delay->clone(), move_ease_inout_back2, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_inout3, delay->clone(), move_ease_inout_back3, delay->clone(), nullptr); _tamara->runAction( RepeatForever::create(seq1)); _kathia->runAction( RepeatForever::create(seq2)); @@ -398,9 +398,9 @@ void SpriteEaseBounce::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -432,8 +432,8 @@ void SpriteEaseBounceInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -468,9 +468,9 @@ void SpriteEaseBack::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction(RepeatForever::create(seq1)); _tamara->runAction(RepeatForever::create(seq2)); @@ -501,8 +501,8 @@ void SpriteEaseBackInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -546,7 +546,7 @@ void SpriteEaseBezier::onEnter() bezierEaseForward->setBezierParamer(0.5, 0.5, 1.0, 1.0); auto bezierEaseBack = bezierEaseForward->reverse(); - auto rep = RepeatForever::create(Sequence::create( bezierEaseForward, bezierEaseBack, NULL)); + auto rep = RepeatForever::create(Sequence::create( bezierEaseForward, bezierEaseBack, nullptr)); // sprite 2 @@ -599,9 +599,9 @@ void SpriteEaseQuadratic::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -631,8 +631,8 @@ void SpriteEaseQuadraticInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -667,9 +667,9 @@ void SpriteEaseQuartic::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -699,8 +699,8 @@ void SpriteEaseQuarticInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -734,9 +734,9 @@ void SpriteEaseQuintic::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -767,8 +767,8 @@ void SpriteEaseQuinticInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -802,9 +802,9 @@ void SpriteEaseCircle::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -835,8 +835,8 @@ void SpriteEaseCircleInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -870,9 +870,9 @@ void SpriteEaseCubic::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), NULL); - auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease_in, delay->clone(), move_ease_in_back, delay->clone(), nullptr); + auto seq3 = Sequence::create(move_ease_out, delay->clone(), move_ease_out_back, delay->clone(), nullptr); _grossini->runAction( RepeatForever::create(seq1)); _tamara->runAction( RepeatForever::create(seq2)); @@ -903,8 +903,8 @@ void SpriteEaseCubicInOut::onEnter() auto delay = DelayTime::create(0.25f); - auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), NULL); - auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), NULL); + auto seq1 = Sequence::create(move, delay, move_back, delay->clone(), nullptr); + auto seq2 = Sequence::create(move_ease, delay->clone(), move_ease_back, delay->clone(), nullptr); this->positionForTwo(); @@ -934,9 +934,9 @@ void SpeedTest::onEnter() auto rot1 = RotateBy::create(4, 360*2); auto rot2 = rot1->reverse(); - auto seq3_1 = Sequence::create(jump2, jump1, NULL); - auto seq3_2 = Sequence::create( rot1, rot2, NULL); - auto spawn = Spawn::create(seq3_1, seq3_2, NULL); + auto seq3_1 = Sequence::create(jump2, jump1, nullptr); + auto seq3_2 = Sequence::create( rot1, rot2, nullptr); + auto spawn = Spawn::create(seq3_1, seq3_2, nullptr); auto action = Speed::create(RepeatForever::create(spawn), 1.0f); action->setTag(kTagAction1); @@ -1017,7 +1017,7 @@ Layer* createEaseLayer(int nIndex) } - return NULL; + return nullptr; } Layer* nextEaseAction() diff --git a/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp b/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp index 8783884961..2b83ab8e3b 100644 --- a/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp +++ b/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp @@ -47,7 +47,7 @@ Layer* createLayer(int nIndex) case 6: return new SpriteProgressWithSpriteFrame(); } - return NULL; + return nullptr; } Layer* nextAction() @@ -371,10 +371,10 @@ void SpriteProgressBarTintAndFade::onEnter() auto tint = Sequence::create(TintTo::create(1, 255, 0, 0), TintTo::create(1, 0, 255, 0), TintTo::create(1, 0, 0, 255), - NULL); + nullptr); auto fade = Sequence::create(FadeTo::create(1.0f, 0), FadeTo::create(1.0f, 255), - NULL); + nullptr); auto left = ProgressTimer::create(Sprite::create(s_pathSister1)); left->setType(ProgressTimer::Type::BAR); diff --git a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp index 608ce735d2..6a3dcf8813 100644 --- a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp +++ b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp @@ -290,7 +290,7 @@ void ActionMove::onEnter() auto actionByBack = actionBy->reverse(); _tamara->runAction( actionTo); - _grossini->runAction( Sequence::create(actionBy, actionByBack, NULL)); + _grossini->runAction( Sequence::create(actionBy, actionByBack, nullptr)); _kathia->runAction(MoveTo::create(1, Vec2(40,40))); } @@ -315,8 +315,8 @@ void ActionScale::onEnter() auto actionBy2 = ScaleBy::create(2.0f, 5.0f, 1.0f); _grossini->runAction( actionTo); - _tamara->runAction( Sequence::create(actionBy, actionBy->reverse(), NULL)); - _kathia->runAction( Sequence::create(actionBy2, actionBy2->reverse(), NULL)); + _tamara->runAction( Sequence::create(actionBy, actionBy->reverse(), nullptr)); + _kathia->runAction( Sequence::create(actionBy2, actionBy2->reverse(), nullptr)); } std::string ActionScale::subtitle() const @@ -341,10 +341,10 @@ void ActionSkew::onEnter() auto actionBy2 = SkewBy::create(2, 45.0f, 45.0f); auto actionByBack = actionBy->reverse(); - _tamara->runAction(Sequence::create(actionTo, actionToBack, NULL)); - _grossini->runAction(Sequence::create(actionBy, actionByBack, NULL)); + _tamara->runAction(Sequence::create(actionTo, actionToBack, nullptr)); + _grossini->runAction(Sequence::create(actionBy, actionByBack, nullptr)); - _kathia->runAction(Sequence::create(actionBy2, actionBy2->reverse(), NULL)); + _kathia->runAction(Sequence::create(actionBy2, actionBy2->reverse(), nullptr)); } std::string ActionSkew::subtitle() const @@ -367,9 +367,9 @@ void ActionRotationalSkew::onEnter() auto actionBy2 = RotateBy::create(2, 360, 0); auto actionBy2Back = actionBy2->reverse(); - _tamara->runAction( Sequence::create(actionBy, actionByBack, NULL) ); - _grossini->runAction( Sequence::create(actionTo, actionToBack, NULL) ); - _kathia->runAction( Sequence::create(actionBy2, actionBy2Back, NULL) ); + _tamara->runAction( Sequence::create(actionBy, actionByBack, nullptr) ); + _grossini->runAction( Sequence::create(actionTo, actionToBack, nullptr) ); + _kathia->runAction( Sequence::create(actionBy2, actionBy2Back, nullptr) ); } std::string ActionRotationalSkew::subtitle() const @@ -406,7 +406,7 @@ void ActionRotationalSkewVSStandardSkew::onEnter() auto actionTo = SkewBy::create(2, 360, 0); auto actionToBack = SkewBy::create(2, -360, 0); - box->runAction(Sequence::create(actionTo, actionToBack, NULL)); + box->runAction(Sequence::create(actionTo, actionToBack, nullptr)); box = LayerColor::create(Color4B(255,255,0,255)); box->setAnchorPoint(Vec2(0.5,0.5)); @@ -420,7 +420,7 @@ void ActionRotationalSkewVSStandardSkew::onEnter() this->addChild(label); auto actionTo2 = RotateBy::create(2, 360, 0); auto actionToBack2 = RotateBy::create(2, -360, 0); - box->runAction(Sequence::create(actionTo2, actionToBack2, NULL)); + box->runAction(Sequence::create(actionTo2, actionToBack2, nullptr)); } std::string ActionRotationalSkewVSStandardSkew::subtitle() const { @@ -465,9 +465,9 @@ void ActionSkewRotateScale::onEnter() auto rotateToBack = RotateTo::create(2, 0); auto actionToBack = SkewTo::create(2, 0, 0); - box->runAction(Sequence::create(actionTo, actionToBack, NULL)); - box->runAction(Sequence::create(rotateTo, rotateToBack, NULL)); - box->runAction(Sequence::create(actionScaleTo, actionScaleToBack, NULL)); + box->runAction(Sequence::create(actionTo, actionToBack, nullptr)); + box->runAction(Sequence::create(rotateTo, rotateToBack, nullptr)); + box->runAction(Sequence::create(actionScaleTo, actionScaleToBack, nullptr)); } std::string ActionSkewRotateScale::subtitle() const @@ -489,13 +489,13 @@ void ActionRotate::onEnter() auto actionTo = RotateTo::create( 2, 45); auto actionTo2 = RotateTo::create( 2, -45); auto actionTo0 = RotateTo::create(2 , 0); - _tamara->runAction( Sequence::create(actionTo, actionTo0, NULL)); + _tamara->runAction( Sequence::create(actionTo, actionTo0, nullptr)); auto actionBy = RotateBy::create(2 , 360); auto actionByBack = actionBy->reverse(); - _grossini->runAction( Sequence::create(actionBy, actionByBack, NULL)); + _grossini->runAction( Sequence::create(actionBy, actionByBack, nullptr)); - _kathia->runAction( Sequence::create(actionTo2, actionTo0->clone(), NULL)); + _kathia->runAction( Sequence::create(actionTo2, actionTo0->clone(), nullptr)); } std::string ActionRotate::subtitle() const @@ -545,7 +545,7 @@ void ActionJump::onEnter() auto actionByBack = actionBy->reverse(); _tamara->runAction( actionTo); - _grossini->runAction( Sequence::create(actionBy, actionByBack, NULL)); + _grossini->runAction( Sequence::create(actionBy, actionByBack, nullptr)); _kathia->runAction( RepeatForever::create(actionUp)); } std::string ActionJump::subtitle() const @@ -579,7 +579,7 @@ void ActionBezier::onEnter() auto bezierForward = BezierBy::create(3, bezier); auto bezierBack = bezierForward->reverse(); - auto rep = RepeatForever::create(Sequence::create( bezierForward, bezierBack, NULL)); + auto rep = RepeatForever::create(Sequence::create( bezierForward, bezierBack, nullptr)); // sprite 2 @@ -650,9 +650,9 @@ void ActionFade::onEnter() auto action2BackReverseReverse = action2BackReverse->reverse(); _tamara->setOpacity(122); - _tamara->runAction( Sequence::create( action1, action1Back, NULL)); + _tamara->runAction( Sequence::create( action1, action1Back, nullptr)); _kathia->setOpacity(122); - _kathia->runAction( Sequence::create( action2, action2Back,action2BackReverse,action2BackReverseReverse, NULL)); + _kathia->runAction( Sequence::create( action2, action2Back,action2BackReverse,action2BackReverseReverse, nullptr)); } std::string ActionFade::subtitle() const @@ -677,7 +677,7 @@ void ActionTint::onEnter() auto action2Back = action2->reverse(); _tamara->runAction( action1); - _kathia->runAction( Sequence::create( action2, action2Back, NULL)); + _kathia->runAction( Sequence::create( action2, action2Back, nullptr)); } std::string ActionTint::subtitle() const @@ -711,7 +711,7 @@ void ActionAnimate::onEnter() animation->setRestoreOriginalFrame(true); auto action = Animate::create(animation); - _grossini->runAction(Sequence::create(action, action->reverse(), NULL)); + _grossini->runAction(Sequence::create(action, action->reverse(), nullptr)); // // File animation @@ -722,7 +722,7 @@ void ActionAnimate::onEnter() auto animation2 = cache->getAnimation("dance_1"); auto action2 = Animate::create(animation2); - _tamara->runAction(Sequence::create(action2, action2->reverse(), NULL)); + _tamara->runAction(Sequence::create(action2, action2->reverse(), nullptr)); _frameDisplayedListener = EventListenerCustom::create(AnimationFrameDisplayedNotification, [](EventCustom * event){ auto userData = static_cast(event->getUserData()); @@ -774,7 +774,7 @@ void ActionSequence::onEnter() auto action = Sequence::create( MoveBy::create( 2, Vec2(240,0)), RotateBy::create( 2, 540), - NULL); + nullptr); _grossini->runAction(action); } @@ -804,7 +804,7 @@ void ActionSequence2::onEnter() CallFunc::create( CC_CALLBACK_0(ActionSequence2::callback1,this)), CallFunc::create( CC_CALLBACK_0(ActionSequence2::callback2,this,_grossini)), CallFunc::create( CC_CALLBACK_0(ActionSequence2::callback3,this,_grossini,0xbebabeba)), - NULL); + nullptr); _grossini->runAction(action); } @@ -855,7 +855,7 @@ void ActionCallFuncN::onEnter() auto action = Sequence::create( MoveBy::create(2.0f, Vec2(150,0)), CallFuncN::create( CC_CALLBACK_1(ActionCallFuncN::callback, this)), - NULL); + nullptr); _grossini->runAction(action); } @@ -890,7 +890,7 @@ void ActionCallFuncND::onEnter() auto action = Sequence::create( MoveBy::create(2.0f, Vec2(200,0)), CallFuncN::create( CC_CALLBACK_1(ActionCallFuncND::doRemoveFromParentAndCleanup, this, true)), - NULL); + nullptr); _grossini->runAction(action); } @@ -925,7 +925,7 @@ void ActionCallFuncO::onEnter() auto action = Sequence::create( MoveBy::create(2.0f, Vec2(200,0)), CallFunc::create( CC_CALLBACK_0(ActionCallFuncO::callback, this, _grossini, true)), - NULL); + nullptr); _grossini->runAction(action); } @@ -967,19 +967,19 @@ void ActionCallFunction::onEnter() label->setPosition(Vec2( s.width/4*1,s.height/2-40)); this->addChild(label); } ), - NULL); + nullptr); auto action2 = Sequence::create( ScaleBy::create(2 , 2), FadeOut::create(2), CallFunc::create( std::bind(&ActionCallFunction::callback2, this, _tamara) ), - NULL); + nullptr); auto action3 = Sequence::create( RotateBy::create(3 , 360), FadeOut::create(2), CallFunc::create( std::bind(&ActionCallFunction::callback3, this, _kathia, 42) ), - NULL); + nullptr); _grossini->runAction(action1); _tamara->runAction(action2); @@ -1036,7 +1036,7 @@ void ActionSpawn::onEnter() auto action = Spawn::create( JumpBy::create(2, Vec2(300,0), 50, 4), RotateBy::create( 2, 720), - NULL); + nullptr); _grossini->runAction(action); } @@ -1061,7 +1061,7 @@ void ActionRepeatForever::onEnter() auto action = Sequence::create( DelayTime::create(1), CallFunc::create( std::bind( &ActionRepeatForever::repeatForever, this, _grossini) ), - NULL); + nullptr); _grossini->runAction(action); } @@ -1092,7 +1092,7 @@ void ActionRotateToRepeat::onEnter() auto act1 = RotateTo::create(1, 90); auto act2 = RotateTo::create(1, 0); - auto seq = Sequence::create(act1, act2, NULL); + auto seq = Sequence::create(act1, act2, nullptr); auto rep1 = RepeatForever::create(seq); auto rep2 = Repeat::create( seq->clone(), 10); @@ -1120,7 +1120,7 @@ void ActionRotateJerk::onEnter() auto seq = Sequence::create( RotateTo::create(0.5f, -20), RotateTo::create(0.5f, 20), - NULL); + nullptr); auto rep1 = Repeat::create(seq, 10); auto rep2 = RepeatForever::create( seq->clone() ); @@ -1146,7 +1146,7 @@ void ActionReverse::onEnter() alignSpritesLeft(1); auto jump = JumpBy::create(2, Vec2(300,0), 50, 4); - auto action = Sequence::create( jump, jump->reverse(), NULL); + auto action = Sequence::create( jump, jump->reverse(), nullptr); _grossini->runAction(action); } @@ -1169,7 +1169,7 @@ void ActionDelayTime::onEnter() alignSpritesLeft(1); auto move = MoveBy::create(1, Vec2(150,0)); - auto action = Sequence::create( move, DelayTime::create(2), move, NULL); + auto action = Sequence::create( move, DelayTime::create(2), move, nullptr); _grossini->runAction(action); } @@ -1193,8 +1193,8 @@ void ActionReverseSequence::onEnter() auto move1 = MoveBy::create(1, Vec2(250,0)); auto move2 = MoveBy::create(1, Vec2(0,50)); - auto seq = Sequence::create( move1, move2, move1->reverse(), NULL); - auto action = Sequence::create( seq, seq->reverse(), NULL); + auto seq = Sequence::create( move1, move2, move1->reverse(), nullptr); + auto action = Sequence::create( seq, seq->reverse(), nullptr); _grossini->runAction(action); } @@ -1223,8 +1223,8 @@ void ActionReverseSequence2::onEnter() auto move2 = MoveBy::create(1, Vec2(0,50)); auto tog1 = ToggleVisibility::create(); auto tog2 = ToggleVisibility::create(); - auto seq = Sequence::create( move1, tog1, move2, tog2, move1->reverse(), NULL); - auto action = Repeat::create(Sequence::create( seq, seq->reverse(), NULL), 3); + auto seq = Sequence::create( move1, tog1, move2, tog2, move1->reverse(), nullptr); + auto action = Repeat::create(Sequence::create( seq, seq->reverse(), nullptr), 3); // Test: @@ -1234,9 +1234,9 @@ void ActionReverseSequence2::onEnter() auto move_tamara = MoveBy::create(1, Vec2(100,0)); auto move_tamara2 = MoveBy::create(1, Vec2(50,0)); auto hide = Hide::create(); - auto seq_tamara = Sequence::create( move_tamara, hide, move_tamara2, NULL); + auto seq_tamara = Sequence::create( move_tamara, hide, move_tamara2, nullptr); auto seq_back = seq_tamara->reverse(); - _tamara->runAction( Sequence::create( seq_tamara, seq_back, NULL)); + _tamara->runAction( Sequence::create( seq_tamara, seq_back, nullptr)); } std::string ActionReverseSequence2::subtitle() const { @@ -1257,10 +1257,10 @@ void ActionRepeat::onEnter() auto a1 = MoveBy::create(1, Vec2(150,0)); auto action1 = Repeat::create( - Sequence::create( Place::create(Vec2(60,60)), a1, NULL) , + Sequence::create( Place::create(Vec2(60,60)), a1, nullptr) , 3); auto action2 = RepeatForever::create( - Sequence::create(a1->clone(), a1->reverse(), NULL) + Sequence::create(a1->clone(), a1->reverse(), nullptr) ); _kathia->runAction(action1); @@ -1308,7 +1308,7 @@ void ActionOrbit::onEnter() auto move = MoveBy::create(3, Vec2(100,-100)); auto move_back = move->reverse(); - auto seq = Sequence::create(move, move_back, NULL); + auto seq = Sequence::create(move, move_back, nullptr); auto rfe = RepeatForever::create(seq); _kathia->runAction(rfe); _tamara->runAction(rfe->clone() ); @@ -1342,7 +1342,7 @@ void ActionFollow::onEnter() _grossini->setPosition(Vec2(-200, s.height / 2)); auto move = MoveBy::create(2, Vec2(s.width * 3, 0)); auto move_back = move->reverse(); - auto seq = Sequence::create(move, move_back, NULL); + auto seq = Sequence::create(move, move_back, nullptr); auto rep = RepeatForever::create(seq); _grossini->runAction(rep); @@ -1395,7 +1395,7 @@ void ActionTargeted::onEnter() auto t1 = TargetedAction::create(_kathia, jump2); auto t2 = TargetedAction::create(_kathia, rot2); - auto seq = Sequence::create(jump1, t1, rot1, t2, NULL); + auto seq = Sequence::create(jump1, t1, rot1, t2, nullptr); auto always = RepeatForever::create(seq); _tamara->runAction(always); @@ -1426,7 +1426,7 @@ void ActionTargetedReverse::onEnter() auto t1 = TargetedAction::create(_kathia, jump2); auto t2 = TargetedAction::create(_kathia, rot2); - auto seq = Sequence::create(jump1, t1->reverse(), rot1, t2->reverse(), NULL); + auto seq = Sequence::create(jump1, t1->reverse(), rot1, t2->reverse(), nullptr); auto always = RepeatForever::create(seq); _tamara->runAction(always); @@ -1506,14 +1506,14 @@ void ActionMoveStacked::runActionsInSprite(Sprite *sprite) Sequence::create( MoveBy::create(0.05f, Vec2(10,10)), MoveBy::create(0.05f, Vec2(-10,-10)), - NULL))); + nullptr))); auto action = MoveBy::create(2.0f, Vec2(400,0)); auto action_back = action->reverse(); sprite->runAction( RepeatForever::create( - Sequence::create(action, action_back, NULL) + Sequence::create(action, action_back, nullptr) )); } @@ -1532,14 +1532,14 @@ void ActionMoveJumpStacked::runActionsInSprite(Sprite *sprite) Sequence::create( MoveBy::create(0.05f, Vec2(10,2)), MoveBy::create(0.05f, Vec2(-10,-2)), - NULL))); + nullptr))); auto jump = JumpBy::create(2.0f, Vec2(400,0), 100, 5); auto jump_back = jump->reverse(); sprite->runAction( RepeatForever::create( - Sequence::create(jump, jump_back, NULL) + Sequence::create(jump, jump_back, nullptr) )); } @@ -1562,7 +1562,7 @@ void ActionMoveBezierStacked::runActionsInSprite(Sprite *sprite) auto bezierForward = BezierBy::create(3, bezier); auto bezierBack = bezierForward->reverse(); - auto seq = Sequence::create(bezierForward, bezierBack, NULL); + auto seq = Sequence::create(bezierForward, bezierBack, nullptr); auto rep = RepeatForever::create(seq); sprite->runAction(rep); @@ -1571,7 +1571,7 @@ void ActionMoveBezierStacked::runActionsInSprite(Sprite *sprite) Sequence::create( MoveBy::create(0.05f, Vec2(10,0)), MoveBy::create(0.05f, Vec2(-10,0)), - NULL))); + nullptr))); } std::string ActionMoveBezierStacked::title() const @@ -1612,7 +1612,7 @@ void ActionCatmullRomStacked::onEnter() auto action = CatmullRomBy::create(3, array); auto reverse = action->reverse(); - auto seq = Sequence::create(action, reverse, NULL); + auto seq = Sequence::create(action, reverse, nullptr); _tamara->runAction(seq); @@ -1621,7 +1621,7 @@ void ActionCatmullRomStacked::onEnter() Sequence::create( MoveBy::create(0.05f, Vec2(10,0)), MoveBy::create(0.05f, Vec2(-10,0)), - NULL))); + nullptr))); // // sprite 2 (To) @@ -1641,7 +1641,7 @@ void ActionCatmullRomStacked::onEnter() auto action2 = CatmullRomTo::create(3, array2); auto reverse2 = action2->reverse(); - auto seq2 = Sequence::create(action2, reverse2, NULL); + auto seq2 = Sequence::create(action2, reverse2, nullptr); _kathia->runAction(seq2); @@ -1650,7 +1650,7 @@ void ActionCatmullRomStacked::onEnter() Sequence::create( MoveBy::create(0.05f, Vec2(10,0)), MoveBy::create(0.05f, Vec2(-10,0)), - NULL))); + nullptr))); array->retain(); _array1 = array; @@ -1741,7 +1741,7 @@ void ActionCardinalSplineStacked::onEnter() auto action = CardinalSplineBy::create(3, array, 0); auto reverse = action->reverse(); - auto seq = Sequence::create(action, reverse, NULL); + auto seq = Sequence::create(action, reverse, nullptr); _tamara->setPosition(Vec2(50,50)); _tamara->runAction(seq); @@ -1751,7 +1751,7 @@ void ActionCardinalSplineStacked::onEnter() Sequence::create( MoveBy::create(0.05f, Vec2(10,0)), MoveBy::create(0.05f, Vec2(-10,0)), - NULL))); + nullptr))); // // sprite 2 (By) @@ -1762,7 +1762,7 @@ void ActionCardinalSplineStacked::onEnter() auto *action2 = CardinalSplineBy::create(3, array, 1); auto reverse2 = action2->reverse(); - auto seq2 = Sequence::create(action2, reverse2, NULL); + auto seq2 = Sequence::create(action2, reverse2, nullptr); _kathia->setPosition(Vec2(s.width/2,50)); @@ -1773,7 +1773,7 @@ void ActionCardinalSplineStacked::onEnter() Sequence::create( MoveBy::create(0.05f, Vec2(10,0)), MoveBy::create(0.05f, Vec2(-10,0)), - NULL))); + nullptr))); array->retain(); _array = array; @@ -1925,7 +1925,7 @@ void Issue1305_2::onEnter() auto act7 = MoveBy::create(2, Vec2(-100, 0)); auto act8 = CallFunc::create( std::bind( &Issue1305_2::printLog4, this)); - auto actF = Sequence::create(act1, act2, act3, act4, act5, act6, act7, act8, NULL); + auto actF = Sequence::create(act1, act2, act3, act4, act5, act6, act7, act8, nullptr); // [spr runAction:actF); Director::getInstance()->getActionManager()->addAction(actF ,spr, false); @@ -1973,7 +1973,7 @@ void Issue1288::onEnter() auto act1 = MoveBy::create(0.5, Vec2(100, 0)); auto act2 = act1->reverse(); - auto act3 = Sequence::create(act1, act2, NULL); + auto act3 = Sequence::create(act1, act2, nullptr); auto act4 = Repeat::create(act3, 2); spr->runAction(act4); @@ -2032,7 +2032,7 @@ void Issue1327::onEnter() auto act8 = RotateBy::create(0.25, 45); auto act9 = CallFunc::create( std::bind(&Issue1327::logSprRotation, this, spr)); - auto actF = Sequence::create(act1, act2, act3, act4, act5, act6, act7, act8, act9, NULL); + auto actF = Sequence::create(act1, act2, act3, act4, act5, act6, act7, act8, act9, nullptr); spr->runAction(actF); } @@ -2076,7 +2076,7 @@ void Issue1398::onEnter() CallFunc::create( std::bind(&Issue1398::incrementIntegerCallback, this, (void*)"6")), CallFunc::create( std::bind(&Issue1398::incrementIntegerCallback, this, (void*)"7")), CallFunc::create( std::bind(&Issue1398::incrementIntegerCallback, this, (void*)"8")), - NULL)); + nullptr)); } void Issue1398::incrementIntegerCallback(void* data) @@ -2159,7 +2159,7 @@ void ActionCatmullRom::onEnter() auto action = CatmullRomBy::create(3, array); auto reverse = action->reverse(); - auto seq = Sequence::create(action, reverse, NULL); + auto seq = Sequence::create(action, reverse, nullptr); _tamara->runAction(seq); @@ -2182,7 +2182,7 @@ void ActionCatmullRom::onEnter() auto action2 = CatmullRomTo::create(3, array2); auto reverse2 = action2->reverse(); - auto seq2 = Sequence::create(action2, reverse2, NULL); + auto seq2 = Sequence::create(action2, reverse2, nullptr); _kathia->runAction(seq2); @@ -2275,7 +2275,7 @@ void ActionCardinalSpline::onEnter() auto action = CardinalSplineBy::create(3, array, 0); auto reverse = action->reverse(); - auto seq = Sequence::create(action, reverse, NULL); + auto seq = Sequence::create(action, reverse, nullptr); _tamara->setPosition(Vec2(50, 50)); _tamara->runAction(seq); @@ -2289,7 +2289,7 @@ void ActionCardinalSpline::onEnter() auto action2 = CardinalSplineBy::create(3, array, 1); auto reverse2 = action2->reverse(); - auto seq2 = Sequence::create(action2, reverse2, NULL); + auto seq2 = Sequence::create(action2, reverse2, nullptr); _kathia->setPosition(Vec2(s.width/2, 50)); _kathia->runAction(seq2); @@ -2428,7 +2428,7 @@ void ActionRemoveSelf::onEnter() RotateBy::create( 2, 540), ScaleTo::create(1,0.1f), RemoveSelf::create(), - NULL); + nullptr); _grossini->runAction(action); } diff --git a/tests/cpp-tests/Classes/BaseTest.cpp b/tests/cpp-tests/Classes/BaseTest.cpp index 75c4bc275a..cf288559cb 100644 --- a/tests/cpp-tests/Classes/BaseTest.cpp +++ b/tests/cpp-tests/Classes/BaseTest.cpp @@ -58,7 +58,7 @@ void BaseTest::onEnter() auto item2 = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(BaseTest::restartCallback, this) ); auto item3 = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(BaseTest::nextCallback, this) ); - auto menu = Menu::create(item1, item2, item3, NULL); + auto menu = Menu::create(item1, item2, item3, nullptr); menu->setPosition(Vec2::ZERO); item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); diff --git a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp index 5cac77d929..55acd668e8 100644 --- a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp +++ b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp @@ -130,7 +130,7 @@ void Box2DTestLayer::createResetButton() s->release(); }); - auto menu = Menu::create(reset, NULL); + auto menu = Menu::create(reset, nullptr); menu->setPosition(Vec2(VisibleRect::bottom().x, VisibleRect::bottom().y + 30)); this->addChild(menu, -1); diff --git a/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp b/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp index dfadb55929..1c815f3341 100644 --- a/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp +++ b/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp @@ -67,7 +67,7 @@ bool MenuLayer::initWithEntryID(int entryId) auto item2 = MenuItemImage::create("Images/r1.png","Images/r2.png", CC_CALLBACK_1( MenuLayer::restartCallback, this) ); auto item3 = MenuItemImage::create("Images/f1.png", "Images/f2.png", CC_CALLBACK_1(MenuLayer::nextCallback, this) ); - auto menu = Menu::create(item1, item2, item3, NULL); + auto menu = Menu::create(item1, item2, item3, nullptr); menu->setPosition( Vec2::ZERO ); item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); diff --git a/tests/cpp-tests/Classes/Box2DTestBed/Test.cpp b/tests/cpp-tests/Classes/Box2DTestBed/Test.cpp index be95c13f45..556ab4f9a3 100644 --- a/tests/cpp-tests/Classes/Box2DTestBed/Test.cpp +++ b/tests/cpp-tests/Classes/Box2DTestBed/Test.cpp @@ -25,7 +25,7 @@ void DestructionListener::SayGoodbye(b2Joint* joint) { if (test->m_mouseJoint == joint) { - test->m_mouseJoint = NULL; + test->m_mouseJoint = nullptr; } else { @@ -38,9 +38,9 @@ Test::Test() b2Vec2 gravity; gravity.Set(0.0f, -10.0f); m_world = new b2World(gravity); - m_bomb = NULL; + m_bomb = nullptr; m_textLine = 30; - m_mouseJoint = NULL; + m_mouseJoint = nullptr; m_pointCount = 0; m_destructionListener.test = this; @@ -63,7 +63,7 @@ Test::~Test() { // By deleting the world, we delete the bomb, mouse joint, etc. delete m_world; - m_world = NULL; + m_world = nullptr; } void Test::PreSolve(b2Contact* contact, const b2Manifold* oldManifold) @@ -111,7 +111,7 @@ public: QueryCallback(const b2Vec2& point) { m_point = point; - m_fixture = NULL; + m_fixture = nullptr; } bool ReportFixture(b2Fixture* fixture) @@ -141,7 +141,7 @@ bool Test::MouseDown(const b2Vec2& p) { m_mouseWorld = p; - if (m_mouseJoint != NULL) + if (m_mouseJoint != nullptr) { return false; } @@ -197,7 +197,7 @@ void Test::ShiftMouseDown(const b2Vec2& p) { m_mouseWorld = p; - if (m_mouseJoint != NULL) + if (m_mouseJoint != nullptr) { return; } @@ -210,7 +210,7 @@ void Test::MouseUp(const b2Vec2& p) if (m_mouseJoint) { m_world->DestroyJoint(m_mouseJoint); - m_mouseJoint = NULL; + m_mouseJoint = nullptr; } if (m_bombSpawning) @@ -241,7 +241,7 @@ void Test::LaunchBomb(const b2Vec2& position, const b2Vec2& velocity) if (m_bomb) { m_world->DestroyBody(m_bomb); - m_bomb = NULL; + m_bomb = nullptr; } b2BodyDef bd; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp index 2a6ef994e9..87e1d9f3ef 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-1159.cpp @@ -37,7 +37,7 @@ bool Bug1159Layer::init() sprite_a->runAction(RepeatForever::create(Sequence::create( MoveTo::create(1.0f, Vec2(1024.0f, 384.0f)), MoveTo::create(1.0f, Vec2(0.0f, 384.0f)), - NULL))); + nullptr))); auto sprite_b = LayerColor::create(Color4B(0, 0, 255, 255), 400, 400); sprite_b->setAnchorPoint(Vec2(0.5f, 0.5f)); @@ -46,7 +46,7 @@ bool Bug1159Layer::init() addChild(sprite_b); auto label = MenuItemLabel::create(Label::createWithSystemFont("Flip Me", "Helvetica", 24), CC_CALLBACK_1(Bug1159Layer::callBack, this) ); - auto menu = Menu::create(label, NULL); + auto menu = Menu::create(label, nullptr); menu->setPosition(Vec2(s.width - 200.0f, 50.0f)); addChild(menu); diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-422.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-422.cpp index 70897f806d..1cfa8861ff 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-422.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-422.cpp @@ -34,7 +34,7 @@ void Bug422Layer::reset() auto item1 = MenuItemFont::create("One", CC_CALLBACK_1(Bug422Layer::menuCallback, this) ); log("MenuItemFont: %p", item1); MenuItem *item2 = MenuItemFont::create("Two", CC_CALLBACK_1(Bug422Layer::menuCallback, this) ); - auto menu = Menu::create(item1, item2, NULL); + auto menu = Menu::create(item1, item2, nullptr); menu->alignItemsVertically(); float x = CCRANDOM_0_1() * 50; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-458/Bug-458.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-458/Bug-458.cpp index 46d61358cc..b8fa720c69 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-458/Bug-458.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-458/Bug-458.cpp @@ -28,7 +28,7 @@ bool Bug458Layer::init() auto layer2 = LayerColor::create(Color4B(255,0,0,255), 100, 100); auto sprite2 = MenuItemSprite::create(layer, layer2, CC_CALLBACK_1(Bug458Layer::selectAnswer, this) ); - auto menu = Menu::create(sprite, sprite2, NULL); + auto menu = Menu::create(sprite, sprite2, nullptr); menu->alignItemsVerticallyWithPadding(100); menu->setPosition(Vec2(size.width / 2, size.height / 2)); diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-914.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-914.cpp index 75c601d90f..5084bc63a1 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-914.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-914.cpp @@ -52,7 +52,7 @@ bool Bug914Layer::init() auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 64.0f); auto item1 = MenuItemFont::create("restart", CC_CALLBACK_1(Bug914Layer::restart, this)); - auto menu = Menu::create(item1, NULL); + auto menu = Menu::create(item1, nullptr); menu->alignItemsVertically(); menu->setPosition(Vec2(size.width/2, 100)); addChild(menu); diff --git a/tests/cpp-tests/Classes/BugsTest/BugsTest.cpp b/tests/cpp-tests/Classes/BugsTest/BugsTest.cpp index 63ed76bcc5..aee50d9cee 100644 --- a/tests/cpp-tests/Classes/BugsTest/BugsTest.cpp +++ b/tests/cpp-tests/Classes/BugsTest/BugsTest.cpp @@ -120,7 +120,7 @@ void BugsTestBaseLayer::onEnter() MenuItemFont::setFontSize(24); auto pMainItem = MenuItemFont::create("Back", CC_CALLBACK_1(BugsTestBaseLayer::backCallback, this)); pMainItem->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto menu = Menu::create(pMainItem, NULL); + auto menu = Menu::create(pMainItem, nullptr); menu->setPosition( Vec2::ZERO ); addChild(menu); } diff --git a/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp b/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp index 6db9ab2492..c6b1672922 100644 --- a/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp +++ b/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp @@ -58,7 +58,7 @@ ChipmunkTestLayer::ChipmunkTestLayer() MenuItemFont::setFontSize(18); auto item = MenuItemFont::create("Toggle debug", CC_CALLBACK_1(ChipmunkTestLayer::toggleDebugCallback, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); this->addChild(menu); menu->setPosition(cocos2d::Vec2(VisibleRect::right().x-100, VisibleRect::top().y-60)); @@ -158,7 +158,7 @@ void ChipmunkTestLayer::createResetButton() { auto reset = MenuItemImage::create("Images/r1.png", "Images/r2.png", CC_CALLBACK_1(ChipmunkTestLayer::reset, this)); - auto menu = Menu::create(reset, NULL); + auto menu = Menu::create(reset, nullptr); menu->setPosition(cocos2d::Vec2(VisibleRect::center().x, VisibleRect::bottom().y + 30)); this->addChild(menu, -1); diff --git a/tests/cpp-tests/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp b/tests/cpp-tests/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp index aadceb2063..25fc7850d6 100644 --- a/tests/cpp-tests/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp +++ b/tests/cpp-tests/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp @@ -36,7 +36,7 @@ MainLayer::MainLayer() Sequence::create( FadeIn::create(1), FadeOut::create(1), - NULL) + nullptr) )); } diff --git a/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp b/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp index 9e5aae0d4b..5f40e0dbc7 100644 --- a/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp +++ b/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp @@ -170,7 +170,7 @@ Action* BasicTest::actionRotate() Action* BasicTest::actionScale() { auto scale = ScaleBy::create(1.33f, 1.5f); - return RepeatForever::create(Sequence::create(scale, scale->reverse(), NULL)); + return RepeatForever::create(Sequence::create(scale, scale->reverse(), nullptr)); } DrawNode* BasicTest::shape() @@ -195,7 +195,7 @@ Sprite* BasicTest::grossini() Node* BasicTest::stencil() { - return NULL; + return nullptr; } ClippingNode* BasicTest::clipper() @@ -205,7 +205,7 @@ ClippingNode* BasicTest::clipper() Node* BasicTest::content() { - return NULL; + return nullptr; } diff --git a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp index 7e81abb0db..249517baed 100644 --- a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp +++ b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp @@ -36,7 +36,7 @@ public: auto b = new Button(); if (b && !b->initSpriteButton(filePath)) { delete b; - b = NULL; + b = nullptr; } b->autorelease(); return b; @@ -47,7 +47,7 @@ public: auto b = new Button(); if (b && !b->initTextButton(text)) { delete b; - b = NULL; + b = nullptr; } b->autorelease(); return b; @@ -150,7 +150,7 @@ public: auto ret = new AudioSlider(direction); if (ret && !ret->init()) { delete ret; - ret = NULL; + ret = nullptr; } ret->autorelease(); return ret; diff --git a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp index 579ac9f61f..24dad2067e 100644 --- a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp +++ b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp @@ -258,7 +258,7 @@ void ConsoleUploadFile::uploadFile() If socket(2) (or connect(2)) fails, we (close the socket and) try the next address. */ - for (rp = result; rp != NULL; rp = rp->ai_next) { + for (rp = result; rp != nullptr; rp = rp->ai_next) { sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); if (sfd == -1) @@ -274,7 +274,7 @@ void ConsoleUploadFile::uploadFile() #endif } - if (rp == NULL) { /* No address succeeded */ + if (rp == nullptr) { /* No address succeeded */ CCLOG("ConsoleUploadFile: could not connect!"); return; } diff --git a/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp b/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp index f6b936ac1a..23ef32b8f2 100644 --- a/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp +++ b/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp @@ -37,8 +37,8 @@ void Effect1::onEnter() // auto orbit = OrbitCamera::create(5, 1, 2, 0, 180, 0, -90); // auto orbit_back = orbit->reverse(); - //_bgNode->runAction( RepeatForever::create( Sequence::create( orbit, orbit_back, NULL) ) ); - _bgNode->runAction( Sequence::create(lens, delay, reuse, waves, NULL) ); + //_bgNode->runAction( RepeatForever::create( Sequence::create( orbit, orbit_back, nullptr) ) ); + _bgNode->runAction( Sequence::create(lens, delay, reuse, waves, nullptr) ); } std::string Effect1::title() const @@ -79,7 +79,7 @@ void Effect2::onEnter() // id orbit_back = [orbit reverse]; // // [target runAction: [RepeatForever::create: [Sequence actions: orbit, orbit_back, nil]]]; - _bgNode->runAction(Sequence::create( shaky, delay, reuse, shuffle, delay->clone(), turnoff, turnon, NULL) ); + _bgNode->runAction(Sequence::create( shaky, delay, reuse, shuffle, delay->clone(), turnoff, turnon, nullptr) ); } std::string Effect2::title() const @@ -107,7 +107,7 @@ void Effect3::onEnter() // moving background. Testing issue #244 auto move = MoveBy::create(3, Vec2(200,0) ); - _bgNode->runAction(RepeatForever::create( Sequence::create(move, move->reverse(), NULL) )); + _bgNode->runAction(RepeatForever::create( Sequence::create(move, move->reverse(), nullptr) )); } std::string Effect3::title() const @@ -159,7 +159,7 @@ void Effect4::onEnter() auto lens = Lens3D::create(10, Size(32,24), Vec2(100,180), 150); auto move = JumpBy::create(5, Vec2(380,0), 100, 4); auto move_back = move->reverse(); - auto seq = Sequence::create( move, move_back, NULL); + auto seq = Sequence::create( move, move_back, nullptr); /* In cocos2d-iphone, the type of action's target is 'id', so it supports using the instance of 'Lens3D' as its target. While in cocos2d-x, the target of action only supports Node or its subclass, @@ -201,7 +201,7 @@ void Effect5::onEnter() StopGrid::create(), // [DelayTime::create:2], // [[effect copy] autorelease], - NULL); + nullptr); //auto bg = getChildByTag(kTagBackground); _bgNode->runAction(stopEffect); @@ -228,7 +228,7 @@ void Issue631::onEnter() { EffectAdvanceTextLayer::onEnter(); - auto effect = Sequence::create( DelayTime::create(2.0f), Shaky3D::create(5.0f, Size(5, 5), 16, false), NULL); + auto effect = Sequence::create( DelayTime::create(2.0f), Shaky3D::create(5.0f, Size(5, 5), 16, false), nullptr); // cleanup //auto bg = getChildByTag(kTagBackground); @@ -298,7 +298,7 @@ Layer* createEffectAdvanceLayer(int nIndex) case 5: return new Issue631(); } - return NULL; + return nullptr; } Layer* nextEffectAdvanceAction() @@ -356,7 +356,7 @@ void EffectAdvanceTextLayer::onEnter(void) _target1->setPosition( Vec2(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3.0f, VisibleRect::bottom().y+ 200) ); auto sc = ScaleBy::create(2, 5); auto sc_back = sc->reverse(); - _target1->runAction( RepeatForever::create(Sequence::create(sc, sc_back, NULL) ) ); + _target1->runAction( RepeatForever::create(Sequence::create(sc, sc_back, nullptr) ) ); _target2 = NodeGrid::create(); @@ -367,7 +367,7 @@ void EffectAdvanceTextLayer::onEnter(void) _target2->setPosition( Vec2(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3.0f,VisibleRect::bottom().y+200) ); auto sc2 = ScaleBy::create(2, 5); auto sc2_back = sc2->reverse(); - _target2->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, NULL) ) ); + _target2->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, nullptr) ) ); } diff --git a/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp b/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp index 4ef67521fe..724fb9846e 100644 --- a/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp +++ b/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp @@ -63,7 +63,7 @@ public: auto flipx_back = flipx->reverse(); auto delay = DelayTime::create(2); - return Sequence::create(flipx, delay, flipx_back, NULL); + return Sequence::create(flipx, delay, flipx_back, nullptr); } }; @@ -76,7 +76,7 @@ public: auto flipy_back = flipy->reverse(); auto delay = DelayTime::create(2); - return Sequence::create(flipy, delay, flipy_back, NULL); + return Sequence::create(flipy, delay, flipy_back, nullptr); } }; @@ -162,7 +162,7 @@ public: auto shuffle_back = shuffle->reverse(); auto delay = DelayTime::create(2); - return Sequence::create(shuffle, delay, shuffle_back, NULL); + return Sequence::create(shuffle, delay, shuffle_back, nullptr); } }; @@ -176,7 +176,7 @@ public: auto back = fadeout->reverse(); auto delay = DelayTime::create(0.5f); - return Sequence::create(fadeout, delay, back, NULL); + return Sequence::create(fadeout, delay, back, nullptr); } }; @@ -190,7 +190,7 @@ public: auto back = fadeout->reverse(); auto delay = DelayTime::create(0.5f); - return Sequence::create(fadeout, delay, back, NULL); + return Sequence::create(fadeout, delay, back, nullptr); } }; @@ -204,7 +204,7 @@ public: auto back = fadeout->reverse(); auto delay = DelayTime::create(0.5f); - return Sequence::create(fadeout, delay, back, NULL); + return Sequence::create(fadeout, delay, back, nullptr); } }; @@ -217,7 +217,7 @@ public: auto back = fadeout->reverse(); auto delay = DelayTime::create(0.5f); - return Sequence::create(fadeout, delay, back, NULL); + return Sequence::create(fadeout, delay, back, nullptr); } }; @@ -230,7 +230,7 @@ public: auto back = fadeout->reverse(); auto delay = DelayTime::create(0.5f); - return Sequence::create(fadeout, delay, back, NULL); + return Sequence::create(fadeout, delay, back, nullptr); } }; @@ -318,7 +318,7 @@ ActionInterval* createEffect(int nIndex, float t) case 21: return PageTurn3DDemo::create(t); } - return NULL; + return nullptr; } ActionInterval* getAction() @@ -357,14 +357,14 @@ TextLayer::TextLayer(void) grossini->setPosition( Vec2(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) ); auto sc = ScaleBy::create(2, 5); auto sc_back = sc->reverse(); - grossini->runAction( RepeatForever::create(Sequence::create(sc, sc_back, NULL) ) ); + grossini->runAction( RepeatForever::create(Sequence::create(sc, sc_back, nullptr) ) ); auto tamara = Sprite::create(s_pathSister1); _gridNodeTarget->addChild(tamara, 1); tamara->setPosition( Vec2(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) ); auto sc2 = ScaleBy::create(2, 5); auto sc2_back = sc2->reverse(); - tamara->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, NULL)) ); + tamara->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, nullptr)) ); auto label = Label::createWithTTF((effectsList[actionIdx]).c_str(), "fonts/Marker Felt.ttf", 32); @@ -378,7 +378,7 @@ TextLayer::TextLayer(void) void TextLayer::checkAnim(float dt) { //auto s2 = getChildByTag(kTagBackground); - if ( _gridNodeTarget->getNumberOfRunningActions() == 0 && _gridNodeTarget->getGrid() != NULL) + if ( _gridNodeTarget->getNumberOfRunningActions() == 0 && _gridNodeTarget->getGrid() != nullptr) _gridNodeTarget->setGrid(nullptr);; } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index 8e023e244d..b2cff48fa8 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp @@ -591,7 +591,7 @@ std::string TestFrameEvent::title() const { return "Test Frame Event"; } -void TestFrameEvent::onFrameEvent(Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex) +void TestFrameEvent::onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex) { CCLOG("(%s) emit a frame event (%s) at frame index (%d).", bone->getName().c_str(), evt.c_str(), currentFrameIndex); @@ -633,7 +633,7 @@ void TestParticleDisplay::onEnter() ParticleSystem *p1 = CCParticleSystemQuad::create("Particles/SmallSun.plist"); ParticleSystem *p2 = CCParticleSystemQuad::create("Particles/SmallSun.plist"); - Bone *bone = Bone::create("p1"); + cocostudio::Bone *bone = cocostudio::Bone::create("p1"); bone->addDisplay(p1, 0); bone->changeDisplayWithIndex(0, true); bone->setIgnoreMovementBoneData(true); @@ -641,7 +641,7 @@ void TestParticleDisplay::onEnter() bone->setScale(1.2f); armature->addBone(bone, "bady-a3"); - bone = Bone::create("p2"); + bone = cocostudio::Bone::create("p2"); bone->addDisplay(p2, 0); bone->changeDisplayWithIndex(0, true); bone->setIgnoreMovementBoneData(true); @@ -773,7 +773,7 @@ std::string TestColliderDetector::title() const { return "Test Collider Detector"; } -void TestColliderDetector::onFrameEvent(Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex) +void TestColliderDetector::onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex) { CCLOG("(%s) emit a frame event (%s) at frame index (%d).", bone->getName().c_str(), evt.c_str(), currentFrameIndex); @@ -1025,10 +1025,10 @@ void TestColliderDetector::update(float delta) // This code is just telling how to get the vertex. // For a more accurate collider detection, you need to implemente yourself. - const Map& map = armature2->getBoneDic(); + const Map& map = armature2->getBoneDic(); for(const auto& element : map) { - Bone *bone = element.second; + cocostudio::Bone *bone = element.second; ColliderDetector *detector = bone->getColliderDetector(); if (!detector) @@ -1243,7 +1243,7 @@ void Hero::changeMount(Armature *armature) removeFromParentAndCleanup(false); //Get the hero bone - Bone *bone = armature->getBone("hero"); + cocostudio::Bone *bone = armature->getBone("hero"); //Add hero as a display to this bone bone->addDisplay(this, 0); //Change this bone's display @@ -1387,7 +1387,7 @@ void TestPlaySeveralMovement::onEnter() // int index[] = {0, 1, 2}; // std::vector indexes(index, index+3); - Armature *armature = NULL; + Armature *armature = nullptr; armature = Armature::create("Cowboy"); armature->getAnimation()->playWithNames(names); // armature->getAnimation()->playWithIndexes(indexes); @@ -1458,7 +1458,7 @@ void TestChangeAnimationInternal::onEnter() listener->onTouchesEnded = CC_CALLBACK_2(TestPlaySeveralMovement::onTouchesEnded, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); - Armature *armature = NULL; + Armature *armature = nullptr; armature = Armature::create("Cowboy"); armature->getAnimation()->playWithIndex(0); armature->setScale(0.2f); @@ -1558,7 +1558,7 @@ void TestLoadFromBinary::onTouchesEnded(const std::vector& touches, Even m_armatureIndex = -2; // is loading } - else if(m_armatureIndex>=0 && m_armature != NULL) + else if(m_armatureIndex>=0 && m_armature != nullptr) { this->removeChild(m_armature); m_armatureIndex = m_armatureIndex==BINARYFILECOUNT-1 ? 0 : m_armatureIndex+1; diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.cpp index 8953849118..4c5589b3d0 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioComponentsTest/ProjectileController.cpp @@ -133,7 +133,7 @@ void ProjectileController::move(float flocationX, float flocationY) Sequence::create( MoveTo::create(realMoveDuration, realDest), callfunc, - NULL) + nullptr) ); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp index e560953416..453b2189f9 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/SceneEditorTest.cpp @@ -131,7 +131,7 @@ void SceneEditorTestLayer::onEnter() _loadtypelb = cocos2d::Label::createWithSystemFont(_loadtypeStr[0], "Arial", 12); // #endif MenuItemLabel* itemlb = CCMenuItemLabel::create(_loadtypelb, CC_CALLBACK_1(SceneEditorTestLayer::changeLoadTypeCallback, this)); - Menu* loadtypemenu = CCMenu::create(itemlb, NULL); + Menu* loadtypemenu = CCMenu::create(itemlb, nullptr); loadtypemenu->setPosition(Point(VisibleRect::rightTop().x -50,VisibleRect::rightTop().y -20)); addChild(loadtypemenu,100); @@ -212,11 +212,11 @@ void SceneEditorTestLayer::changeLoadTypeCallback(cocos2d::Ref *pSender) _loadtypelb->setString(_loadtypeStr[(int)_isCsbLoad]); loadFileChangeHelper(_filePath); - if(_rootNode != NULL) + if(_rootNode != nullptr) { this->removeChild(_rootNode); _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { return ; } @@ -277,9 +277,9 @@ cocos2d::Node* LoadSceneEdtiorFileTest::createGameScene() { _filePath = "scenetest/LoadSceneEdtiorFileTest/FishJoy2.json"; //default is json _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); return _rootNode; @@ -329,9 +329,9 @@ cocos2d::Node* SpriteComponentTest::createGameScene() { _filePath = "scenetest/SpriteComponentTest/SpriteComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); @@ -391,9 +391,9 @@ cocos2d::Node* ArmatureComponentTest::createGameScene() { _filePath = "scenetest/ArmatureComponentTest/ArmatureComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); return _rootNode; @@ -447,9 +447,9 @@ cocos2d::Node* UIComponentTest::createGameScene() { _filePath = "scenetest/UIComponentTest/UIComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); @@ -522,9 +522,9 @@ cocos2d::Node* TmxMapComponentTest::createGameScene() { _filePath = "scenetest/TmxMapComponentTest/TmxMapComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); return _rootNode; @@ -541,9 +541,9 @@ void TmxMapComponentTest::defaultPlay() ActionInterval *rotateToBack = CCRotateTo::create(2, 0); ActionInterval *actionToBack = CCSkewTo::create(2, 0, 0); - tmxMap->getNode()->runAction(CCSequence::create(actionTo, actionToBack, NULL)); - tmxMap->getNode()->runAction(CCSequence::create(rotateTo, rotateToBack, NULL)); - tmxMap->getNode()->runAction(CCSequence::create(actionScaleTo, actionScaleToBack, NULL)); + tmxMap->getNode()->runAction(CCSequence::create(actionTo, actionToBack, nullptr)); + tmxMap->getNode()->runAction(CCSequence::create(rotateTo, rotateToBack, nullptr)); + tmxMap->getNode()->runAction(CCSequence::create(actionScaleTo, actionScaleToBack, nullptr)); } ParticleComponentTest::ParticleComponentTest() @@ -584,9 +584,9 @@ cocos2d::Node* ParticleComponentTest::createGameScene() { _filePath = "scenetest/ParticleComponentTest/ParticleComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); return _rootNode; @@ -596,7 +596,7 @@ void ParticleComponentTest::defaultPlay() { ComRender* Particle = static_cast(_rootNode->getChildByTag(10020)->getComponent("CCParticleSystemQuad")); ActionInterval* jump = CCJumpBy::create(5, Point(-500,0), 50, 4); - FiniteTimeAction* action = CCSequence::create( jump, jump->reverse(), NULL); + FiniteTimeAction* action = CCSequence::create( jump, jump->reverse(), nullptr); Particle->getNode()->runAction(action); } @@ -639,9 +639,9 @@ cocos2d::Node* EffectComponentTest::createGameScene() { _filePath = "scenetest/EffectComponentTest/EffectComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); return _rootNode; @@ -706,9 +706,9 @@ cocos2d::Node* BackgroundComponentTest::createGameScene() { _filePath = "scenetest/BackgroundComponentTest/BackgroundComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); return _rootNode; @@ -775,9 +775,9 @@ cocos2d::Node* AttributeComponentTest::createGameScene() { _filePath = "scenetest/AttributeComponentTest/AttributeComponentTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } return _rootNode; } @@ -869,9 +869,9 @@ cocos2d::Node* TriggerTest::createGameScene() { _filePath = "scenetest/TriggerTest/TriggerTest.json"; _rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str()); - if (_rootNode == NULL) + if (_rootNode == nullptr) { - return NULL; + return nullptr; } defaultPlay(); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/acts.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/acts.cpp index f9c9f39337..d48f64e1e7 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/acts.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/acts.cpp @@ -71,7 +71,7 @@ void PlayMusic::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -80,14 +80,14 @@ void PlayMusic::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str);//DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "componentName") { - if (str != NULL) + if (str != nullptr) { _comName = str; //DICTOOL->getStringValue_json(subDict, "value"); } @@ -95,7 +95,7 @@ void PlayMusic::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp } else if (key == "type") { - if (str != NULL) + if (str != nullptr) { _type = atoi(str); //DICTOOL->getIntValue_json(subDict, "value"); } @@ -171,7 +171,7 @@ void TMoveTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -180,14 +180,14 @@ void TMoveTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -195,14 +195,14 @@ void TMoveTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo } else if (key == "x") { - if (str != NULL) + if (str != nullptr) { _pos.x = atof(str); } } else if (key == "y") { - if (str != NULL) + if (str != nullptr) { _pos.y = atoi(str); } @@ -293,7 +293,7 @@ void TMoveBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -302,14 +302,14 @@ void TMoveBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -317,21 +317,21 @@ void TMoveBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo } else if (key == "x") { - if (str != NULL) + if (str != nullptr) { _pos.x = atof(str); } } else if (key == "y") { - if (str != NULL) + if (str != nullptr) { _pos.y = atof(str); } } else if (key == "IsReverse") { - if (str != NULL) + if (str != nullptr) { _reverse = atoi(str)!=0?true:false; //DICTOOL->getIntValue_json(subDict, "value") != 0? true: false; } @@ -406,7 +406,7 @@ void TRotateTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -415,14 +415,14 @@ void TRotateTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -430,7 +430,7 @@ void TRotateTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp } else if (key == "DeltaAngle") { - if (str != NULL) + if (str != nullptr) { _deltaAngle = atof(str); } @@ -519,7 +519,7 @@ void TRotateBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -528,14 +528,14 @@ void TRotateBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -543,14 +543,14 @@ void TRotateBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExp } else if (key == "DeltaAngle") { - if (str != NULL) + if (str != nullptr) { _deltaAngle = atof(str); } } else if (key == "IsReverse") { - if (str != NULL) + if (str != nullptr) { _reverse = atoi(str)!=0?true:false; } @@ -629,7 +629,7 @@ void TScaleTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -638,14 +638,14 @@ void TScaleTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -653,14 +653,14 @@ void TScaleTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC } else if (key == "ScaleX") { - if (str != NULL) + if (str != nullptr) { _scale.x = atof(str); } } else if (key == "ScaleY") { - if (str != NULL) + if (str != nullptr) { _scale.y = atof(str); } @@ -753,7 +753,7 @@ void TScaleBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -762,14 +762,14 @@ void TScaleBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -777,21 +777,21 @@ void TScaleBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpC } else if (key == "ScaleX") { - if (str != NULL) + if (str != nullptr) { _scale.x = atof(str); } } else if (key == "ScaleY") { - if (str != NULL) + if (str != nullptr) { _scale.y = atof(str); } } else if (key == "IsReverse") { - if (str != NULL) + if (str != nullptr) { _reverse = atoi(str)!=0?true:false; //DICTOOL->getIntValue_json(subDict, "value")!= 0? true:false; } @@ -871,7 +871,7 @@ void TSkewTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -880,14 +880,14 @@ void TSkewTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -895,14 +895,14 @@ void TSkewTo::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo } else if (key == "SkewX") { - if (str != NULL) + if (str != nullptr) { _skew.x = atof(str); } } else if (key == "SkewY") { - if (str != NULL) + if (str != nullptr) { _skew.y = atof(str); } @@ -994,7 +994,7 @@ void TSkewBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -1003,14 +1003,14 @@ void TSkewBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str); } } else if (key == "Duration") { - if (str != NULL) + if (str != nullptr) { _duration = atof(str); } @@ -1018,14 +1018,14 @@ void TSkewBy::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCo } else if (key == "SkewX") { - if (str != NULL) + if (str != nullptr) { _skew.x = atof(str); } } else if (key == "SkewY") { - if (str != NULL) + if (str != nullptr) { _skew.y = atof(str); } @@ -1108,7 +1108,7 @@ void TriggerState::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::st int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -1117,14 +1117,14 @@ void TriggerState::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::st str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "ID") { - if (str != NULL) + if (str != nullptr) { _id = atoi(str); } } else if (key == "State") { - if (str != NULL) + if (str != nullptr) { _state = atoi(str); } @@ -1197,7 +1197,7 @@ void ArmaturePlayAction::serialize(cocostudio::CocoLoader *pCocoLoader, cocostud int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -1206,14 +1206,14 @@ void ArmaturePlayAction::serialize(cocostudio::CocoLoader *pCocoLoader, cocostud str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str);//DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "componentName") { - if (str != NULL) + if (str != nullptr) { _comName = str; //DICTOOL->getStringValue_json(subDict, "value"); } @@ -1221,7 +1221,7 @@ void ArmaturePlayAction::serialize(cocostudio::CocoLoader *pCocoLoader, cocostud } else if (key == "AnimationName") { - if (str != NULL) + if (str != nullptr) { _aniname = str; //DICTOOL->getStringValue_json(subDict, "value"); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/cons.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/cons.cpp index a33b2bd455..9ed21d1579 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/cons.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioSceneTest/TriggerCode/cons.cpp @@ -53,7 +53,7 @@ void TimeElapsed::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stE int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -62,7 +62,7 @@ void TimeElapsed::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stE str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "TotalTime") { - if (str != NULL) + if (str != nullptr) { _totalTime = atof(str); //DICTOOL->getFloatValue_json(subDict, "value"); } @@ -153,7 +153,7 @@ void ArmatureActionState::serialize(cocostudio::CocoLoader *pCocoLoader, cocostu int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -162,14 +162,14 @@ void ArmatureActionState::serialize(cocostudio::CocoLoader *pCocoLoader, cocostu str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str);//DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "componentName") { - if (str != NULL) + if (str != nullptr) { _comName = str; //DICTOOL->getStringValue_json(subDict, "value"); } @@ -177,14 +177,14 @@ void ArmatureActionState::serialize(cocostudio::CocoLoader *pCocoLoader, cocostu } else if (key == "AnimationName") { - if (str != NULL) + if (str != nullptr) { _aniname = str; //DICTOOL->getStringValue_json(subDict, "value"); } } else if (key == "ActionType") { - if (str != NULL) + if (str != nullptr) { _state = atoi(str); //DICTOOL->getIntValue_json(subDict, "value"); } @@ -281,7 +281,7 @@ void NodeInRect::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stEx int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -290,35 +290,35 @@ void NodeInRect::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stEx str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str);//DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "originX") { - if (str != NULL) + if (str != nullptr) { _origin.x = atoi(str); //DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "originY") { - if (str != NULL) + if (str != nullptr) { _origin.y = atoi(str); //DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "sizeWidth") { - if (str != NULL) + if (str != nullptr) { _size.width = atoi(str); //DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "sizeHeight") { - if (str != NULL) + if (str != nullptr) { _size.height = atoi(str); //DICTOOL->getIntValue_json(subDict, "value"); } @@ -383,7 +383,7 @@ void NodeVisible::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stE int count = 0; stExpCocoNode *pDataItemsArray = pCocoNode->GetChildArray(pCocoLoader); std::string key; - const char *str = NULL; + const char *str = nullptr; for (int i = 0; i < length; ++i) { count = pDataItemsArray[i].GetChildNum(); @@ -392,14 +392,14 @@ void NodeVisible::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stE str = pDataItemArray[1].GetValue(pCocoLoader); if (key == "Tag") { - if (str != NULL) + if (str != nullptr) { _tag = atoi(str);//DICTOOL->getIntValue_json(subDict, "value"); } } else if (key == "Visible") { - if (str != NULL) + if (str != nullptr) { _visible = atoi(str) != 0? true:false;//DICTOOL->getIntValue_json(subDict, "value") != 0? true:false; } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp index 5be1a5b633..b073dc712e 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp @@ -15,7 +15,7 @@ AnimationsTestLayer::~AnimationsTestLayer() SEL_MenuHandler AnimationsTestLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, const char * pSelectorName) { - return NULL; + return nullptr; } Control::Handler AnimationsTestLayer::onResolveCCBCCControlSelector(Ref *pTarget, const char*pSelectorName) @@ -25,7 +25,7 @@ Control::Handler AnimationsTestLayer::onResolveCCBCCControlSelector(Ref *pTarget CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonJumpClicked", AnimationsTestLayer::onControlButtonJumpClicked); CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonFunkyClicked", AnimationsTestLayer::onControlButtonFunkyClicked); - return NULL; + return nullptr; } bool AnimationsTestLayer::onAssignCCBMemberVariable(Ref * pTarget, const char * pMemberVariableName, Node * pNode) { diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp index 13b7d55000..340ac0773f 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp @@ -14,13 +14,13 @@ ButtonTestLayer::~ButtonTestLayer() } SEL_MenuHandler ButtonTestLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, const char * pSelectorName) { - return NULL; + return nullptr; } Control::Handler ButtonTestLayer::onResolveCCBCCControlSelector(Ref * pTarget, const char * pSelectorName) { CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCCControlButtonClicked", ButtonTestLayer::onControlButtonClicked); - return NULL; + return nullptr; } bool ButtonTestLayer::onAssignCCBMemberVariable(Ref * pTarget, const char * pMemberVariableName, Node * pNode) { diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp index f63af2aca5..c367915891 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp @@ -44,7 +44,7 @@ void CocosBuilderTestScene::runThisTest() { ccbReader->release(); - if(node != NULL) { + if(node != nullptr) { this->addChild(node); } @@ -65,7 +65,7 @@ void CocosBuilderTestScene::runThisTest() { // /* Read a ccbi file. */ // auto node = ccbReader->readNodeGraphFromFile("ccb/simple/pub/", "ccb/test.ccbi", ccbiReaderLayer); // -// if(node != NULL) { +// if(node != nullptr) { // ccbiReaderLayer->addChild(node); // } // diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp index 36a83eb5cc..b8769819da 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp @@ -30,7 +30,7 @@ void HelloCocosBuilderLayer::openTest(const char * pCCBFileName, const char * no NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary(); ccNodeLoaderLibrary->registerNodeLoader("TestHeaderLayer", TestHeaderLayerLoader::loader()); - if(nodeName != NULL && nodeLoader != NULL) { + if(nodeName != nullptr && nodeLoader != nullptr) { ccNodeLoaderLibrary->registerNodeLoader(nodeName, nodeLoader); } @@ -48,7 +48,7 @@ void HelloCocosBuilderLayer::openTest(const char * pCCBFileName, const char * no this->mTestTitleLabelTTF->setString(pCCBFileName); auto scene = Scene::create(); - if(node != NULL) { + if(node != nullptr) { scene->addChild(node); } @@ -70,7 +70,7 @@ void HelloCocosBuilderLayer::onNodeLoaded(cocos2d::Node * node, cocosbuilder::N SEL_MenuHandler HelloCocosBuilderLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, const char * pSelectorName) { - return NULL; + return nullptr; } Control::Handler HelloCocosBuilderLayer::onResolveCCBCCControlSelector(Ref * pTarget, const char * pSelectorName) { @@ -82,7 +82,7 @@ Control::Handler HelloCocosBuilderLayer::onResolveCCBCCControlSelector(Ref * pTa CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onScrollViewTestClicked", HelloCocosBuilderLayer::onScrollViewTestClicked); CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onTimelineCallbackSoundClicked", HelloCocosBuilderLayer::onTimelineCallbackSoundClicked); - return NULL; + return nullptr; } bool HelloCocosBuilderLayer::onAssignCCBMemberVariable(Ref * pTarget, const char * pMemberVariableName, Node * pNode) { @@ -164,7 +164,7 @@ void HelloCocosBuilderLayer::onAnimationsTestClicked(Ref * sender, Control::Even this->mTestTitleLabelTTF->setString("TestAnimations.ccbi"); auto scene = Scene::create(); - if(animationsTest != NULL) { + if(animationsTest != nullptr) { scene->addChild(animationsTest); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp index 822c007ed4..c01c44fd94 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp @@ -7,12 +7,12 @@ using namespace cocosbuilder; SEL_MenuHandler TestHeaderLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, const char * pSelectorName) { CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(this, "onBackClicked", TestHeaderLayer::onBackClicked); - return NULL; + return nullptr; } Control::Handler TestHeaderLayer::onResolveCCBCCControlSelector(Ref * pTarget, const char * pSelectorName) { - return NULL; + return nullptr; } void TestHeaderLayer::onNodeLoaded(cocos2d::Node * node, cocosbuilder::NodeLoader * nodeLoader) diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp index f4c16a3956..41776bb373 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp @@ -15,18 +15,18 @@ TimelineCallbackTestLayer::~TimelineCallbackTestLayer() } SEL_MenuHandler TimelineCallbackTestLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, const char * pSelectorName) { - return NULL; + return nullptr; } Control::Handler TimelineCallbackTestLayer::onResolveCCBCCControlSelector(Ref * pTarget, const char * pSelectorName) { - return NULL; + return nullptr; } SEL_CallFuncN TimelineCallbackTestLayer::onResolveCCBCCCallFuncSelector(Ref * pTarget, const char* pSelectorName) { CCB_SELECTORRESOLVER_CALLFUNC_GLUE(this, "onCallback1", TimelineCallbackTestLayer::onCallback1); CCB_SELECTORRESOLVER_CALLFUNC_GLUE(this, "onCallback2", TimelineCallbackTestLayer::onCallback2); - return NULL; + return nullptr; } bool TimelineCallbackTestLayer::onAssignCCBMemberVariable(Ref * pTarget, const char * pMemberVariableName, Node * pNode) { diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp index 53f0a9028c..764bd139f3 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp @@ -44,7 +44,7 @@ bool ControlScene::init() { auto pBackItem = MenuItemFont::create("Back", CC_CALLBACK_1(ControlScene::toExtensionsMainLayer, this)); pBackItem->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto pBackMenu = Menu::create(pBackItem, NULL); + auto pBackMenu = Menu::create(pBackItem, nullptr); pBackMenu->setPosition( Vec2::ZERO ); addChild(pBackMenu, 10); @@ -69,7 +69,7 @@ bool ControlScene::init() auto item2 = MenuItemImage::create("Images/r1.png", "Images/r2.png", CC_CALLBACK_1(ControlScene::restartCallback, this)); auto item3 = MenuItemImage::create("Images/f1.png", "Images/f2.png", CC_CALLBACK_1(ControlScene::nextCallback, this)); - auto menu = Menu::create(item1, item3, item2, NULL); + auto menu = Menu::create(item1, item3, item2, nullptr); menu->setPosition(Vec2::ZERO); item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); item2->setPosition(Vec2(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSceneManager.cpp b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSceneManager.cpp index 2c5105c8c1..fb0f2d7128 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSceneManager.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/ControlExtensionTest/CCControlSceneManager.cpp @@ -58,7 +58,7 @@ static const char* s_testArray[] = { "CCControlStepperTest" }; -static ControlSceneManager *sharedInstance = NULL; +static ControlSceneManager *sharedInstance = nullptr; ControlSceneManager::ControlSceneManager() @@ -73,7 +73,7 @@ ControlSceneManager::~ControlSceneManager() ControlSceneManager * ControlSceneManager::sharedControlSceneManager() { - if (sharedInstance == NULL) + if (sharedInstance == nullptr) { sharedInstance = new ControlSceneManager(); } @@ -111,5 +111,5 @@ Scene *ControlSceneManager::currentControlScene() case kControlPotentiometerTest:return ControlPotentiometerTest::sceneWithTitle(s_testArray[_currentControlSceneId]); case kControlStepperTest:return ControlStepperTest::sceneWithTitle(s_testArray[_currentControlSceneId]); } - return NULL; + return nullptr; } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp index 8d465d6390..b54a42aa32 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp @@ -30,7 +30,7 @@ EditBoxTest::EditBoxTest() // Back Menu auto itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(EditBoxTest::toExtensionsMainLayer, this)); itemBack->setPosition(Vec2(visibleOrigin.x+visibleSize.width - 50, visibleOrigin.y+25)); - auto menuBack = Menu::create(itemBack, NULL); + auto menuBack = Menu::create(itemBack, nullptr); menuBack->setPosition(Vec2::ZERO); addChild(menuBack); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp index 46ff3e394e..ed957a8ef4 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp @@ -93,7 +93,7 @@ HttpClientTest::HttpClientTest() // Back Menu auto itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(HttpClientTest::toExtensionsMainLayer, this)); itemBack->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto menuBack = Menu::create(itemBack, NULL); + auto menuBack = Menu::create(itemBack, nullptr); menuBack->setPosition(Vec2::ZERO); addChild(menuBack); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp index 8d6688c96f..7cb06136ad 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp @@ -18,7 +18,7 @@ SocketIOTestLayer::SocketIOTestLayer(void) : _sioClient(nullptr) , _sioEndpoint(nullptr) { - //set the clients to NULL until we are ready to connect + //set the clients to nullptr until we are ready to connect Size winSize = Director::getInstance()->getWinSize(); @@ -90,7 +90,7 @@ SocketIOTestLayer::SocketIOTestLayer(void) // Back Menu auto itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(SocketIOTestLayer::toExtensionsMainLayer, this)); itemBack->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto menuBack = Menu::create(itemBack, NULL); + auto menuBack = Menu::create(itemBack, nullptr); menuBack->setPosition(Vec2::ZERO); addChild(menuBack); @@ -163,45 +163,45 @@ void SocketIOTestLayer::onMenuSIOEndpointClicked(cocos2d::Ref *sender) void SocketIOTestLayer::onMenuTestMessageClicked(cocos2d::Ref *sender) { - //check that the socket is != NULL before sending or emitting events - //the client should be NULL either before initialization and connection or after disconnect - if(_sioClient != NULL) _sioClient->send("Hello Socket.IO!"); + //check that the socket is != nullptr before sending or emitting events + //the client should be nullptr either before initialization and connection or after disconnect + if(_sioClient != nullptr) _sioClient->send("Hello Socket.IO!"); } void SocketIOTestLayer::onMenuTestMessageEndpointClicked(cocos2d::Ref *sender) { - if(_sioEndpoint != NULL) _sioEndpoint->send("Hello Socket.IO!"); + if(_sioEndpoint != nullptr) _sioEndpoint->send("Hello Socket.IO!"); } void SocketIOTestLayer::onMenuTestEventClicked(cocos2d::Ref *sender) { - //check that the socket is != NULL before sending or emitting events - //the client should be NULL either before initialization and connection or after disconnect - if(_sioClient != NULL) _sioClient->emit("echotest","[{\"name\":\"myname\",\"type\":\"mytype\"}]"); + //check that the socket is != nullptr before sending or emitting events + //the client should be nullptr either before initialization and connection or after disconnect + if(_sioClient != nullptr) _sioClient->emit("echotest","[{\"name\":\"myname\",\"type\":\"mytype\"}]"); } void SocketIOTestLayer::onMenuTestEventEndpointClicked(cocos2d::Ref *sender) { - if(_sioEndpoint != NULL) _sioEndpoint->emit("echotest","[{\"name\":\"myname\",\"type\":\"mytype\"}]"); + if(_sioEndpoint != nullptr) _sioEndpoint->emit("echotest","[{\"name\":\"myname\",\"type\":\"mytype\"}]"); } void SocketIOTestLayer::onMenuTestClientDisconnectClicked(cocos2d::Ref *sender) { - if(_sioClient != NULL) _sioClient->disconnect(); + if(_sioClient != nullptr) _sioClient->disconnect(); } void SocketIOTestLayer::onMenuTestEndpointDisconnectClicked(cocos2d::Ref *sender) { - if(_sioEndpoint != NULL) _sioEndpoint->disconnect(); + if(_sioEndpoint != nullptr) _sioEndpoint->disconnect(); } @@ -235,14 +235,14 @@ void SocketIOTestLayer::onClose(network::SIOClient* client) s << client->getTag() << " closed!"; _sioClientStatus->setString(s.str().c_str()); - //set the local pointer to NULL or connect to another client + //set the local pointer to nullptr or connect to another client //the client object will be released on its own after this method completes if(client == _sioClient) { - _sioClient = NULL; + _sioClient = nullptr; } else if(client == _sioEndpoint) { - _sioEndpoint = NULL; + _sioEndpoint = nullptr; } } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp index b33ddc961d..8c51def727 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp @@ -69,7 +69,7 @@ WebSocketTestLayer::WebSocketTestLayer() // Back Menu auto itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(WebSocketTestLayer::toExtensionsMainLayer, this)); itemBack->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto menuBack = Menu::create(itemBack, NULL); + auto menuBack = Menu::create(itemBack, nullptr); menuBack->setPosition(Vec2::ZERO); addChild(menuBack); @@ -166,15 +166,15 @@ void WebSocketTestLayer::onClose(network::WebSocket* ws) log("websocket instance (%p) closed.", ws); if (ws == _wsiSendText) { - _wsiSendText = NULL; + _wsiSendText = nullptr; } else if (ws == _wsiSendBinary) { - _wsiSendBinary = NULL; + _wsiSendBinary = nullptr; } else if (ws == _wsiError) { - _wsiError = NULL; + _wsiError = nullptr; } // Delete websocket instance. CC_SAFE_DELETE(ws); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp index 1a37df2876..5df50ea32d 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp @@ -49,7 +49,7 @@ void Light::setIsConnectToSwitch(bool bConnectToSwitch) _connected = bConnectToSwitch; if (_connected) { - NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(Light::switchStateChanged), MSG_SWITCH_STATE, NULL); + NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(Light::switchStateChanged), MSG_SWITCH_STATE, nullptr); } else { @@ -83,7 +83,7 @@ NotificationCenterTest::NotificationCenterTest() auto pBackItem = MenuItemFont::create("Back", CC_CALLBACK_1(NotificationCenterTest::toExtensionsMainLayer, this)); pBackItem->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto pBackMenu = Menu::create(pBackItem, NULL); + auto pBackMenu = Menu::create(pBackItem, nullptr); pBackMenu->setPosition( Vec2::ZERO ); addChild(pBackMenu); @@ -91,10 +91,10 @@ NotificationCenterTest::NotificationCenterTest() auto label2 = Label::createWithTTF("switch on", "fonts/Marker Felt.ttf", 26); auto item1 = MenuItemLabel::create(label1); auto item2 = MenuItemLabel::create(label2); - auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::toggleSwitch, this), item1, item2, NULL); + auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::toggleSwitch, this), item1, item2, nullptr); // turn on item->setSelectedIndex(1); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); menu->setPosition(Vec2(s.width/2+100, s.height/2)); addChild(menu); @@ -113,7 +113,7 @@ NotificationCenterTest::NotificationCenterTest() auto label2 = Label::createWithTTF("connected", "fonts/Marker Felt.ttf", 26); auto item1 = MenuItemLabel::create(label1); auto item2 = MenuItemLabel::create(label2); - auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::connectToSwitch, this), item1, item2, NULL); + auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::connectToSwitch, this), item1, item2, nullptr); item->setTag(kTagConnect+i); item->setPosition(Vec2(light->getPosition().x, light->getPosition().y+50)); menuConnect->addChild(item, 0); @@ -128,9 +128,9 @@ NotificationCenterTest::NotificationCenterTest() NotificationCenter::getInstance()->postNotification(MSG_SWITCH_STATE, (Ref*)(intptr_t)item->getSelectedIndex()); /* for testing removeAllObservers */ - NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(NotificationCenterTest::doNothing), "random-observer1", NULL); - NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(NotificationCenterTest::doNothing), "random-observer2", NULL); - NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(NotificationCenterTest::doNothing), "random-observer3", NULL); + NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(NotificationCenterTest::doNothing), "random-observer1", nullptr); + NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(NotificationCenterTest::doNothing), "random-observer2", nullptr); + NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(NotificationCenterTest::doNothing), "random-observer3", nullptr); } void NotificationCenterTest::toExtensionsMainLayer(cocos2d::Ref* sender) diff --git a/tests/cpp-tests/Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp index 07982e6498..8f86aae1c7 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp @@ -662,7 +662,7 @@ void S9CascadeOpacityAndColor::onEnter() TintTo::create(1, 0, 255, 0), TintTo::create(1, 255, 255, 255), FadeOut::create(1), - NULL); + nullptr); auto repeat = RepeatForever::create(actions); rgba->runAction(repeat); log("this->addChild"); diff --git a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp index 0bf1dc7681..e472e9e912 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp @@ -41,7 +41,7 @@ bool TableViewTestLayer::init() // Back Menu MenuItemFont *itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(TableViewTestLayer::toExtensionsMainLayer, this)); itemBack->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - Menu *menuBack = Menu::create(itemBack, NULL); + Menu *menuBack = Menu::create(itemBack, nullptr); menuBack->setPosition(Vec2::ZERO); addChild(menuBack); diff --git a/tests/cpp-tests/Classes/IntervalTest/IntervalTest.cpp b/tests/cpp-tests/Classes/IntervalTest/IntervalTest.cpp index 5a84b24595..09192591eb 100644 --- a/tests/cpp-tests/Classes/IntervalTest/IntervalTest.cpp +++ b/tests/cpp-tests/Classes/IntervalTest/IntervalTest.cpp @@ -55,7 +55,7 @@ IntervalLayer::IntervalLayer() auto jump = JumpBy::create(3, Vec2(s.width-80,0), 50, 4); addChild(sprite); - sprite->runAction( RepeatForever::create(Sequence::create(jump, jump->reverse(), NULL) )); + sprite->runAction( RepeatForever::create(Sequence::create(jump, jump->reverse(), nullptr) )); // pause button auto item1 = MenuItemFont::create("Pause", [&](Ref* sender) { if(Director::getInstance()->isPaused()) @@ -63,7 +63,7 @@ IntervalLayer::IntervalLayer() else Director::getInstance()->pause(); }); - auto menu = Menu::create(item1, NULL); + auto menu = Menu::create(item1, nullptr); menu->setPosition( Vec2(s.width/2, s.height-50) ); addChild( menu ); diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp index 2dc431e502..b641d89676 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp @@ -307,7 +307,7 @@ LabelAtlasColorTest::LabelAtlasColorTest() auto fade = FadeOut::create(1.0f); auto fade_in = fade->reverse(); auto cb = CallFunc::create(CC_CALLBACK_0(LabelAtlasColorTest::actionFinishCallback, this)); - auto seq = Sequence::create(fade, fade_in, cb, NULL); + auto seq = Sequence::create(fade, fade_in, cb, nullptr); auto repeat = RepeatForever::create( seq ); label2->runAction( repeat ); @@ -426,7 +426,7 @@ Atlas3::Atlas3() auto tint = Sequence::create(TintTo::create(1, 255, 0, 0), TintTo::create(1, 0, 255, 0), TintTo::create(1, 0, 0, 255), - NULL); + nullptr); label2->runAction( RepeatForever::create(tint) ); auto label3 = LabelBMFont::create("Test", "fonts/bitmapFontTest2.fnt"); @@ -504,7 +504,7 @@ Atlas4::Atlas4() auto scale = ScaleBy::create(2, 1.5f); auto scale_back = scale->reverse(); - auto scale_seq = Sequence::create(scale, scale_back,NULL); + auto scale_seq = Sequence::create(scale, scale_back,nullptr); auto scale_4ever = RepeatForever::create(scale_seq); auto jump = JumpBy::create(0.5f, Vec2::ZERO, 60, 1); @@ -512,7 +512,7 @@ Atlas4::Atlas4() auto fade_out = FadeOut::create(1); auto fade_in = FadeIn::create(1); - auto seq = Sequence::create(fade_out, fade_in, NULL); + auto seq = Sequence::create(fade_out, fade_in, nullptr); auto fade_4ever = RepeatForever::create(seq); BChar->runAction(rot_4ever); @@ -623,7 +623,7 @@ Atlas6::Atlas6() { auto s = Director::getInstance()->getWinSize(); - LabelBMFont* label = NULL; + LabelBMFont* label = nullptr; label = LabelBMFont::create("FaFeFiFoFu", "fonts/bitmapFontTest5.fnt"); addChild(label); label->setPosition( Vec2(s.width/2, s.height/2+50) ); @@ -964,7 +964,7 @@ LabelTTFTest::LabelTTFTest() MenuItemFont::create("Left", CC_CALLBACK_1(LabelTTFTest::setAlignmentLeft, this)), MenuItemFont::create("Center", CC_CALLBACK_1(LabelTTFTest::setAlignmentCenter, this)), MenuItemFont::create("Right", CC_CALLBACK_1(LabelTTFTest::setAlignmentRight, this)), - NULL); + nullptr); menu->alignItemsVerticallyWithPadding(4); menu->setPosition(Vec2(50, s.height / 2 - 20)); this->addChild(menu); @@ -973,7 +973,7 @@ LabelTTFTest::LabelTTFTest() MenuItemFont::create("Top", CC_CALLBACK_1(LabelTTFTest::setAlignmentTop, this)), MenuItemFont::create("Middle", CC_CALLBACK_1(LabelTTFTest::setAlignmentMiddle, this)), MenuItemFont::create("Bottom", CC_CALLBACK_1(LabelTTFTest::setAlignmentBottom, this)), - NULL); + nullptr); menu->alignItemsVerticallyWithPadding(4); menu->setPosition(Vec2(s.width - 50, s.height / 2 - 20)); this->addChild(menu); @@ -1050,8 +1050,8 @@ void LabelTTFTest::setAlignmentBottom(Ref* sender) const char* LabelTTFTest::getCurrentAlignment() { - const char* vertical = NULL; - const char* horizontal = NULL; + const char* vertical = nullptr; + const char* horizontal = nullptr; switch (_vertAlign) { case TextVAlignment::TOP: vertical = "Top"; @@ -1184,7 +1184,7 @@ BitmapFontMultiLineAlignment::BitmapFontMultiLineAlignment() auto longSentences = MenuItemFont::create("Long Flowing Sentences", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this)); auto lineBreaks = MenuItemFont::create("Short Sentences With Intentional Line Breaks", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this)); auto mixed = MenuItemFont::create("Long Sentences Mixed With Intentional Line Breaks", CC_CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this)); - auto stringMenu = Menu::create(longSentences, lineBreaks, mixed, NULL); + auto stringMenu = Menu::create(longSentences, lineBreaks, mixed, nullptr); stringMenu->alignItemsVertically(); longSentences->setColor(Color3B::RED); @@ -1198,7 +1198,7 @@ BitmapFontMultiLineAlignment::BitmapFontMultiLineAlignment() auto left = MenuItemFont::create("Left", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this)); auto center = MenuItemFont::create("Center", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this)); auto right = MenuItemFont::create("Right", CC_CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this)); - auto alignmentMenu = Menu::create(left, center, right, NULL); + auto alignmentMenu = Menu::create(left, center, right, nullptr); alignmentMenu->alignItemsHorizontallyWithPadding(alignmentItemPadding); center->setColor(Color3B::RED); @@ -1359,7 +1359,7 @@ LabelTTFA8Test::LabelTTFA8Test() auto fadeOut = FadeOut::create(2); auto fadeIn = FadeIn::create(2); - auto seq = Sequence::create(fadeOut, fadeIn, NULL); + auto seq = Sequence::create(fadeOut, fadeIn, nullptr); auto forever = RepeatForever::create(seq); label1->runAction(forever); } diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp index df69db7b8a..9dca43b4ae 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp @@ -210,7 +210,7 @@ LabelFNTColorAndOpacity::LabelFNTColorAndOpacity() addChild(label1, 0, kTagBitmapAtlas1); auto fade = FadeOut::create(1.0f); auto fade_in = fade->reverse(); - auto seq = Sequence::create(fade, fade_in, NULL); + auto seq = Sequence::create(fade, fade_in, nullptr); auto repeat = RepeatForever::create(seq); label1->runAction(repeat); @@ -220,7 +220,7 @@ LabelFNTColorAndOpacity::LabelFNTColorAndOpacity() auto tint = Sequence::create(TintTo::create(1, 255, 0, 0), TintTo::create(1, 0, 255, 0), TintTo::create(1, 0, 0, 255), - NULL); + nullptr); label2->runAction( RepeatForever::create(tint) ); auto label3 = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "Test"); @@ -282,7 +282,7 @@ LabelFNTSpriteActions::LabelFNTSpriteActions() auto scale = ScaleBy::create(2, 1.5f); auto scale_back = scale->reverse(); - auto scale_seq = Sequence::create(scale, scale_back,NULL); + auto scale_seq = Sequence::create(scale, scale_back,nullptr); auto scale_4ever = RepeatForever::create(scale_seq); auto jump = JumpBy::create(0.5f, Vec2::ZERO, 60, 1); @@ -290,7 +290,7 @@ LabelFNTSpriteActions::LabelFNTSpriteActions() auto fade_out = FadeOut::create(1); auto fade_in = FadeIn::create(1); - auto seq = Sequence::create(fade_out, fade_in, NULL); + auto seq = Sequence::create(fade_out, fade_in, nullptr); auto fade_4ever = RepeatForever::create(seq); BChar->runAction(rot_4ever); @@ -689,7 +689,7 @@ LabelFNTMultiLineAlignment::LabelFNTMultiLineAlignment() auto longSentences = MenuItemFont::create("Long Flowing Sentences", CC_CALLBACK_1(LabelFNTMultiLineAlignment::stringChanged, this)); auto lineBreaks = MenuItemFont::create("Short Sentences With Intentional Line Breaks", CC_CALLBACK_1(LabelFNTMultiLineAlignment::stringChanged, this)); auto mixed = MenuItemFont::create("Long Sentences Mixed With Intentional Line Breaks", CC_CALLBACK_1(LabelFNTMultiLineAlignment::stringChanged, this)); - auto stringMenu = Menu::create(longSentences, lineBreaks, mixed, NULL); + auto stringMenu = Menu::create(longSentences, lineBreaks, mixed, nullptr); stringMenu->alignItemsVertically(); longSentences->setColor(Color3B::RED); @@ -703,7 +703,7 @@ LabelFNTMultiLineAlignment::LabelFNTMultiLineAlignment() auto left = MenuItemFont::create("Left", CC_CALLBACK_1(LabelFNTMultiLineAlignment::alignmentChanged, this)); auto center = MenuItemFont::create("Center", CC_CALLBACK_1(LabelFNTMultiLineAlignment::alignmentChanged, this)); auto right = MenuItemFont::create("Right", CC_CALLBACK_1(LabelFNTMultiLineAlignment::alignmentChanged, this)); - auto alignmentMenu = Menu::create(left, center, right, NULL); + auto alignmentMenu = Menu::create(left, center, right, nullptr); alignmentMenu->alignItemsHorizontallyWithPadding(alignmentItemPadding); center->setColor(Color3B::RED); @@ -1008,7 +1008,7 @@ LabelTTFDynamicAlignment::LabelTTFDynamicAlignment() MenuItemFont::create("Left", CC_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentLeft, this)), MenuItemFont::create("Center", CC_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentCenter, this)), MenuItemFont::create("Right", CC_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentRight, this)), - NULL); + nullptr); menu->alignItemsVerticallyWithPadding(4); menu->setPosition(Vec2(50, size.height / 4 )); @@ -1436,7 +1436,7 @@ LabelCharMapColorTest::LabelCharMapColorTest() auto fade = FadeOut::create(1.0f); auto fade_in = fade->reverse(); auto cb = CallFunc::create(CC_CALLBACK_0(LabelCharMapColorTest::actionFinishCallback, this)); - auto seq = Sequence::create(fade, fade_in, cb, NULL); + auto seq = Sequence::create(fade, fade_in, cb, nullptr); auto repeat = RepeatForever::create( seq ); label2->runAction( repeat ); @@ -1612,7 +1612,7 @@ LabelAlignmentTest::LabelAlignmentTest() MenuItemFont::create("Left", CC_CALLBACK_1(LabelAlignmentTest::setAlignmentLeft, this)), MenuItemFont::create("Center", CC_CALLBACK_1(LabelAlignmentTest::setAlignmentCenter, this)), MenuItemFont::create("Right", CC_CALLBACK_1(LabelAlignmentTest::setAlignmentRight, this)), - NULL); + nullptr); menu->alignItemsVerticallyWithPadding(4); menu->setPosition(Vec2(50, s.height / 2 - 20)); this->addChild(menu); @@ -1621,7 +1621,7 @@ LabelAlignmentTest::LabelAlignmentTest() MenuItemFont::create("Top", CC_CALLBACK_1(LabelAlignmentTest::setAlignmentTop, this)), MenuItemFont::create("Middle", CC_CALLBACK_1(LabelAlignmentTest::setAlignmentMiddle, this)), MenuItemFont::create("Bottom", CC_CALLBACK_1(LabelAlignmentTest::setAlignmentBottom, this)), - NULL); + nullptr); menu->alignItemsVerticallyWithPadding(4); menu->setPosition(Vec2(s.width - 50, s.height / 2 - 20)); this->addChild(menu); @@ -1690,8 +1690,8 @@ void LabelAlignmentTest::setAlignmentBottom(Ref* sender) const char* LabelAlignmentTest::getCurrentAlignment() { - const char* vertical = NULL; - const char* horizontal = NULL; + const char* vertical = nullptr; + const char* horizontal = nullptr; switch (_vertAlign) { case TextVAlignment::TOP: vertical = "Top"; diff --git a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp index 431daeba67..58f958c477 100644 --- a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp +++ b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp @@ -151,7 +151,7 @@ void LayerTestCascadingOpacityA::onEnter() FadeTo::create(4, 0), FadeTo::create(4, 255), DelayTime::create(1), - NULL))); + nullptr))); sister1->runAction( RepeatForever::create( @@ -161,7 +161,7 @@ void LayerTestCascadingOpacityA::onEnter() FadeTo::create(2, 0), FadeTo::create(2, 255), DelayTime::create(1), - NULL))); + nullptr))); // Enable cascading in scene setEnableRecursiveCascading(this, true); @@ -203,7 +203,7 @@ void LayerTestCascadingOpacityB::onEnter() FadeTo::create(4, 0), FadeTo::create(4, 255), DelayTime::create(1), - NULL))); + nullptr))); sister1->runAction( RepeatForever::create( @@ -213,7 +213,7 @@ void LayerTestCascadingOpacityB::onEnter() FadeTo::create(2, 0), FadeTo::create(2, 255), DelayTime::create(1), - NULL))); + nullptr))); // Enable cascading in scene setEnableRecursiveCascading(this, true); @@ -256,7 +256,7 @@ void LayerTestCascadingOpacityC::onEnter() FadeTo::create(4, 0), FadeTo::create(4, 255), DelayTime::create(1), - NULL))); + nullptr))); sister1->runAction( RepeatForever::create( @@ -266,7 +266,7 @@ void LayerTestCascadingOpacityC::onEnter() FadeTo::create(2, 0), FadeTo::create(2, 255), DelayTime::create(1), - NULL))); + nullptr))); } std::string LayerTestCascadingOpacityC::subtitle() const @@ -304,7 +304,7 @@ void LayerTestCascadingColorA::onEnter() TintTo::create(6, 255, 0, 255), TintTo::create(6, 255, 255, 255), DelayTime::create(1), - NULL))); + nullptr))); sister1->runAction( RepeatForever::create( @@ -316,7 +316,7 @@ void LayerTestCascadingColorA::onEnter() TintTo::create(2, 255, 0, 255), TintTo::create(2, 255, 255, 255), DelayTime::create(1), - NULL))); + nullptr))); // Enable cascading in scene setEnableRecursiveCascading(this, true); @@ -357,7 +357,7 @@ void LayerTestCascadingColorB::onEnter() TintTo::create(6, 255, 0, 255), TintTo::create(6, 255, 255, 255), DelayTime::create(1), - NULL))); + nullptr))); sister1->runAction( RepeatForever::create( @@ -369,7 +369,7 @@ void LayerTestCascadingColorB::onEnter() TintTo::create(2, 255, 0, 255), TintTo::create(2, 255, 255, 255), DelayTime::create(1), - NULL))); + nullptr))); // Enable cascading in scene setEnableRecursiveCascading(this, true); @@ -409,7 +409,7 @@ void LayerTestCascadingColorC::onEnter() TintTo::create(6, 255, 0, 255), TintTo::create(6, 255, 255, 255), DelayTime::create(1), - NULL))); + nullptr))); sister1->runAction( RepeatForever::create( @@ -421,7 +421,7 @@ void LayerTestCascadingColorC::onEnter() TintTo::create(2, 255, 0, 255), TintTo::create(2, 255, 255, 255), DelayTime::create(1), - NULL))); + nullptr))); } std::string LayerTestCascadingColorC::subtitle() const @@ -508,12 +508,12 @@ void LayerTest2::onEnter() auto actionTint = TintBy::create(2, -255, -127, 0); auto actionTintBack = actionTint->reverse(); - auto seq1 = Sequence::create( actionTint, actionTintBack, NULL); + auto seq1 = Sequence::create( actionTint, actionTintBack, nullptr); layer1->runAction(seq1); auto actionFade = FadeOut::create(2.0f); auto actionFadeBack = actionFade->reverse(); - auto seq2 = Sequence::create(actionFade, actionFadeBack, NULL); + auto seq2 = Sequence::create(actionFade, actionFadeBack, nullptr); layer2->runAction(seq2); } @@ -592,9 +592,9 @@ LayerGradientTest::LayerGradientTest() auto label2 = Label::createWithTTF("Compressed Interpolation: Disabled", "fonts/Marker Felt.ttf", 26); auto item1 = MenuItemLabel::create(label1); auto item2 = MenuItemLabel::create(label2); - auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(LayerGradientTest::toggleItem, this), item1, item2, NULL); + auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(LayerGradientTest::toggleItem, this), item1, item2, nullptr); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); addChild(menu); auto s = Director::getInstance()->getWinSize(); menu->setPosition(Vec2(s.width / 2, 100)); @@ -690,7 +690,7 @@ void LayerIgnoreAnchorPointPos::onEnter() auto move = MoveBy::create(2, Vec2(100,2)); auto back = (MoveBy *)move->reverse(); - auto seq = Sequence::create(move, back, NULL); + auto seq = Sequence::create(move, back, nullptr); l->runAction(RepeatForever::create(seq)); this->addChild(l, 0, kLayerIgnoreAnchorPoint); @@ -701,7 +701,7 @@ void LayerIgnoreAnchorPointPos::onEnter() auto item = MenuItemFont::create("Toggle ignore anchor point", CC_CALLBACK_1(LayerIgnoreAnchorPointPos::onToggle, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); this->addChild(menu); menu->setPosition(Vec2(s.width/2, s.height/2)); @@ -749,7 +749,7 @@ void LayerIgnoreAnchorPointRot::onEnter() auto item = MenuItemFont::create("Toogle ignore anchor point", CC_CALLBACK_1(LayerIgnoreAnchorPointRot::onToggle, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); this->addChild(menu); menu->setPosition(Vec2(s.width/2, s.height/2)); @@ -787,7 +787,7 @@ void LayerIgnoreAnchorPointScale::onEnter() auto scale = ScaleBy::create(2, 2); auto back = (ScaleBy*)scale->reverse(); - auto seq = Sequence::create(scale, back, NULL); + auto seq = Sequence::create(scale, back, nullptr); l->runAction(RepeatForever::create(seq)); @@ -800,7 +800,7 @@ void LayerIgnoreAnchorPointScale::onEnter() auto item = MenuItemFont::create("Toogle ignore anchor point", CC_CALLBACK_1(LayerIgnoreAnchorPointScale::onToggle, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); this->addChild(menu); menu->setPosition(Vec2(s.width/2, s.height/2)); diff --git a/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp b/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp index bb00913264..3fba8b87f5 100644 --- a/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp +++ b/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp @@ -102,10 +102,10 @@ MenuLayerMainMenu::MenuLayerMainMenu() auto color_action = TintBy::create(0.5f, 0, -255, -255); auto color_back = color_action->reverse(); - auto seq = Sequence::create(color_action, color_back, NULL); + auto seq = Sequence::create(color_action, color_back, nullptr); item7->runAction(RepeatForever::create(seq)); - auto menu = Menu::create( item1, item2, item3, item4, item5, item6, item7, item8, NULL); + auto menu = Menu::create( item1, item2, item3, item4, item5, item6, item7, item8, nullptr); menu->alignItemsVertically(); @@ -221,7 +221,7 @@ MenuLayer2::MenuLayer2() item2->setScaleX( 0.5f ); item3->setScaleX( 0.5f ); - auto menu = Menu::create(item1, item2, item3, NULL); + auto menu = Menu::create(item1, item2, item3, nullptr); auto s = Director::getInstance()->getWinSize(); menu->setPosition(Vec2(s.width/2, s.height/2)); @@ -344,7 +344,7 @@ MenuLayer3::MenuLayer3() _disabledItem = item3; item3->retain(); _disabledItem->setEnabled( false ); - auto menu = Menu::create( item1, item2, item3, NULL); + auto menu = Menu::create( item1, item2, item3, nullptr); menu->setPosition( Vec2(0,0) ); auto s = Director::getInstance()->getWinSize(); @@ -354,7 +354,7 @@ MenuLayer3::MenuLayer3() item3->setPosition( Vec2(s.width/2, s.height/2 - 100) ); auto jump = JumpBy::create(3, Vec2(400,0), 50, 4); - item2->runAction( RepeatForever::create(Sequence::create( jump, jump->reverse(), NULL))); + item2->runAction( RepeatForever::create(Sequence::create( jump, jump->reverse(), nullptr))); auto spin1 = RotateBy::create(3, 360); auto spin2 = spin1->clone(); @@ -390,7 +390,7 @@ MenuLayer4::MenuLayer4() auto item1 = MenuItemToggle::createWithCallback( CC_CALLBACK_1(MenuLayer4::menuCallback, this), MenuItemFont::create( "On" ), MenuItemFont::create( "Off"), - NULL ); + nullptr ); MenuItemFont::setFontName( "American Typewriter" ); MenuItemFont::setFontSize(18); @@ -401,7 +401,7 @@ MenuLayer4::MenuLayer4() auto item2 = MenuItemToggle::createWithCallback(CC_CALLBACK_1(MenuLayer4::menuCallback, this), MenuItemFont::create( "On" ), MenuItemFont::create( "Off"), - NULL ); + nullptr ); MenuItemFont::setFontName( "American Typewriter" ); MenuItemFont::setFontSize(18); @@ -412,7 +412,7 @@ MenuLayer4::MenuLayer4() auto item3 = MenuItemToggle::createWithCallback(CC_CALLBACK_1(MenuLayer4::menuCallback, this), MenuItemFont::create( "High" ), MenuItemFont::create( "Low" ), - NULL ); + nullptr ); MenuItemFont::setFontName( "American Typewriter" ); MenuItemFont::setFontSize(18); @@ -422,7 +422,7 @@ MenuLayer4::MenuLayer4() MenuItemFont::setFontSize(34); auto item4 = MenuItemToggle::createWithCallback(CC_CALLBACK_1(MenuLayer4::menuCallback, this), MenuItemFont::create( "Off" ), - NULL ); + nullptr ); // TIP: you can manipulate the items like any other MutableArray item4->getSubItems().pushBack( MenuItemFont::create( "33%" ) ); @@ -443,9 +443,9 @@ MenuLayer4::MenuLayer4() item1, item2, title3, title4, item3, item4, - back, NULL ); // 9 items. + back, nullptr ); // 9 items. - menu->alignItemsInColumns(2, 2, 2, 2, 1, NULL); + menu->alignItemsInColumns(2, 2, 2, 2, 1, nullptr); addChild( menu ); @@ -474,7 +474,7 @@ BugsTest::BugsTest() auto issue1410_2 = MenuItemFont::create("Issue 1410 #2", CC_CALLBACK_1(BugsTest::issue1410v2MenuCallback, this)); auto back = MenuItemFont::create("Back", CC_CALLBACK_1(BugsTest::backMenuCallback, this)); - auto menu = Menu::create(issue1410, issue1410_2, back, NULL); + auto menu = Menu::create(issue1410, issue1410_2, back, nullptr); addChild(menu); menu->alignItemsVertically(); @@ -518,7 +518,7 @@ RemoveMenuItemWhenMove::RemoveMenuItemWhenMove() auto back = MenuItemFont::create("go back", CC_CALLBACK_1(RemoveMenuItemWhenMove::goBack, this)); - auto menu = Menu::create(item, back, NULL); + auto menu = Menu::create(item, back, nullptr); addChild(menu); menu->alignItemsVertically(); @@ -557,7 +557,7 @@ void RemoveMenuItemWhenMove::onTouchMoved(Touch *touch, Event *event) { item->removeFromParentAndCleanup(true); item->release(); - item = NULL; + item = nullptr; } } @@ -572,7 +572,7 @@ void MenuTestScene::runThisTest() auto layer5 = new BugsTest(); auto layer6 = new RemoveMenuItemWhenMove(); - auto layer = LayerMultiplex::create(layer1, layer2, layer3, layer4, layer5, layer6, NULL); + auto layer = LayerMultiplex::create(layer1, layer2, layer3, layer4, layer5, layer6, nullptr); addChild(layer, 0); layer1->release(); diff --git a/tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp b/tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp index 233603da5d..6e6c0986c7 100644 --- a/tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp +++ b/tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp @@ -79,7 +79,7 @@ void MotionStreakTest1::onEnter() auto action1 = RepeatForever::create(a1); auto motion = MoveBy::create(2, Vec2(100,0) ); - _root->runAction( RepeatForever::create(Sequence::create(motion, motion->reverse(), NULL) ) ); + _root->runAction( RepeatForever::create(Sequence::create(motion, motion->reverse(), nullptr) ) ); _root->runAction( action1 ); auto colorAction = RepeatForever::create(Sequence::create( @@ -90,7 +90,7 @@ void MotionStreakTest1::onEnter() TintTo::create(0.2f, 255, 255, 0), TintTo::create(0.2f, 255, 0, 255), TintTo::create(0.2f, 255, 255, 255), - NULL)); + nullptr)); streak->runAction(colorAction); } @@ -214,9 +214,9 @@ void MotionStreakTest::onEnter() auto itemMode = MenuItemToggle::createWithCallback( CC_CALLBACK_1(MotionStreakTest::modeCallback, this), MenuItemFont::create("Use High Quality Mode"), MenuItemFont::create("Use Fast Mode"), - NULL); + nullptr); - auto menuMode = Menu::create(itemMode, NULL); + auto menuMode = Menu::create(itemMode, nullptr); addChild(menuMode); menuMode->setPosition(Vec2(s.width/2, s.height/4)); diff --git a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp index 0355b21751..453d368bca 100644 --- a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp +++ b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp @@ -201,7 +201,7 @@ void TouchableSpriteTest::onEnter() nextItem->setFontSizeObj(16); nextItem->setPosition(VisibleRect::right() + Vec2(-100, -30)); - auto menu2 = Menu::create(nextItem, NULL); + auto menu2 = Menu::create(nextItem, nullptr); menu2->setPosition(Vec2(0, 0)); menu2->setAnchorPoint(Vec2(0, 0)); this->addChild(menu2); @@ -405,7 +405,7 @@ void RemoveListenerWhenDispatching::onEnter() (*enable) = true; } - }, MenuItemFont::create("Enabled"), MenuItemFont::create("Disabled"), NULL); + }, MenuItemFont::create("Enabled"), MenuItemFont::create("Disabled"), nullptr); toggleItem->setPosition(origin + Vec2(size.width/2, 80)); auto menu = Menu::create(toggleItem, nullptr); @@ -1153,7 +1153,7 @@ PauseResumeTargetTest::PauseResumeTargetTest() closeItem->setPosition(VisibleRect::center()); - auto closeMenu = Menu::create(closeItem, NULL); + auto closeMenu = Menu::create(closeItem, nullptr); closeMenu->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT); closeMenu->setPosition(Vec2::ZERO); @@ -1216,7 +1216,7 @@ Issue4129::Issue4129() nextItem->setFontSizeObj(16); nextItem->setPosition(VisibleRect::right() + Vec2(-100, -30)); - auto menu2 = Menu::create(nextItem, NULL); + auto menu2 = Menu::create(nextItem, nullptr); menu2->setPosition(Vec2(0, 0)); menu2->setAnchorPoint(Vec2(0, 0)); this->addChild(menu2); diff --git a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp index 1ad294deec..729ac092ed 100644 --- a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp +++ b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp @@ -183,12 +183,12 @@ void Test2::onEnter() auto a1 = RotateBy::create(2, 360); auto a2 = ScaleBy::create(2, 2); - auto action1 = RepeatForever::create( Sequence::create(a1, a2, a2->reverse(), NULL) ); + auto action1 = RepeatForever::create( Sequence::create(a1, a2, a2->reverse(), nullptr) ); auto action2 = RepeatForever::create( Sequence::create( a1->clone(), a2->clone(), a2->reverse(), - NULL) + nullptr) ); sp2->setAnchorPoint(Vec2(0,0)); @@ -260,7 +260,7 @@ Test5::Test5() auto rot = RotateBy::create(2, 360); auto rot_back = rot->reverse(); - auto forever = RepeatForever::create(Sequence::create(rot, rot_back, NULL)); + auto forever = RepeatForever::create(Sequence::create(rot, rot_back, nullptr)); auto forever2 = forever->clone(); forever->setTag(101); forever2->setTag(102); @@ -315,7 +315,7 @@ Test6::Test6() auto rot = RotateBy::create(2, 360); auto rot_back = rot->reverse(); - auto forever1 = RepeatForever::create(Sequence::create(rot, rot_back, NULL)); + auto forever1 = RepeatForever::create(Sequence::create(rot, rot_back, nullptr)); auto forever11 = forever1->clone(); auto forever2 = forever1->clone(); @@ -394,7 +394,7 @@ void StressTest1::shouldNotCrash(float dt) runAction( Sequence::create( RotateBy::create(2, 360), CallFuncN::create(CC_CALLBACK_1(StressTest1::removeMe, this)), - NULL) ); + nullptr) ); addChild(explosion); } @@ -429,7 +429,7 @@ StressTest2::StressTest2() auto move = MoveBy::create(3, Vec2(350,0)); auto move_ease_inout3 = EaseInOut::create(move->clone(), 2.0f); auto move_ease_inout_back3 = move_ease_inout3->reverse(); - auto seq3 = Sequence::create( move_ease_inout3, move_ease_inout_back3, NULL); + auto seq3 = Sequence::create( move_ease_inout3, move_ease_inout_back3, nullptr); sp1->runAction( RepeatForever::create(seq3) ); sublayer->addChild(sp1, 1); @@ -508,7 +508,7 @@ NodeToWorld::NodeToWorld() auto backSize = back->getContentSize(); auto item = MenuItemImage::create(s_PlayNormal, s_PlaySelect); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); menu->alignItemsVertically(); menu->setPosition( Vec2(backSize.width/2, backSize.height/2)); back->addChild(menu); @@ -519,7 +519,7 @@ NodeToWorld::NodeToWorld() auto move = MoveBy::create(3, Vec2(200,0)); auto move_back = move->reverse(); - auto seq = Sequence::create( move, move_back, NULL); + auto seq = Sequence::create( move, move_back, nullptr); auto fe2 = RepeatForever::create(seq); back->runAction(fe2); } @@ -554,7 +554,7 @@ NodeToWorld3D::NodeToWorld3D() auto backSize = back->getContentSize(); auto item = MenuItemImage::create(s_PlayNormal, s_PlaySelect); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); menu->alignItemsVertically(); menu->setPosition( Vec2(backSize.width/2, backSize.height/2)); back->addChild(menu); @@ -565,7 +565,7 @@ NodeToWorld3D::NodeToWorld3D() auto move = MoveBy::create(3, Vec2(200,0)); auto move_back = move->reverse(); - auto seq = Sequence::create( move, move_back, NULL); + auto seq = Sequence::create( move, move_back, nullptr); auto fe2 = RepeatForever::create(seq); back->runAction(fe2); @@ -885,7 +885,7 @@ std::string ConvertToNode::subtitle() const NodeOpaqueTest::NodeOpaqueTest() { - Sprite *background = NULL; + Sprite *background = nullptr; for (int i = 0; i < 50; i++) { @@ -910,7 +910,7 @@ std::string NodeOpaqueTest::subtitle() const NodeNonOpaqueTest::NodeNonOpaqueTest() { - Sprite *background = NULL; + Sprite *background = nullptr; for (int i = 0; i < 50; i++) { @@ -1379,8 +1379,8 @@ void NodeNameTest::test(float dt) }); CCAssert(i == 10000, ""); - // name = /xxx : search from root - parent = getScene(); + // name = //xxx : search recursively + parent = Node::create(); for (int j = 0; j < 100; j++) { auto node = Node::create(); @@ -1398,35 +1398,21 @@ void NodeNameTest::test(float dt) } i = 0; - enumerateChildren("/node[[:digit:]]+", [&i](Node* node) -> bool { - ++i; - return false; - }); - CCAssert(i == 100, ""); - - i = 0; - enumerateChildren("/node[[:digit:]]+", [&i](Node* node) -> bool { - ++i; - return true; - }); - CCAssert(i == 1, ""); - - i = 0; - enumerateChildren("//node[[:digit:]]+", [&i](Node* node) -> bool { + parent->enumerateChildren("//node[[:digit:]]+", [&i](Node* node) -> bool { ++i; return false; }); CCAssert(i == 10100, ""); // 10000(children) + 100(parent) i = 0; - enumerateChildren("//node[[:digit:]]+", [&i](Node* node) -> bool { + parent->enumerateChildren("//node[[:digit:]]+", [&i](Node* node) -> bool { ++i; return true; }); CCAssert(i == 1, ""); i = 0; - enumerateChildren("//node[[:digit:]]+/..", [&i](Node* node) -> bool { + parent->enumerateChildren("//node[[:digit:]]+/..", [&i](Node* node) -> bool { ++i; return false; }); diff --git a/tests/cpp-tests/Classes/ParallaxTest/ParallaxTest.cpp b/tests/cpp-tests/Classes/ParallaxTest/ParallaxTest.cpp index 2e650c23d2..ae0683541f 100644 --- a/tests/cpp-tests/Classes/ParallaxTest/ParallaxTest.cpp +++ b/tests/cpp-tests/Classes/ParallaxTest/ParallaxTest.cpp @@ -68,7 +68,7 @@ Parallax1::Parallax1() auto goDown = goUp->reverse(); auto go = MoveBy::create(8, Vec2(-1000,0) ); auto goBack = go->reverse(); - auto seq = Sequence::create(goUp, go, goDown, goBack, NULL); + auto seq = Sequence::create(goUp, go, goDown, goBack, nullptr); voidNode->runAction( (RepeatForever::create(seq) )); addChild( voidNode ); @@ -247,7 +247,7 @@ Layer* createParallaxTestLayer(int nIndex) case 2: return new Issue2572(); } - return NULL; + return nullptr; } Layer* nextParallaxAction() diff --git a/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp b/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp index e78a9b133b..5f3beb9d31 100644 --- a/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp +++ b/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp @@ -588,7 +588,7 @@ void ParallaxParticle::onEnter() ParticleDemo::onEnter(); _background->getParent()->removeChild(_background, true); - _background = NULL; + _background = nullptr; auto p = ParallaxNode::create(); addChild(p, 5); @@ -612,7 +612,7 @@ void ParallaxParticle::onEnter() auto move = MoveBy::create(4, Vec2(300,0)); auto move_back = move->reverse(); - auto seq = Sequence::create( move, move_back, NULL); + auto seq = Sequence::create( move, move_back, nullptr); p->runAction(RepeatForever::create(seq)); } @@ -632,7 +632,7 @@ void RadiusMode1::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::createWithTotalParticles(200); _emitter->retain(); @@ -716,7 +716,7 @@ void RadiusMode2::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::createWithTotalParticles(200); _emitter->retain(); @@ -800,7 +800,7 @@ void Issue704::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::createWithTotalParticles(100); _emitter->retain(); @@ -892,7 +892,7 @@ void Issue870::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::create("Particles/SpinningPeas.plist"); _emitter->setTextureWithRect(Director::getInstance()->getTextureCache()->addImage("Images/particles.png"), Rect(0,0,32,32)); @@ -932,7 +932,7 @@ void DemoParticleFromFile::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; std::string filename = "Particles/" + _title + ".plist"; _emitter = ParticleSystemQuad::create(filename); @@ -1016,7 +1016,7 @@ Layer* createParticleLayer(int nIndex) break; } - return NULL; + return nullptr; } #define MAX_LAYER 49 @@ -1065,7 +1065,7 @@ void ParticleDemo::onEnter(void) _color = LayerColor::create( Color4B(127,127,127,255) ); this->addChild(_color); - _emitter = NULL; + _emitter = nullptr; auto listener = EventListenerTouchAllAtOnce::create(); listener->onTouchesBegan = CC_CALLBACK_2(ParticleDemo::onTouchesBegan, this); @@ -1079,9 +1079,9 @@ void ParticleDemo::onEnter(void) MenuItemFont::create( "Free Movement" ), MenuItemFont::create( "Relative Movement" ), MenuItemFont::create( "Grouped Movement" ), - NULL ); + nullptr ); - auto menu = Menu::create(item4, NULL); + auto menu = Menu::create(item4, nullptr); menu->setPosition( Vec2::ZERO ); item4->setPosition( Vec2( VisibleRect::left().x, VisibleRect::bottom().y+ 100) ); @@ -1100,7 +1100,7 @@ void ParticleDemo::onEnter(void) auto move = MoveBy::create(4, Vec2(300,0) ); auto move_back = move->reverse(); - auto seq = Sequence::create( move, move_back, NULL); + auto seq = Sequence::create( move, move_back, nullptr); _background->runAction( RepeatForever::create(seq) ); @@ -1139,7 +1139,7 @@ void ParticleDemo::onTouchesEnded(const std::vector& touches, Event *ev pos = _background->convertToWorldSpace(Vec2::ZERO); } - if (_emitter != NULL) + if (_emitter != nullptr) { _emitter->setPosition(location -pos); } @@ -1158,7 +1158,7 @@ void ParticleDemo::update(float dt) void ParticleDemo::toggleCallback(Ref* sender) { - if (_emitter != NULL) + if (_emitter != nullptr) { if (_emitter->getPositionType() == ParticleSystem::PositionType::GROUPED) _emitter->setPositionType(ParticleSystem::PositionType::FREE); @@ -1171,7 +1171,7 @@ void ParticleDemo::toggleCallback(Ref* sender) void ParticleDemo::restartCallback(Ref* sender) { - if (_emitter != NULL) + if (_emitter != nullptr) { _emitter->resetSystem(); } @@ -1196,7 +1196,7 @@ void ParticleDemo::backCallback(Ref* sender) void ParticleDemo::setEmitterPosition() { auto s = Director::getInstance()->getWinSize(); - if (_emitter != NULL) + if (_emitter != nullptr) { _emitter->setPosition( Vec2(s.width / 2, s.height / 2) ); } @@ -1210,7 +1210,7 @@ void ParticleBatchHybrid::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::create("Particles/LavaFlow.plist"); _emitter->retain(); @@ -1231,7 +1231,7 @@ void ParticleBatchHybrid::onEnter() void ParticleBatchHybrid::switchRender(float dt) { - bool usingBatch = ( _emitter->getBatchNode() != NULL ); + bool usingBatch = ( _emitter->getBatchNode() != nullptr ); _emitter->removeFromParentAndCleanup(false); auto newParent = (usingBatch ? _parent2 : _parent1 ); @@ -1258,7 +1258,7 @@ void ParticleBatchMultipleEmitters::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; auto emitter1 = ParticleSystemQuad::create("Particles/LavaFlow.plist"); emitter1->setStartColor(Color4F(1,0,0,1)); @@ -1301,7 +1301,7 @@ void ParticleReorder::onEnter() _order = 0; _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; auto ignore = ParticleSystemQuad::create("Particles/SmallSun.plist"); auto parent1 = Node::create(); @@ -1471,7 +1471,7 @@ void Issue1201::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; RainbowEffect *particle = new RainbowEffect(); particle->initWithTotalParticles(50); @@ -1501,7 +1501,7 @@ void MultipleParticleSystems::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; Director::getInstance()->getTextureCache()->addImage("Images/particles.png"); @@ -1514,7 +1514,7 @@ void MultipleParticleSystems::onEnter() addChild(particleSystem); } - _emitter = NULL; + _emitter = nullptr; } @@ -1536,7 +1536,7 @@ void MultipleParticleSystems::update(float dt) for(const auto &child : _children) { auto item = dynamic_cast(child); - if (item != NULL) + if (item != nullptr) { count += item->getParticleCount(); } @@ -1555,7 +1555,7 @@ void MultipleParticleSystemsBatched::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; ParticleBatchNode *batchNode = ParticleBatchNode::createWithTexture(nullptr, 3000); @@ -1572,7 +1572,7 @@ void MultipleParticleSystemsBatched::onEnter() batchNode->addChild(particleSystem); } - _emitter = NULL; + _emitter = nullptr; } void MultipleParticleSystemsBatched::update(float dt) @@ -1584,7 +1584,7 @@ void MultipleParticleSystemsBatched::update(float dt) auto batchNode = getChildByTag(2); for(const auto &child : batchNode->getChildren()) { auto item = dynamic_cast(child); - if (item != NULL) + if (item != nullptr) { count += item->getParticleCount(); } @@ -1613,10 +1613,10 @@ void AddAndDeleteParticleSystems::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background, true); - _background = NULL; + _background = nullptr; //adds the texture inside the plist to the texture cache - _batchNode = ParticleBatchNode::createWithTexture((Texture2D*)NULL, 16000); + _batchNode = ParticleBatchNode::createWithTexture((Texture2D*)nullptr, 16000); addChild(_batchNode, 1, 2); @@ -1636,7 +1636,7 @@ void AddAndDeleteParticleSystems::onEnter() } schedule(schedule_selector(AddAndDeleteParticleSystems::removeSystem), 0.5f); - _emitter = NULL; + _emitter = nullptr; } @@ -1672,7 +1672,7 @@ void AddAndDeleteParticleSystems::update(float dt) auto batchNode = getChildByTag(2); for(const auto &child : batchNode->getChildren()) { auto item = dynamic_cast(child); - if (item != NULL) + if (item != nullptr) { count += item->getParticleCount(); } @@ -1701,7 +1701,7 @@ void ReorderParticleSystems::onEnter() _color->setColor(Color3B::BLACK); removeChild(_background ,true); - _background = NULL; + _background = nullptr; _batchNode = ParticleBatchNode::create("Images/stars-grayscale.png" ,3000); @@ -1787,7 +1787,7 @@ void ReorderParticleSystems::onEnter() } schedule(schedule_selector(ReorderParticleSystems::reorderSystem), 2.0f); - _emitter = NULL; + _emitter = nullptr; } @@ -1859,7 +1859,7 @@ void PremultipliedAlphaTest::onEnter() _color->setColor(Color3B::BLUE); this->removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::create("Particles/BoilingFoam.plist"); _emitter->retain(); @@ -1893,7 +1893,7 @@ void PremultipliedAlphaTest2::onEnter() _color->setColor(Color3B::BLACK); this->removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::create("Particles/TestPremultipliedAlpha.plist"); _emitter->retain(); @@ -1919,7 +1919,7 @@ void Issue3990::onEnter() _color->setColor(Color3B::BLACK); this->removeChild(_background, true); - _background = NULL; + _background = nullptr; _emitter = ParticleSystemQuad::create("Particles/Spiral.plist"); @@ -1983,7 +1983,7 @@ void ParticleAutoBatching::onEnter() _color->setColor(Color3B::BLACK); this->removeChild(_background, true); - _background = NULL; + _background = nullptr; Size s = Director::getInstance()->getWinSize(); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp index b7ba926f88..141f7c9c33 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceAllocTest.cpp @@ -137,7 +137,7 @@ void PerformceAllocScene::initWithQuantityOfNodes(unsigned int nNodes) }); increase->setColor(Color3B(0,200,20)); - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height/2+15)); addChild(menu, 1); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp index b56c156732..fd5ddf10a2 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceContainerTest.cpp @@ -142,7 +142,7 @@ void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes) increase->setColor(Color3B(0,200,20)); _increase = increase; - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height/2+15)); addChild(menu, 1); @@ -223,7 +223,7 @@ void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes) stop->setPosition(VisibleRect::right() + Vec2(0, -40)); _stopItem = stop; - auto menu2 = Menu::create(toggle, start, stop, NULL); + auto menu2 = Menu::create(toggle, start, stop, nullptr); menu2->setPosition(Vec2::ZERO); addChild(menu2); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp index 3eb36c686f..f786ba12ad 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceEventDispatcherTest.cpp @@ -140,7 +140,7 @@ void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNode increase->setColor(Color3B(0,200,20)); _increase = increase; - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height/2+15)); addChild(menu, 1); @@ -240,7 +240,7 @@ void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNode stop->setPosition(VisibleRect::right() + Vec2(0, -40)); _stopItem = stop; - auto menu2 = Menu::create(toggle, start, stop, NULL); + auto menu2 = Menu::create(toggle, start, stop, nullptr); menu2->setPosition(Vec2::ZERO); addChild(menu2); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp index a384b31d2f..0948b6ccfa 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceLabelTest.cpp @@ -97,7 +97,7 @@ void LabelMainScene::initWithSubTest(int nodes) auto increase = MenuItemFont::create(" + ", CC_CALLBACK_1(LabelMainScene::onIncrease, this)); increase->setColor(Color3B(0,200,20)); - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height-65)); addChild(menu, 1); @@ -121,7 +121,7 @@ void LabelMainScene::initWithSubTest(int nodes) MenuItemFont::setFontName("fonts/arial.ttf"); MenuItemFont::setFontSize(24); - MenuItemFont* autoTestItem = NULL; + MenuItemFont* autoTestItem = nullptr; if (LabelMainScene::_s_autoTest) { autoTestItem = MenuItemFont::create("Auto Test On",CC_CALLBACK_1(LabelMainScene::onAutoTest, this)); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp index f7835b201c..d715fc8b9a 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp @@ -166,7 +166,7 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes) }); increase->setColor(Color3B(0,200,20)); - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height/2+15)); addChild(menu, 1); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp index b001e31f5d..7f43d0ae6e 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceParticleTest.cpp @@ -35,7 +35,7 @@ void ParticleMenuLayer::showCurrentTest() int subTest = scene->getSubTestNum(); int parNum = scene->getParticlesNum(); - ParticleMainScene* pNewScene = NULL; + ParticleMainScene* pNewScene = nullptr; switch (_curCase) { @@ -98,7 +98,7 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles) }); increase->setColor(Color3B(0,200,20)); - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height/2+15)); addChild(menu, 1); @@ -234,7 +234,7 @@ void ParticleMainScene::createParticleSystem() // particleSystem->setTexture(Director::getInstance()->getTextureCache()->addImage("Images/fire.png")); // break; default: - particleSystem = NULL; + particleSystem = nullptr; CCLOG("Shall not happen!"); break; } diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp index 0fdeac4065..d26defbd55 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceScenarioTest.cpp @@ -15,7 +15,7 @@ static int s_nScenarioCurCase = 0; //////////////////////////////////////////////////////// void ScenarioMenuLayer::showCurrentTest() { - Scene* scene = NULL; + Scene* scene = nullptr; switch (_curCase) { @@ -105,7 +105,7 @@ void ScenarioTest::performTests() MenuItemFont::create( "Add/Remove Sprite" ), MenuItemFont::create( "Add/Remove Particle"), MenuItemFont::create( "Add/Remove Particle System"), - NULL); + nullptr); _itemToggle->setAnchorPoint(Vec2(0.0f, 0.5f)); _itemToggle->setPosition(Vec2(origin.x, origin.y + s.height / 2)); @@ -148,7 +148,7 @@ void ScenarioTest::performTests() increase->setColor(Color3B(0,200,20)); increase->setPosition(Vec2(origin.x + s.width / 2 + 80, origin.y + 80)); - auto menu = Menu::create(_itemToggle, decrease, increase, NULL); + auto menu = Menu::create(_itemToggle, decrease, increase, nullptr); menu->setPosition(Vec2(0.0f, 0.0f)); addChild(menu, 10); @@ -252,7 +252,7 @@ void ScenarioTest::addNewSprites(int num) else action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create( action, action_back, NULL ); + auto seq = Sequence::create( action, action_back, nullptr ); sprite->runAction( RepeatForever::create(seq) ); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp index 8625056b41..51194ee6a0 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceSpriteTest.cpp @@ -146,7 +146,7 @@ Sprite* SubTest::createSpriteWithTag(int tag) { TextureCache *cache = Director::getInstance()->getTextureCache(); - Sprite* sprite = NULL; + Sprite* sprite = nullptr; switch (subtestNumber) { /// @@ -319,7 +319,7 @@ void SpriteMenuLayer::backCallback(Ref* sender) void SpriteMenuLayer::showCurrentTest() { - SpriteMainScene* scene = NULL; + SpriteMainScene* scene = nullptr; auto pPreScene = (SpriteMainScene*) getParent(); int nSubTest = pPreScene->getSubTestNum(); int nNodes = pPreScene->getNodesNum(); @@ -386,7 +386,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes) auto increase = MenuItemFont::create(" + ", CC_CALLBACK_1(SpriteMainScene::onIncrease, this)); increase->setColor(Color3B(0,200,20)); - auto menu = Menu::create(decrease, increase, NULL); + auto menu = Menu::create(decrease, increase, nullptr); menu->alignItemsHorizontally(); menu->setPosition(Vec2(s.width/2, s.height-65)); addChild(menu, 1); @@ -410,7 +410,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes) MenuItemFont::setFontName("fonts/arial.ttf"); MenuItemFont::setFontSize(24); - MenuItemFont* autoTestItem = NULL; + MenuItemFont* autoTestItem = nullptr; if (SpriteMainScene::_s_autoTest) { autoTestItem = MenuItemFont::create("Auto Test On",CC_CALLBACK_1(SpriteMainScene::onAutoTest, this)); @@ -484,7 +484,7 @@ SpriteMainScene::~SpriteMainScene() if (_subTest) { delete _subTest; - _subTest = NULL; + _subTest = nullptr; } } @@ -617,7 +617,7 @@ void SpriteMainScene::onExit() void SpriteMainScene::autoShowSpriteTests(int curCase, int subTest,int nodes) { - SpriteMainScene* scene = NULL; + SpriteMainScene* scene = nullptr; switch (curCase) { @@ -760,12 +760,12 @@ void performanceActions(Sprite* sprite) float period = 0.5f + (rand() % 1000) / 500.0f; auto rot = RotateBy::create(period, 360.0f * CCRANDOM_0_1()); auto rot_back = rot->reverse(); - auto permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, NULL)); + auto permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, nullptr)); sprite->runAction(permanentRotation); float growDuration = 0.5f + (rand() % 1000) / 500.0f; auto grow = ScaleBy::create(growDuration, 0.5f, 0.5f); - auto permanentScaleLoop = RepeatForever::create(Sequence::create(grow, grow->reverse(), NULL)); + auto permanentScaleLoop = RepeatForever::create(Sequence::create(grow, grow->reverse(), nullptr)); sprite->runAction(permanentScaleLoop); } @@ -780,7 +780,7 @@ void performanceActions20(Sprite* sprite) float period = 0.5f + (rand() % 1000) / 500.0f; auto rot = RotateBy::create(period, 360.0f * CCRANDOM_0_1()); auto rot_back = rot->reverse(); - auto permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, NULL)); + auto permanentRotation = RepeatForever::create(Sequence::create(rot, rot_back, nullptr)); sprite->runAction(permanentRotation); float growDuration = 0.5f + (rand() % 1000) / 500.0f; diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp index 745be44c23..e86037c4dd 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTest.cpp @@ -155,7 +155,7 @@ void PerformBasicLayer::onEnter() MenuItemFont::setFontSize(24); auto pMainItem = MenuItemFont::create("Back", CC_CALLBACK_1(PerformBasicLayer::toMainLayer, this)); pMainItem->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); - auto menu = Menu::create(pMainItem, NULL); + auto menu = Menu::create(pMainItem, nullptr); menu->setPosition( Vec2::ZERO ); if (_controlMenuVisible) diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp index fe02765945..13ea612adc 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTextureTest.cpp @@ -11,7 +11,7 @@ float calculateDeltaTime( struct timeval *lastUpdate ) { struct timeval now; - gettimeofday( &now, NULL); + gettimeofday( &now, nullptr); float dt = (now.tv_sec - lastUpdate->tv_sec) + (now.tv_usec - lastUpdate->tv_usec) / 1000000.0f; @@ -25,7 +25,7 @@ float calculateDeltaTime( struct timeval *lastUpdate ) //////////////////////////////////////////////////////// void TextureMenuLayer::showCurrentTest() { - Scene* scene = NULL; + Scene* scene = nullptr; switch (_curCase) { @@ -89,7 +89,7 @@ void TextureTest::performTestsPNG(const char* filename) log("RGBA 8888"); Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888); - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); texture = cache->addImage(filename); if( texture ) log(" ms:%f", calculateDeltaTime(&now) ); @@ -99,7 +99,7 @@ void TextureTest::performTestsPNG(const char* filename) log("RGBA 4444"); Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA4444); - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); texture = cache->addImage(filename); if( texture ) log(" ms:%f", calculateDeltaTime(&now) ); @@ -109,7 +109,7 @@ void TextureTest::performTestsPNG(const char* filename) log("RGBA 5551"); Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGB5A1); - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); texture = cache->addImage(filename); if( texture ) log(" ms:%f", calculateDeltaTime(&now) ); @@ -119,7 +119,7 @@ void TextureTest::performTestsPNG(const char* filename) log("RGB 565"); Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGB565); - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); texture = cache->addImage(filename); if( texture ) log(" ms:%f", calculateDeltaTime(&now) ); @@ -143,7 +143,7 @@ void TextureTest::performTests() // log("--- PVR 128x128 ---"); // log("RGBA 8888"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/test_image_rgba8888.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -152,7 +152,7 @@ void TextureTest::performTests() // cache->removeTexture(texture); // // log("BGRA 8888"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/test_image_bgra8888.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -161,7 +161,7 @@ void TextureTest::performTests() // cache->removeTexture(texture); // // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/test_image_rgba4444.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -170,7 +170,7 @@ void TextureTest::performTests() // cache->removeTexture(texture); // // log("RGB 565"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/test_image_rgb565.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -184,7 +184,7 @@ void TextureTest::performTests() // log("--- PVR 512x512 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/texture512x512_rgba4444.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -204,7 +204,7 @@ void TextureTest::performTests() // log("--- PVR 1024x1024 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/texture1024x1024_rgba4444.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -214,7 +214,7 @@ void TextureTest::performTests() // // log("--- PVR.GZ 1024x1024 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/texture1024x1024_rgba4444.pvr.gz"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -224,7 +224,7 @@ void TextureTest::performTests() // // log("--- PVR.CCZ 1024x1024 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/texture1024x1024_rgba4444.pvr.ccz"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -244,7 +244,7 @@ void TextureTest::performTests() // log("--- PVR 1024x1024 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/PlanetCute-1024x1024-rgba4444.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -254,7 +254,7 @@ void TextureTest::performTests() // // log("--- PVR.GZ 1024x1024 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/PlanetCute-1024x1024-rgba4444.pvr.gz"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -264,7 +264,7 @@ void TextureTest::performTests() // // log("--- PVR.CCZ 1024x1024 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/PlanetCute-1024x1024-rgba4444.pvr.ccz"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -286,7 +286,7 @@ void TextureTest::performTests() // log("--- PVR 1024x1024 ---"); // log("RGBA 8888"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/landscape-1024x1024-rgba8888.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -296,7 +296,7 @@ void TextureTest::performTests() // // log("--- PVR.GZ 1024x1024 ---"); // log("RGBA 8888"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/landscape-1024x1024-rgba8888.pvr.gz"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -306,7 +306,7 @@ void TextureTest::performTests() // // log("--- PVR.CCZ 1024x1024 ---"); // log("RGBA 8888"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/landscape-1024x1024-rgba8888.pvr.ccz"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); @@ -326,7 +326,7 @@ void TextureTest::performTests() // log("--- PVR 2048x2048 ---"); // log("RGBA 4444"); -// gettimeofday(&now, NULL); +// gettimeofday(&now, nullptr); // texture = cache->addImage("Images/texture2048x2048_rgba4444.pvr"); // if( texture ) // log(" ms:%f", calculateDeltaTime(&now) ); diff --git a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp index cb3f16091b..e510dcc78e 100644 --- a/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp +++ b/tests/cpp-tests/Classes/PerformanceTest/PerformanceTouchesTest.cpp @@ -41,7 +41,7 @@ static int s_nTouchCurCase = 0; //////////////////////////////////////////////////////// void TouchesMainScene::showCurrentTest() { - Layer* layer = NULL; + Layer* layer = nullptr; switch (_curCase) { case 0: @@ -283,7 +283,7 @@ void TouchesPerformTest3::onEnter() }); menuItem->setPosition(Vec2(0, -20)); - auto menu = Menu::create(menuItem, NULL); + auto menu = Menu::create(menuItem, nullptr); addChild(menu); } @@ -294,7 +294,7 @@ std::string TouchesPerformTest3::title() const void TouchesPerformTest3::showCurrentTest() { - Layer* layer = NULL; + Layer* layer = nullptr; switch (_curCase) { case 0: diff --git a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp index 926d5a1ccb..5826130538 100644 --- a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp +++ b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp @@ -156,7 +156,7 @@ void PhysicsDemo::onEnter() MenuItemFont::setFontSize(18); auto item = MenuItemFont::create("Toggle debug", CC_CALLBACK_1(PhysicsDemo::toggleDebugCallback, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); this->addChild(menu); menu->setPosition(Vec2(VisibleRect::right().x-50, VisibleRect::top().y-10)); } @@ -552,7 +552,7 @@ void PhysicsDemoRayCast::onEnter() MenuItemFont::setFontSize(18); auto item = MenuItemFont::create("Change Mode(any)", CC_CALLBACK_1(PhysicsDemoRayCast::changeModeCallback, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); this->addChild(menu); menu->setPosition(Vec2(VisibleRect::left().x+100, VisibleRect::top().y-10)); @@ -950,9 +950,9 @@ void PhysicsDemoActions::onEnter() auto rotateByBack = RotateBy::create(2, -180); sp1->runAction(RepeatForever::create(actionUp)); - sp2->runAction(RepeatForever::create(Sequence::create(actionBy, actionByBack, NULL))); + sp2->runAction(RepeatForever::create(Sequence::create(actionBy, actionByBack, nullptr))); sp3->runAction(actionTo); - sp4->runAction(RepeatForever::create(Sequence::create(rotateBy, rotateByBack, NULL))); + sp4->runAction(RepeatForever::create(Sequence::create(rotateBy, rotateByBack, nullptr))); } std::string PhysicsDemoActions::title() const @@ -1315,7 +1315,7 @@ void PhysicsContactTest::onEnter() decrease1->setTag(1); increase1->setTag(1); - auto menu1 = Menu::create(decrease1, increase1, NULL); + auto menu1 = Menu::create(decrease1, increase1, nullptr); menu1->alignItemsHorizontally(); menu1->setPosition(Vec2(s.width/2, s.height-50)); addChild(menu1, 1); @@ -1331,7 +1331,7 @@ void PhysicsContactTest::onEnter() decrease2->setTag(2); increase2->setTag(2); - auto menu2 = Menu::create(decrease2, increase2, NULL); + auto menu2 = Menu::create(decrease2, increase2, nullptr); menu2->alignItemsHorizontally(); menu2->setPosition(Vec2(s.width/2, s.height-90)); addChild(menu2, 1); @@ -1347,7 +1347,7 @@ void PhysicsContactTest::onEnter() decrease3->setTag(3); increase3->setTag(3); - auto menu3 = Menu::create(decrease3, increase3, NULL); + auto menu3 = Menu::create(decrease3, increase3, nullptr); menu3->alignItemsHorizontally(); menu3->setPosition(Vec2(s.width/2, s.height-130)); addChild(menu3, 1); @@ -1363,7 +1363,7 @@ void PhysicsContactTest::onEnter() decrease4->setTag(4); increase4->setTag(4); - auto menu4 = Menu::create(decrease4, increase4, NULL); + auto menu4 = Menu::create(decrease4, increase4, nullptr); menu4->alignItemsHorizontally(); menu4->setPosition(Vec2(s.width/2, s.height-170)); addChild(menu4, 1); @@ -1794,13 +1794,13 @@ void PhysicsTransformTest::onEnter() this->addChild(bullet); - MoveBy* move = MoveBy::create(2.0, Vec2(100, 100)); - MoveBy* move2 = MoveBy::create(2.0, Vec2(-200, 0)); - MoveBy* move3 = MoveBy::create(2.0, Vec2(100, -100)); - ScaleTo* scale = ScaleTo::create(3.0, 0.3); - ScaleTo* scale2 = ScaleTo::create(3.0, 1.0); + MoveBy* move = MoveBy::create(2.0f, Vec2(100, 100)); + MoveBy* move2 = MoveBy::create(2.0f, Vec2(-200, 0)); + MoveBy* move3 = MoveBy::create(2.0f, Vec2(100, -100)); + ScaleTo* scale = ScaleTo::create(3.0f, 0.3f); + ScaleTo* scale2 = ScaleTo::create(3.0f, 1.0f); - RotateBy* rotate = RotateBy::create(6.0, 360); + RotateBy* rotate = RotateBy::create(6.0f, 360); this->runAction(RepeatForever::create(Sequence::create(move, move2, move3, nullptr))); this->runAction(RepeatForever::create(Sequence::create(scale, scale2, nullptr))); diff --git a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp index 406514ff4b..334d578b79 100644 --- a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp +++ b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp @@ -108,7 +108,7 @@ RenderTextureSave::RenderTextureSave() MenuItemFont::setFontSize(16); auto item1 = MenuItemFont::create("Save Image", CC_CALLBACK_1(RenderTextureSave::saveImage, this)); auto item2 = MenuItemFont::create("Clear", CC_CALLBACK_1(RenderTextureSave::clearImage, this)); - auto menu = Menu::create(item1, item2, NULL); + auto menu = Menu::create(item1, item2, nullptr); this->addChild(menu); menu->alignItemsVertically(); menu->setPosition(Vec2(VisibleRect::rightTop().x - 80, VisibleRect::rightTop().y - 30)); @@ -151,7 +151,7 @@ void RenderTextureSave::saveImage(cocos2d::Ref *sender) sprite->setPosition(Vec2(40, 40)); sprite->setRotation(counter * 3); }; - runAction(Sequence::create(action1, CallFunc::create(func), NULL)); + runAction(Sequence::create(action1, CallFunc::create(func), nullptr)); CCLOG("Image saved %s and %s", png, jpg); @@ -239,7 +239,7 @@ RenderTextureIssue937::RenderTextureIssue937() /* A2 & B2 setup */ auto rend = RenderTexture::create(32, 64, Texture2D::PixelFormat::RGBA8888); - if (NULL == rend) + if (nullptr == rend) { return; } @@ -404,7 +404,7 @@ void RenderTextureZbuffer::onTouchesEnded(const std::vector& touches, Ev void RenderTextureZbuffer::renderScreenShot() { auto texture = RenderTexture::create(512, 512); - if (NULL == texture) + if (nullptr == texture) { return; } @@ -425,7 +425,7 @@ void RenderTextureZbuffer::renderScreenShot() sprite->runAction(Sequence::create(FadeTo::create(2, 0), Hide::create(), - NULL)); + nullptr)); } RenderTexturePartTest::RenderTexturePartTest() @@ -465,7 +465,7 @@ RenderTexturePartTest::RenderTexturePartTest() _spriteDraw->setPosition(0,size.height/2); _spriteDraw->setScaleY(-1); _spriteDraw->runAction(RepeatForever::create(Sequence::create - (baseAction,baseAction->reverse(), NULL))); + (baseAction,baseAction->reverse(), nullptr))); addChild(_spriteDraw); } @@ -623,7 +623,7 @@ RenderTextureTargetNode::RenderTextureTargetNode() // Toggle clear on / off auto item = MenuItemFont::create("Clear On/Off", CC_CALLBACK_1(RenderTextureTargetNode::touched, this)); - auto menu = Menu::create(item, NULL); + auto menu = Menu::create(item, nullptr); addChild(menu); menu->setPosition(Vec2(s.width/2, s.height/2)); @@ -722,7 +722,7 @@ SpriteRenderTextureBug::SimpleSprite* SpriteRenderTextureBug::addNewSpriteWithCo sprite->setPosition(p); - FiniteTimeAction *action = NULL; + FiniteTimeAction *action = nullptr; float rd = CCRANDOM_0_1(); if (rd < 0.20) @@ -737,12 +737,12 @@ SpriteRenderTextureBug::SimpleSprite* SpriteRenderTextureBug::addNewSpriteWithCo action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create(action, action_back, NULL); + auto seq = Sequence::create(action, action_back, nullptr); sprite->runAction(RepeatForever::create(seq)); //return sprite; - return NULL; + return nullptr; } void SpriteRenderTextureBug::onTouchesEnded(const std::vector& touches, Event* event) diff --git a/tests/cpp-tests/Classes/RotateWorldTest/RotateWorldTest.cpp b/tests/cpp-tests/Classes/RotateWorldTest/RotateWorldTest.cpp index e031b10f92..8351125918 100644 --- a/tests/cpp-tests/Classes/RotateWorldTest/RotateWorldTest.cpp +++ b/tests/cpp-tests/Classes/RotateWorldTest/RotateWorldTest.cpp @@ -67,11 +67,11 @@ void SpriteLayer::onEnter() auto rot1 = RotateBy::create(4, 360*2); auto rot2 = rot1->reverse(); - spriteSister1->runAction(Repeat::create( Sequence::create(jump2, jump1, NULL), 5 )); - spriteSister2->runAction(Repeat::create( Sequence::create(jump1->clone(), jump2->clone(), NULL), 5 )); + spriteSister1->runAction(Repeat::create( Sequence::create(jump2, jump1, nullptr), 5 )); + spriteSister2->runAction(Repeat::create( Sequence::create(jump1->clone(), jump2->clone(), nullptr), 5 )); - spriteSister1->runAction(Repeat::create( Sequence::create(rot1, rot2, NULL), 5 )); - spriteSister2->runAction(Repeat::create( Sequence::create(rot2->clone(), rot1->clone(), NULL), 5 )); + spriteSister1->runAction(Repeat::create( Sequence::create(rot1, rot2, nullptr), 5 )); + spriteSister2->runAction(Repeat::create( Sequence::create(rot2->clone(), rot1->clone(), nullptr), 5 )); } //------------------------------------------------------------------ diff --git a/tests/cpp-tests/Classes/SceneTest/SceneTest.cpp b/tests/cpp-tests/Classes/SceneTest/SceneTest.cpp index 715bc91a87..862943dd89 100644 --- a/tests/cpp-tests/Classes/SceneTest/SceneTest.cpp +++ b/tests/cpp-tests/Classes/SceneTest/SceneTest.cpp @@ -22,7 +22,7 @@ SceneTestLayer1::SceneTestLayer1() auto item2 = MenuItemFont::create( "Test pushScene w/transition", CC_CALLBACK_1(SceneTestLayer1::onPushSceneTran, this)); auto item3 = MenuItemFont::create( "Quit", CC_CALLBACK_1(SceneTestLayer1::onQuit, this)); - auto menu = Menu::create( item1, item2, item3, NULL ); + auto menu = Menu::create( item1, item2, item3, nullptr ); menu->alignItemsVertically(); addChild( menu ); @@ -107,7 +107,7 @@ SceneTestLayer2::SceneTestLayer2() auto item2 = MenuItemFont::create( "replaceScene w/transition", CC_CALLBACK_1(SceneTestLayer2::onReplaceSceneTran, this)); auto item3 = MenuItemFont::create( "Go Back", CC_CALLBACK_1(SceneTestLayer2::onGoBack, this)); - auto menu = Menu::create( item1, item2, item3, NULL ); + auto menu = Menu::create( item1, item2, item3, nullptr ); menu->alignItemsVertically(); addChild( menu ); @@ -176,7 +176,7 @@ bool SceneTestLayer3::init() auto item2 = MenuItemFont::create("Touch to popToRootScene", CC_CALLBACK_1(SceneTestLayer3::item2Clicked, this)); auto item3 = MenuItemFont::create("Touch to popToSceneStackLevel(2)", CC_CALLBACK_1(SceneTestLayer3::item3Clicked, this)); - auto menu = Menu::create(item0, item1, item2, item3, NULL); + auto menu = Menu::create(item0, item1, item2, item3, nullptr); this->addChild(menu); menu->alignItemsVertically(); diff --git a/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp b/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp index 198ff3998b..070c31febc 100644 --- a/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp +++ b/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp @@ -852,9 +852,9 @@ void SchedulerTimeScale::onEnter() auto rot1 = RotateBy::create(4, 360*2); auto rot2 = rot1->reverse(); - auto seq3_1 = Sequence::create(jump2, jump1, NULL); - auto seq3_2 = Sequence::create(rot1, rot2, NULL); - auto spawn = Spawn::create(seq3_1, seq3_2, NULL); + auto seq3_1 = Sequence::create(jump2, jump1, nullptr); + auto seq3_2 = Sequence::create(rot1, rot2, nullptr); + auto spawn = Spawn::create(seq3_1, seq3_2, nullptr); auto action = Repeat::create(spawn, 50); auto action2 = action->clone(); @@ -946,7 +946,7 @@ void TwoSchedulers::onEnter() auto jump1 = JumpBy::create(4, Vec2(0,0), 100, 4); auto jump2 = jump1->reverse(); - auto seq = Sequence::create(jump2, jump1, NULL); + auto seq = Sequence::create(jump2, jump1, nullptr); auto action = RepeatForever::create(seq); // diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp b/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp index 3f8fb816dd..b3c4c76249 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest.cpp @@ -22,7 +22,7 @@ static Layer* createShaderLayer(int nIndex) case 9: return new ShaderGlow(); case 10: return new ShaderMultiTexture(); } - return NULL; + return nullptr; } static Layer* nextAction(void) diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp index 53964f4a02..780abace13 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp @@ -297,8 +297,8 @@ public: { initGLProgramState("Shaders/example_outline.fsh"); - Vec3 color(1.0, 0.2, 0.3); - GLfloat radius = 0.01; + Vec3 color(1.0f, 0.2f, 0.3f); + GLfloat radius = 0.01f; GLfloat threshold = 1.75; _glprogramstate->setUniformVec3("u_outlineColor", color); @@ -456,7 +456,7 @@ EffectSpriteTest::EffectSpriteTest() _sprite->setEffect(_effects.at(_vectorIndex)); }); - auto menu = Menu::create(itemPrev, itemNext, NULL); + auto menu = Menu::create(itemPrev, itemNext, nullptr); menu->alignItemsHorizontally(); menu->setScale(0.5); menu->setAnchorPoint(Vec2(0,0)); @@ -469,9 +469,9 @@ EffectSpriteTest::EffectSpriteTest() auto jump = JumpBy::create(4, Vec2(s.width,0), 100, 4); auto rot = RotateBy::create(4, 720); - auto spawn = Spawn::create(jump, rot, NULL); + auto spawn = Spawn::create(jump, rot, nullptr); auto rev = spawn->reverse(); - auto seq = Sequence::create(spawn, rev, NULL); + auto seq = Sequence::create(spawn, rev, nullptr); auto repeat = RepeatForever::create(seq); _sprite->runAction(repeat); diff --git a/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp b/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp index 4b57f848f4..e0887829ab 100644 --- a/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp +++ b/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp @@ -67,7 +67,7 @@ bool SpineTestLayer::init () { skeletonNode->runAction(CCRepeatForever::create(CCSequence::create(CCFadeOut::create(1), CCFadeIn::create(1), CCDelayTime::create(5), - NULL))); + nullptr))); Size windowSize = Director::getInstance()->getWinSize(); skeletonNode->setPosition(Vec2(windowSize.width / 2, 20)); diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index 45b0a129f7..6ee4a01e83 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -184,7 +184,7 @@ void Sprite3DBasicTest::addNewSpriteWithCoords(Vec2 p) else action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create( action, action_back, NULL ); + auto seq = Sequence::create( action, action_back, nullptr ); sprite->runAction( RepeatForever::create(seq) ); } @@ -504,7 +504,7 @@ void Sprite3DEffectTest::addNewSpriteWithCoords(Vec2 p) else action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create( action, action_back, NULL ); + auto seq = Sequence::create( action, action_back, nullptr ); sprite->runAction( RepeatForever::create(seq) ); } @@ -546,24 +546,23 @@ void Sprite3DWithSkinTest::addNewSpriteWithCoords(Vec2 p) addChild(sprite); sprite->setPosition( Vec2( p.x, p.y) ); - auto animation = Animation3D::getOrCreate(fileName); + auto animation = Animation3D::create(fileName); if (animation) { auto animate = Animate3D::create(animation); - if(std::rand() %3 == 0) - { - animate->setPlayBack(true); - } + bool inverse = (std::rand() % 3 == 0); int rand2 = std::rand(); + float speed = 1.0f; if(rand2 % 3 == 1) { - animate->setSpeed(animate->getSpeed() + CCRANDOM_0_1()); + speed = animate->getSpeed() + CCRANDOM_0_1(); } else if(rand2 % 3 == 2) { - animate->setSpeed(animate->getSpeed() - 0.5 * CCRANDOM_0_1()); + speed = animate->getSpeed() - 0.5 * CCRANDOM_0_1(); } + animate->setSpeed(inverse ? -speed : speed); sprite->runAction(RepeatForever::create(animate)); } @@ -652,7 +651,7 @@ void Animate3DTest::addSprite3D() sprite->setPosition(Vec2(s.width * 4.f / 5.f, s.height / 2.f)); addChild(sprite); _sprite = sprite; - auto animation = Animation3D::getOrCreate(fileName); + auto animation = Animation3D::create(fileName); if (animation) { auto animate = Animate3D::create(animation, 0.f, 1.933f); @@ -706,7 +705,7 @@ void Animate3DTest::onTouchesEnded(const std::vector& touches, Event* ev { _sprite->runAction(_hurt); auto delay = DelayTime::create(_hurt->getDuration() - 0.1f); - auto seq = Sequence::create(delay, CallFunc::create(CC_CALLBACK_0(Animate3DTest::renewCallBack, this)), NULL); + auto seq = Sequence::create(delay, CallFunc::create(CC_CALLBACK_0(Animate3DTest::renewCallBack, this)), nullptr); seq->setTag(101); _sprite->runAction(seq); _state = State::SWIMMING_TO_HURT; diff --git a/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp b/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp index adb3919372..af90d8c5f5 100644 --- a/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp +++ b/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp @@ -131,6 +131,7 @@ static std::function createFunctions[] = CL(AnimationCacheFile), CL(SpriteCullTest1), CL(SpriteCullTest2), + CL(Sprite3DRotationTest), }; #define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0])) @@ -259,7 +260,7 @@ void Sprite1::addNewSpriteWithCoords(Vec2 p) else action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create( action, action_back, NULL ); + auto seq = Sequence::create( action, action_back, nullptr ); sprite->runAction( RepeatForever::create(seq) ); } @@ -332,7 +333,7 @@ void SpriteBatchNode1::addNewSpriteWithCoords(Vec2 p) action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create(action, action_back, NULL); + auto seq = Sequence::create(action, action_back, nullptr); sprite->runAction( RepeatForever::create(seq)); } @@ -389,19 +390,19 @@ SpriteColorOpacity::SpriteColorOpacity() auto action = FadeIn::create(2); auto action_back = action->reverse(); - auto fade = RepeatForever::create( Sequence::create( action, action_back, NULL) ); + auto fade = RepeatForever::create( Sequence::create( action, action_back, nullptr) ); auto tintred = TintBy::create(2, 0, -255, -255); auto tintred_back = tintred->reverse(); - auto red = RepeatForever::create( Sequence::create( tintred, tintred_back, NULL) ); + auto red = RepeatForever::create( Sequence::create( tintred, tintred_back, nullptr) ); auto tintgreen = TintBy::create(2, -255, 0, -255); auto tintgreen_back = tintgreen->reverse(); - auto green = RepeatForever::create( Sequence::create( tintgreen, tintgreen_back, NULL) ); + auto green = RepeatForever::create( Sequence::create( tintgreen, tintgreen_back, nullptr) ); auto tintblue = TintBy::create(2, -255, -255, 0); auto tintblue_back = tintblue->reverse(); - auto blue = RepeatForever::create( Sequence::create( tintblue, tintblue_back, NULL) ); + auto blue = RepeatForever::create( Sequence::create( tintblue, tintblue_back, nullptr) ); sprite5->runAction(red); sprite6->runAction(green); @@ -480,19 +481,19 @@ SpriteBatchNodeColorOpacity::SpriteBatchNodeColorOpacity() auto action = FadeIn::create(2); auto action_back = action->reverse(); - auto fade = RepeatForever::create( Sequence::create( action, action_back,NULL) ); + auto fade = RepeatForever::create( Sequence::create( action, action_back,nullptr) ); auto tintred = TintBy::create(2, 0, -255, -255); auto tintred_back = tintred->reverse(); - auto red = RepeatForever::create( Sequence::create( tintred, tintred_back,NULL) ); + auto red = RepeatForever::create( Sequence::create( tintred, tintred_back,nullptr) ); auto tintgreen = TintBy::create(2, -255, 0, -255); auto tintgreen_back = tintgreen->reverse(); - auto green = RepeatForever::create( Sequence::create( tintgreen, tintgreen_back,NULL) ); + auto green = RepeatForever::create( Sequence::create( tintgreen, tintgreen_back,nullptr) ); auto tintblue = TintBy::create(2, -255, -255, 0); auto tintblue_back = tintblue->reverse(); - auto blue = RepeatForever::create( Sequence::create( tintblue, tintblue_back,NULL) ); + auto blue = RepeatForever::create( Sequence::create( tintblue, tintblue_back,nullptr) ); sprite5->runAction(red); @@ -1226,12 +1227,12 @@ Sprite6::Sprite6() // SpriteBatchNode actions auto rotate_back = rotate->reverse(); - auto rotate_seq = Sequence::create(rotate, rotate_back, NULL); + auto rotate_seq = Sequence::create(rotate, rotate_back, nullptr); auto rotate_forever = RepeatForever::create(rotate_seq); auto scale = ScaleBy::create(5, 1.5f); auto scale_back = scale->reverse(); - auto scale_seq = Sequence::create( scale, scale_back, NULL); + auto scale_seq = Sequence::create( scale, scale_back, nullptr); auto scale_forever = RepeatForever::create(scale_seq); float step = s.width/4; @@ -1368,7 +1369,7 @@ SpriteAliased::SpriteAliased() auto scale = ScaleBy::create(2, 5); auto scale_back = scale->reverse(); - auto seq = Sequence::create( scale, scale_back, NULL); + auto seq = Sequence::create( scale, scale_back, nullptr); auto repeat = RepeatForever::create(seq); auto repeat2 = repeat->clone(); @@ -1433,7 +1434,7 @@ SpriteBatchNodeAliased::SpriteBatchNodeAliased() auto scale = ScaleBy::create(2, 5); auto scale_back = scale->reverse(); - auto seq = Sequence::create( scale, scale_back, NULL); + auto seq = Sequence::create( scale, scale_back, nullptr); auto repeat = RepeatForever::create(seq); auto repeat2 = repeat->clone(); @@ -1532,7 +1533,7 @@ void SpriteNewTexture::addNewSprite() action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create(action, action_back, NULL); + auto seq = Sequence::create(action, action_back, nullptr); sprite->runAction( RepeatForever::create(seq) ); } @@ -1637,7 +1638,7 @@ void SpriteBatchNodeNewTexture::addNewSprite() else action = FadeOut::create(2); auto action_back = action->reverse(); - auto seq = Sequence::create(action, action_back, NULL); + auto seq = Sequence::create(action, action_back, nullptr); sprite->runAction( RepeatForever::create(seq) ); } @@ -2094,7 +2095,7 @@ SpriteOffsetAnchorScale::SpriteOffsetAnchorScale() auto scale = ScaleBy::create(2, 2); auto scale_back = scale->reverse(); - auto seq_scale = Sequence::create(scale, scale_back, NULL); + auto seq_scale = Sequence::create(scale, scale_back, nullptr); sprite->runAction(RepeatForever::create(seq_scale)); addChild(sprite, 0); @@ -2176,7 +2177,7 @@ SpriteBatchNodeOffsetAnchorScale::SpriteBatchNodeOffsetAnchorScale() auto scale = ScaleBy::create(2, 2); auto scale_back = scale->reverse(); - auto seq_scale = Sequence::create(scale, scale_back, NULL); + auto seq_scale = Sequence::create(scale, scale_back, nullptr); sprite->runAction(RepeatForever::create(seq_scale) ); spritesheet->addChild(sprite, i); @@ -2244,7 +2245,7 @@ SpriteAnimationSplit::SpriteAnimationSplit() FlipX::create(true), animate->clone(), FlipX::create(false), - NULL); + nullptr); sprite->runAction(RepeatForever::create( seq ) ); } @@ -2405,8 +2406,8 @@ SpriteBatchNodeChildren::SpriteBatchNodeChildren() sprite2->runAction( RepeatForever::create(seq2) ); sprite1->runAction( RepeatForever::create(action_rot)); - sprite1->runAction( RepeatForever::create(Sequence::create(action, action_back,NULL)) ); - sprite1->runAction( RepeatForever::create(Sequence::create(action_s, action_s_back,NULL)) ); + sprite1->runAction( RepeatForever::create(Sequence::create(action, action_back,nullptr)) ); + sprite1->runAction( RepeatForever::create(Sequence::create(action_s, action_s_back,nullptr)) ); } @@ -3214,7 +3215,7 @@ SpriteBatchNodeSkewNegativeScaleChildren::SpriteBatchNodeSkewNegativeScaleChildr sprite->setScale(-1.0f); } - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); auto child1 = Sprite::createWithSpriteFrameName("grossini_dance_01.png"); @@ -3273,7 +3274,7 @@ SpriteSkewNegativeScaleChildren::SpriteSkewNegativeScaleChildren() sprite->setScale(-1.0f); } - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); auto child1 = Sprite::createWithSpriteFrameName("grossini_dance_01.png"); @@ -3314,7 +3315,7 @@ SpriteNilTexture::SpriteNilTexture() { auto s = Director::getInstance()->getWinSize(); - Sprite* sprite = NULL; + Sprite* sprite = nullptr; // TEST: If no texture is given, then Opacity + Color should work. @@ -3514,7 +3515,7 @@ SpriteDoubleResolution::SpriteDoubleResolution() // Actions auto scale = ScaleBy::create(2, 0.5); auto scale_back = scale->reverse(); - auto seq = Sequence::create(scale, scale_back, NULL); + auto seq = Sequence::create(scale, scale_back, nullptr); auto seq_copy = seq->clone(); @@ -3610,7 +3611,7 @@ AnimationCacheTest::AnimationCacheTest() auto animG = Animate::create(dance_grey); auto animB = Animate::create(dance_blue); - auto seq = Sequence::create(animN, animG, animB, NULL); + auto seq = Sequence::create(animN, animG, animB, nullptr); // create an sprite without texture auto grossini = Sprite::create(); @@ -3666,7 +3667,7 @@ AnimationCacheFile::AnimationCacheFile() auto animG = Animate::create(dance_grey); auto animB = Animate::create(dance_blue); - auto seq = Sequence::create(animN, animG, animB, NULL); + auto seq = Sequence::create(animN, animG, animB, nullptr); // create an sprite without texture auto grossini = Sprite::create(); @@ -3798,7 +3799,7 @@ SpriteOffsetAnchorSkew::SpriteOffsetAnchorSkew() auto skewY = SkewBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); addChild(sprite, 0); @@ -3881,7 +3882,7 @@ SpriteBatchNodeOffsetAnchorSkew::SpriteBatchNodeOffsetAnchorSkew() auto skewY = SkewBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); spritebatch->addChild(sprite, i); @@ -3962,13 +3963,13 @@ SpriteOffsetAnchorSkewScale::SpriteOffsetAnchorSkewScale() auto skewY = SkewBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); // Scale auto scale = ScaleBy::create(2, 2); auto scale_back = scale->reverse(); - auto seq_scale = Sequence::create(scale, scale_back, NULL); + auto seq_scale = Sequence::create(scale, scale_back, nullptr); sprite->runAction(RepeatForever::create(seq_scale)); addChild(sprite, 0); @@ -4051,13 +4052,13 @@ SpriteBatchNodeOffsetAnchorSkewScale::SpriteBatchNodeOffsetAnchorSkewScale() auto skewY = SkewBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); // scale auto scale = ScaleBy::create(2, 2); auto scale_back = scale->reverse(); - auto seq_scale = Sequence::create(scale, scale_back, NULL); + auto seq_scale = Sequence::create(scale, scale_back, nullptr); sprite->runAction(RepeatForever::create(seq_scale)); spritebatch->addChild(sprite, i); @@ -4136,7 +4137,7 @@ SpriteOffsetAnchorFlip::SpriteOffsetAnchorFlip() auto flip = FlipY::create(true); auto flip_back = FlipY::create(false); auto delay = DelayTime::create(1); - auto seq = Sequence::create(delay, flip, delay->clone(), flip_back, NULL); + auto seq = Sequence::create(delay, flip, delay->clone(), flip_back, nullptr); sprite->runAction(RepeatForever::create(seq)); addChild(sprite, 0); @@ -4218,7 +4219,7 @@ SpriteBatchNodeOffsetAnchorFlip::SpriteBatchNodeOffsetAnchorFlip() auto flip = FlipY::create(true); auto flip_back = FlipY::create(false); auto delay = DelayTime::create(1); - auto seq = Sequence::create(delay, flip, delay->clone(), flip_back, NULL); + auto seq = Sequence::create(delay, flip, delay->clone(), flip_back, nullptr); sprite->runAction(RepeatForever::create(seq)); spritebatch->addChild(sprite, i); @@ -4502,7 +4503,7 @@ SpriteOffsetAnchorRotationalSkew::SpriteOffsetAnchorRotationalSkew() auto skewY = RotateBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); addChild(sprite, 0); @@ -4585,7 +4586,7 @@ SpriteBatchNodeOffsetAnchorRotationalSkew::SpriteBatchNodeOffsetAnchorRotational auto skewY = RotateBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); spritebatch->addChild(sprite, i); @@ -4666,13 +4667,13 @@ SpriteOffsetAnchorRotationalSkewScale::SpriteOffsetAnchorRotationalSkewScale() auto skewY = RotateBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); // Scale auto scale = ScaleBy::create(2, 2); auto scale_back = scale->reverse(); - auto seq_scale = Sequence::create(scale, scale_back, NULL); + auto seq_scale = Sequence::create(scale, scale_back, nullptr); sprite->runAction(RepeatForever::create(seq_scale)); addChild(sprite, i); @@ -4754,13 +4755,13 @@ SpriteBatchNodeOffsetAnchorRotationalSkewScale::SpriteBatchNodeOffsetAnchorRotat auto skewY = RotateBy::create(2, 0, 45); auto skewY_back = skewY->reverse(); - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); // Scale auto scale = ScaleBy::create(2, 2); auto scale_back = scale->reverse(); - auto seq_scale = Sequence::create(scale, scale_back, NULL); + auto seq_scale = Sequence::create(scale, scale_back, nullptr); sprite->runAction(RepeatForever::create(seq_scale)); spritebatch->addChild(sprite, i); @@ -4820,7 +4821,7 @@ SpriteRotationalSkewNegativeScaleChildren::SpriteRotationalSkewNegativeScaleChil sprite->setScale(-1.0f); } - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); auto child1 = Sprite::create("Images/grossini_dance_01.png"); @@ -4887,7 +4888,7 @@ SpriteBatchNodeRotationalSkewNegativeScaleChildren::SpriteBatchNodeRotationalSke sprite->setScale(-1.0f); } - auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, NULL); + auto seq_skew = Sequence::create(skewX, skewX_back, skewY, skewY_back, nullptr); sprite->runAction(RepeatForever::create(seq_skew)); auto child1 = Sprite::create("Images/grossini_dance_01.png"); @@ -4995,3 +4996,48 @@ std::string SpriteCullTest2::subtitle() const { return "Look at the GL calls"; } + +//------------------------------------------------------------------ +// +// Sprite 3D rotation test +// +//------------------------------------------------------------------ +Sprite3DRotationTest::Sprite3DRotationTest() +{ + Size s = Director::getInstance()->getWinSize(); + + //Create reference sprite that's rotating based on there anchor point + auto s1 = Sprite::create("Images/grossini.png"); + s1->setPosition(s.width/4, s.height/4 * 3); + s1->setAnchorPoint(Vec2(0, 0)); + s1->runAction(RepeatForever::create(RotateBy::create(6, 360))); + addChild(s1); + + auto s2 = Sprite::create("Images/grossini.png"); + s2->setPosition(s.width/4 * 3, s.height/4 * 3); + s2->runAction(RepeatForever::create(RotateBy::create(6, 360))); + addChild(s2); + + sprite1 = Sprite::create("Images/grossini.png"); + sprite1->setPosition(s.width/4, s.height/4); + sprite1->setAnchorPoint(Vec2(0,0)); + + addChild(sprite1); + + sprite2 = Sprite::create("Images/grossini.png"); + sprite2->setPosition(s.width/4 * 3, s.height/4); + + addChild(sprite2); + + scheduleUpdate(); +} + +void Sprite3DRotationTest::update(float delta) +{ + rotation.y += 1; + sprite1->setRotation3D(rotation); + sprite2->setRotation3D(rotation); +} + + + diff --git a/tests/cpp-tests/Classes/SpriteTest/SpriteTest.h b/tests/cpp-tests/Classes/SpriteTest/SpriteTest.h index e02b16082f..5467d46482 100644 --- a/tests/cpp-tests/Classes/SpriteTest/SpriteTest.h +++ b/tests/cpp-tests/Classes/SpriteTest/SpriteTest.h @@ -749,6 +749,22 @@ public: virtual std::string subtitle() const override; }; +class Sprite3DRotationTest : public SpriteTestDemo +{ +public: + CREATE_FUNC(Sprite3DRotationTest); + Sprite3DRotationTest(); + virtual std::string title() const override { return "3D Rotation Test"; }; + virtual std::string subtitle() const override { return "Rotation should based on the anchor point"; }; + virtual void update(float delta) override; + +protected: + Sprite* sprite1; + Sprite* sprite2; + + Vec3 rotation; +}; + class SpriteTestScene : public TestScene { public: diff --git a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp index 92aacdd67c..ea29b7a992 100644 --- a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp +++ b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp @@ -302,7 +302,7 @@ void TextFieldTTFActionTest::onEnter() Sequence::create( FadeOut::create(0.25), FadeIn::create(0.25), - NULL + nullptr )); _textFieldAction->retain(); _action = false; @@ -394,9 +394,9 @@ bool TextFieldTTFActionTest::onTextFieldInsertText(TextFieldTTF * sender, const MoveTo::create(duration, endPos), ScaleTo::create(duration, 1), FadeOut::create(duration), - NULL), + nullptr), CallFuncN::create(CC_CALLBACK_1(TextFieldTTFActionTest::callbackRemoveNodeWhenDidAction, this)), - NULL); + nullptr); label->runAction(seq); return false; } @@ -428,9 +428,9 @@ bool TextFieldTTFActionTest::onTextFieldDeleteBackward(TextFieldTTF * sender, co RotateBy::create(rotateDuration, (rand()%2) ? 360 : -360), repeatTime), FadeOut::create(duration), - NULL), + nullptr), CallFuncN::create(CC_CALLBACK_1(TextFieldTTFActionTest::callbackRemoveNodeWhenDidAction, this)), - NULL); + nullptr); label->runAction(seq); return false; } diff --git a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp index 60f7a34c4b..eb3a4e1e65 100644 --- a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp +++ b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp @@ -370,8 +370,8 @@ void TextureMipMap::onEnter() auto scale2 = scale1->clone(); auto sc_back2 = scale2->reverse(); - img0->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, NULL))); - img1->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, NULL))); + img0->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, nullptr))); + img1->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, nullptr))); log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str()); } @@ -420,8 +420,8 @@ void TexturePVRMipMap::onEnter() auto scale2 = scale1->clone(); auto sc_back2 = scale2->reverse(); - imgMipMap->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, NULL))); - img->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, NULL))); + imgMipMap->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, nullptr))); + img->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, nullptr))); } log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str()); } @@ -463,8 +463,8 @@ void TexturePVRMipMap2::onEnter() auto scale2 = scale1->clone(); auto sc_back2 = scale2->reverse(); - imgMipMap->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, NULL))); - img->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, NULL))); + imgMipMap->runAction(RepeatForever::create(Sequence::create(scale1, sc_back, nullptr))); + img->runAction(RepeatForever::create(Sequence::create(scale2, sc_back2, nullptr))); log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str()); } @@ -760,7 +760,7 @@ void TexturePVRRGB888::onEnter() auto s = Director::getInstance()->getWinSize(); auto img = Sprite::create("Images/test_image_rgb888.pvr"); - if (img != NULL) + if (img != nullptr) { img->setPosition(Vec2( s.width/2.0f, s.height/2.0f)); addChild(img); @@ -1361,7 +1361,7 @@ void TextureAlias::onEnter() // scale them to show auto sc = ScaleBy::create(3, 8.0f); auto sc_back = sc->reverse(); - auto scaleforever = RepeatForever::create(Sequence::create(sc, sc_back, NULL)); + auto scaleforever = RepeatForever::create(Sequence::create(sc, sc_back, nullptr)); auto scaleToo = scaleforever->clone(); sprite2->runAction(scaleforever); @@ -1456,7 +1456,7 @@ void TexturePixelFormat::onEnter() auto fadeout = FadeOut::create(2); auto fadein = FadeIn::create(2); - auto seq = Sequence::create(DelayTime::create(2), fadeout, fadein, NULL); + auto seq = Sequence::create(DelayTime::create(2), fadeout, fadein, nullptr); auto seq_4ever = RepeatForever::create(seq); auto seq_4ever2 = seq_4ever->clone(); auto seq_4ever3 = seq_4ever->clone(); @@ -1551,7 +1551,7 @@ void TextureAsync::onEnter() auto scale = ScaleBy::create(0.3f, 2); auto scale_back = scale->reverse(); - auto seq = Sequence::create(scale, scale_back, NULL); + auto seq = Sequence::create(scale, scale_back, nullptr); label->runAction(RepeatForever::create(seq)); scheduleOnce(schedule_selector(TextureAsync::loadImages), 1.0f); @@ -1638,7 +1638,7 @@ void TextureGlClamp::onEnter() sprite->runAction(rotate); auto scale = ScaleBy::create(2, 0.04f); auto scaleBack = scale->reverse(); - auto seq = Sequence::create(scale, scaleBack, NULL); + auto seq = Sequence::create(scale, scaleBack, nullptr); sprite->runAction(seq); } @@ -1675,7 +1675,7 @@ void TextureGlRepeat::onEnter() sprite->runAction(rotate); auto scale = ScaleBy::create(2, 0.04f); auto scaleBack = scale->reverse(); - auto seq = Sequence::create(scale, scaleBack, NULL); + auto seq = Sequence::create(scale, scaleBack, nullptr); sprite->runAction(seq); } @@ -1697,7 +1697,7 @@ TextureGlRepeat::~TextureGlRepeat() void TextureSizeTest::onEnter() { TextureDemo::onEnter(); - Sprite *sprite = NULL; + Sprite *sprite = nullptr; log("Loading 512x512 image..."); sprite = Sprite::create("Images/texture512x512.png"); @@ -1920,7 +1920,7 @@ void TextureTestScene::runThisTest() void TextureMemoryAlloc::onEnter() { TextureDemo::onEnter(); - _background = NULL; + _background = nullptr; MenuItemFont::setFontSize(24); @@ -1939,14 +1939,14 @@ void TextureMemoryAlloc::onEnter() auto item5 = MenuItemFont::create("A8", CC_CALLBACK_1(TextureMemoryAlloc::updateImage, this)); item5->setTag(4); - auto menu = Menu::create(item1, item2, item3, item4, item5, NULL); + auto menu = Menu::create(item1, item2, item3, item4, item5, nullptr); menu->alignItemsHorizontally(); addChild(menu); auto warmup = MenuItemFont::create("warm up texture", CC_CALLBACK_1(TextureMemoryAlloc::changeBackgroundVisible, this)); - auto menu2 = Menu::create(warmup, NULL); + auto menu2 = Menu::create(warmup, nullptr); menu2->alignItemsHorizontally(); @@ -2074,7 +2074,7 @@ void TexturePVRv3Premult::transformSprite(cocos2d::Sprite *sprite) auto fade = FadeOut::create(2); auto dl = DelayTime::create(2); auto fadein = fade->reverse(); - auto seq = Sequence::create(fade, fadein, dl, NULL); + auto seq = Sequence::create(fade, fadein, dl, nullptr); auto repeat = RepeatForever::create(seq); sprite->runAction(repeat); } diff --git a/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp b/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp index 016d5da895..2eb4483885 100644 --- a/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp +++ b/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp @@ -195,7 +195,7 @@ TileMapTest::TileMapTest() auto scale = ScaleBy::create(4, 0.8f); auto scaleBack = scale->reverse(); - auto seq = Sequence::create(scale, scaleBack, NULL); + auto seq = Sequence::create(scale, scaleBack, nullptr); map->runAction(RepeatForever::create(seq)); } @@ -291,7 +291,7 @@ TMXOrthoTest::TMXOrthoTest() auto scale = ScaleBy::create(10, 0.1f); auto back = scale->reverse(); - auto seq = Sequence::create(scale, back, NULL); + auto seq = Sequence::create(scale, back, nullptr); auto repeat = RepeatForever::create(seq); map->runAction(repeat); @@ -332,7 +332,7 @@ TMXOrthoTest2::TMXOrthoTest2() CCLOG("ContentSize: %f, %f", s.width,s.height); auto& children = map->getChildren(); - SpriteBatchNode* child = NULL; + SpriteBatchNode* child = nullptr; for(const auto &obj : children) { child = static_cast(obj); @@ -361,7 +361,7 @@ TMXOrthoTest3::TMXOrthoTest3() CCLOG("ContentSize: %f, %f", s.width,s.height); auto& children = map->getChildren(); - SpriteBatchNode* child = NULL; + SpriteBatchNode* child = nullptr; for(const auto &node : children) { child = static_cast(node); @@ -483,7 +483,7 @@ TMXReadWriteTest::TMXReadWriteTest() auto fadein = FadeIn::create(2); auto scaleback = ScaleTo::create(1, 1); auto finish = CallFuncN::create(CC_CALLBACK_1(TMXReadWriteTest::removeSprite, this)); - auto seq0 = Sequence::create(move, rotate, scale, opacity, fadein, scaleback, finish, NULL); + auto seq0 = Sequence::create(move, rotate, scale, opacity, fadein, scaleback, finish, nullptr); auto seq1 = seq0->clone(); auto seq2 = seq0->clone(); auto seq3 = seq0->clone(); @@ -947,7 +947,7 @@ TMXIsoZorder::TMXIsoZorder() auto move = MoveBy::create(10, Vec2(300,250)); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq) ); schedule( schedule_selector(TMXIsoZorder::repositionSprite) ); @@ -1013,7 +1013,7 @@ TMXOrthoZorder::TMXOrthoZorder() auto move = MoveBy::create(10, Vec2(400,450)); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq)); schedule( schedule_selector(TMXOrthoZorder::repositionSprite)); @@ -1075,7 +1075,7 @@ TMXIsoVertexZ::TMXIsoVertexZ() auto move = MoveBy::create(10, Vec2(300,250) * (1/CC_CONTENT_SCALE_FACTOR())); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq) ); schedule( schedule_selector(TMXIsoVertexZ::repositionSprite)); @@ -1147,7 +1147,7 @@ TMXOrthoVertexZ::TMXOrthoVertexZ() auto move = MoveBy::create(10, Vec2(400,450) * (1/CC_CONTENT_SCALE_FACTOR())); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq)); schedule(schedule_selector(TMXOrthoVertexZ::repositionSprite)); @@ -1389,7 +1389,7 @@ TMXOrthoFromXMLTest::TMXOrthoFromXMLTest() std::string file = resources + "/orthogonal-test1.tmx"; auto str = String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file.c_str()).c_str()); - CCASSERT(str != NULL, "Unable to open file"); + CCASSERT(str != nullptr, "Unable to open file"); auto map = TMXTiledMap::createWithXML(str->getCString() ,resources.c_str()); addChild(map, 0, kTagTileMap); diff --git a/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp b/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp index 9b895e65bf..f89cb73e62 100644 --- a/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp +++ b/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp @@ -200,7 +200,7 @@ TileMapTestNew::TileMapTestNew() auto scale = ScaleBy::create(4, 0.8f); auto scaleBack = scale->reverse(); - auto seq = Sequence::create(scale, scaleBack, NULL); + auto seq = Sequence::create(scale, scaleBack, nullptr); map->runAction(RepeatForever::create(seq)); } @@ -296,7 +296,7 @@ TMXOrthoTestNew::TMXOrthoTestNew() auto scale = ScaleBy::create(10, 0.1f); auto back = scale->reverse(); - auto seq = Sequence::create(scale, back, NULL); + auto seq = Sequence::create(scale, back, nullptr); auto repeat = RepeatForever::create(seq); map->runAction(repeat); @@ -462,7 +462,7 @@ TMXReadWriteTestNew::TMXReadWriteTestNew() auto fadein = FadeIn::create(2); auto scaleback = ScaleTo::create(1, 1); auto finish = CallFuncN::create(CC_CALLBACK_1(TMXReadWriteTestNew::removeSprite, this)); - auto seq0 = Sequence::create(move, rotate, scale, opacity, fadein, scaleback, finish, NULL); + auto seq0 = Sequence::create(move, rotate, scale, opacity, fadein, scaleback, finish, nullptr); auto seq1 = seq0->clone(); auto seq2 = seq0->clone(); auto seq3 = seq0->clone(); @@ -917,7 +917,7 @@ TMXIsoZorderNew::TMXIsoZorderNew() auto move = MoveBy::create(10, Vec2(300,250)); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq) ); schedule( schedule_selector(TMXIsoZorderNew::repositionSprite) ); @@ -983,7 +983,7 @@ TMXOrthoZorderNew::TMXOrthoZorderNew() auto move = MoveBy::create(10, Vec2(400,450)); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq)); schedule( schedule_selector(TMXOrthoZorderNew::repositionSprite)); @@ -1045,7 +1045,7 @@ TMXIsoVertexZNew::TMXIsoVertexZNew() auto move = MoveBy::create(10, Vec2(300,250) * (1/CC_CONTENT_SCALE_FACTOR())); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq) ); schedule( schedule_selector(TMXIsoVertexZNew::repositionSprite)); @@ -1117,7 +1117,7 @@ TMXOrthoVertexZNew::TMXOrthoVertexZNew() auto move = MoveBy::create(10, Vec2(400,450) * (1/CC_CONTENT_SCALE_FACTOR())); auto back = move->reverse(); - auto seq = Sequence::create(move, back,NULL); + auto seq = Sequence::create(move, back,nullptr); _tamara->runAction( RepeatForever::create(seq)); schedule(schedule_selector(TMXOrthoVertexZNew::repositionSprite)); @@ -1347,7 +1347,7 @@ TMXOrthoFromXMLTestNew::TMXOrthoFromXMLTestNew() std::string file = resources + "/orthogonal-test1.tmx"; auto str = String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file.c_str()).c_str()); - CCASSERT(str != NULL, "Unable to open file"); + CCASSERT(str != nullptr, "Unable to open file"); auto map = FastTMXTiledMap::createWithXML(str->getCString() ,resources.c_str()); addChild(map, 0, kTagTileMap); diff --git a/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp b/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp index 5091bc29a5..7f9ec9103b 100644 --- a/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp +++ b/tests/cpp-tests/Classes/TransitionsTest/TransitionsTest.cpp @@ -280,7 +280,7 @@ TestLayer1::TestLayer1(void) auto item2 = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(TestLayer1::restartCallback, this) ); auto item3 = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(TestLayer1::nextCallback, this) ); - auto menu = Menu::create(item1, item2, item3, NULL); + auto menu = Menu::create(item1, item2, item3, nullptr); menu->setPosition( Vec2::ZERO ); item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); @@ -410,7 +410,7 @@ TestLayer2::TestLayer2() auto item2 = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(TestLayer2::restartCallback, this) ); auto item3 = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(TestLayer2::nextCallback, this) ); - auto menu = Menu::create(item1, item2, item3, NULL); + auto menu = Menu::create(item1, item2, item3, nullptr); menu->setPosition( Vec2::ZERO ); item1->setPosition(Vec2(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocoStudioGUITest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocoStudioGUITest.cpp index 0cb3dcabcc..86e911a64a 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocoStudioGUITest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocoStudioGUITest.cpp @@ -109,7 +109,7 @@ void CocoStudioGUITestScene::onEnter() //#endif MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CocoStudioGUITestScene::BackCallback, this)); - Menu* pMenu = Menu::create(pMenuItem, NULL); + Menu* pMenu = Menu::create(pMenuItem, nullptr); pMenu->setPosition( Vec2::ZERO ); pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp index 6dfc88a1b9..e413761014 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CocosGUIScene.cpp @@ -310,7 +310,7 @@ void CocosGUITestScene::onEnter() //#endif auto pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CocosGUITestScene::BackCallback, this)); - Menu* pMenu =Menu::create(pMenuItem, NULL); + Menu* pMenu =Menu::create(pMenuItem, nullptr); pMenu->setPosition( Vec2::ZERO ); pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomGUIScene.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomGUIScene.cpp index ab993ab32f..a82f5c9384 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomGUIScene.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomGUIScene.cpp @@ -122,7 +122,7 @@ void CustomGUITestScene::onEnter() //#endif MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomGUITestScene::BackCallback, this)); - Menu* pMenu = Menu::create(pMenuItem, NULL); + Menu* pMenu = Menu::create(pMenuItem, nullptr); pMenu->setPosition( Vec2::ZERO ); pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp index 0bd735b7b4..c59549a914 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp @@ -40,7 +40,7 @@ void CustomImageScene::onEnter() //#endif MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomImageScene::BackCallback, this)); - Menu* pMenu = Menu::create(pMenuItem, NULL); + Menu* pMenu = Menu::create(pMenuItem, nullptr); pMenu->setPosition( Vec2::ZERO ); pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp index ea7463c809..2898a95f57 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomParticleWidgetTest/CustomParticleWidgetTest.cpp @@ -54,7 +54,7 @@ void CustomParticleWidgetScene::onEnter() //#endif MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomParticleWidgetScene::BackCallback, this)); - Menu* pMenu = Menu::create(pMenuItem, NULL); + Menu* pMenu = Menu::create(pMenuItem, nullptr); pMenu->setPosition( Vec2::ZERO ); pMenuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageView.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageView.cpp index 7f3e2af5ea..6c392cc8a6 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageView.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageView.cpp @@ -32,7 +32,7 @@ CustomImageView* CustomImageView::create() return custom; } CC_SAFE_DELETE(custom); - return NULL; + return nullptr; } bool CustomImageView::init() diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageViewReader.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageViewReader.cpp index d026cba12e..b2d9e6586e 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageViewReader.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomImageViewReader.cpp @@ -8,7 +8,7 @@ USING_NS_CC_EXT; using namespace cocos2d::ui; using namespace cocostudio; -static CustomImageViewReader* _instanceCustomImageViewReader = NULL; +static CustomImageViewReader* _instanceCustomImageViewReader = nullptr; CustomImageViewReader::CustomImageViewReader() { diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidget.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidget.cpp index 7e9aacd47c..0faa26e259 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidget.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidget.cpp @@ -40,7 +40,7 @@ CustomParticleWidget* CustomParticleWidget::create() return custom; } CC_SAFE_DELETE(custom); - return NULL; + return nullptr; } bool CustomParticleWidget::init() diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidgetReader.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidgetReader.cpp index 1e8c955e3d..8105b7669f 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidgetReader.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomParticleWidgetReader.cpp @@ -25,7 +25,7 @@ CustomParticleWidgetReader::~CustomParticleWidgetReader() } -static CustomParticleWidgetReader* _instanceCustomParticleWidgetReader = NULL; +static CustomParticleWidgetReader* _instanceCustomParticleWidgetReader = nullptr; CustomParticleWidgetReader* CustomParticleWidgetReader::getInstance() { diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp index 99cfc80547..13e7e8b804 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomWidget/CustomReader.cpp @@ -3,7 +3,7 @@ #include "CustomReader.h" #include "CustomImageView.h" -static CustomReader* _instanceCustomReader = NULL; +static CustomReader* _instanceCustomReader = nullptr; CustomReader::CustomReader() { diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp index 346fb713d4..35c713551b 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp @@ -42,6 +42,17 @@ bool UIButtonTest::init() // button->addTouchEventListener(this, toucheventselector(UIButtonTest::touchEvent)); button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest::touchEvent, this)); _uiLayer->addChild(button); + + // Create the imageview + ImageView* imageView = ImageView::create(); + + imageView->setPosition(Vec2(widgetSize.width / 2.0f + 50+ button->getContentSize().width/2, + widgetSize.height / 2.0f)); + imageView->setTag(12); + + _uiLayer->addChild(imageView); + + return true; } @@ -61,7 +72,15 @@ void UIButtonTest::touchEvent(Ref *pSender, Widget::TouchEventType type) break; case Widget::TouchEventType::ENDED: + { _displayValueLabel->setString(String::createWithFormat("Touch Up")->getCString()); + ImageView* imageView = (ImageView*)_uiLayer->getChildByTag(12); + imageView->setVisible(false); + imageView->loadTexture("cocosui/ccicon.png"); + imageView->setOpacity(0); + imageView->setVisible(true); + imageView->runAction(Sequence::create(FadeIn::create(0.5),DelayTime::create(1.0),FadeOut::create(0.5), nullptr)); + } break; case Widget::TouchEventType::CANCELED: @@ -111,10 +130,18 @@ bool UIButtonTest_Scale9::init() button->setScale9Enabled(true); button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f)); button->setContentSize(Size(150, 70)); -// button->addTouchEventListener(this, toucheventselector(UIButtonTest_Scale9::touchEvent)); button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Scale9::touchEvent, this)); _uiLayer->addChild(button); + // Create the imageview + Button* button2 = Button::create(); + button2->setPosition(Vec2(widgetSize.width / 2.0f + button->getContentSize().width + 20, widgetSize.height / 2.0f)); + button2->setName("normal"); + _uiLayer->addChild(button2); + + Sprite *sprite = Sprite::create("cocosui/animationbuttonnormal.png"); + button2->addChild(sprite); + return true; } return false; @@ -133,7 +160,13 @@ void UIButtonTest_Scale9::touchEvent(Ref *pSender, Widget::TouchEventType type) break; case Widget::TouchEventType::ENDED: + { _displayValueLabel->setString(String::createWithFormat("Touch Up")->getCString()); + Button *btn = (Button*)_uiLayer->getChildByName("normal"); + btn->loadTextureNormal("cocosui/animationbuttonnormal.png"); + btn->loadTexturePressed("cocosui/animationbuttonpressed.png"); + btn->runAction(Sequence::create(FadeIn::create(0.5),DelayTime::create(1.0),FadeOut::create(0.5), nullptr)); + } break; case Widget::TouchEventType::CANCELED: @@ -180,8 +213,10 @@ bool UIButtonTest_PressedAction::init() Button* button = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); button->setPressedActionEnabled(true); button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f)); -// button->addTouchEventListener(this, toucheventselector(UIButtonTest_PressedAction::touchEvent)); + button->setColor(Color3B::GREEN); + button->setOpacity(30); button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_PressedAction::touchEvent, this)); + button->setName("button"); _uiLayer->addChild(button); return true; @@ -202,7 +237,11 @@ void UIButtonTest_PressedAction::touchEvent(Ref *pSender, Widget::TouchEventType break; case Widget::TouchEventType::ENDED: + { _displayValueLabel->setString(String::createWithFormat("Touch Up")->getCString()); + Button* btn = (Button*)_uiLayer->getChildByName("button"); + btn->loadTextureNormal("cocosui/animationbuttonnormal.png"); + } break; case Widget::TouchEventType::CANCELED: @@ -255,6 +294,16 @@ bool UIButtonTest_Title::init() button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Title::touchEvent, this)); _uiLayer->addChild(button); + + TextBMFont *text = TextBMFont::create("BMFont", "cocosui/bitmapFontTest2.fnt"); + text->setPosition(button->getPosition() + Vec2(button->getContentSize().width/2 + 50,0)); + text->setColor(Color3B::YELLOW); + text->setOpacity(50); + text->setName("text"); + + + _uiLayer->addChild(text); + return true; } return false; @@ -274,7 +323,17 @@ void UIButtonTest_Title::touchEvent(Ref *pSender, Widget::TouchEventType type) break; case Widget::TouchEventType::ENDED: + { _displayValueLabel->setString(String::createWithFormat("Touch Up")->getCString()); + TextBMFont *text = (TextBMFont*)_uiLayer->getChildByName("text"); + text->setFntFile("cocosui/bitmapFontTest2.fnt"); + if (text->getString() == "BMFont") { + text->setString("Hello"); + } + else{ + text->setString("BMFont"); + } + } break; case Widget::TouchEventType::CANCELED: diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp index 030c136b4c..42ffc6e318 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp @@ -302,7 +302,7 @@ bool UIFocusTestNestedLayout1::init() //add HBox into VBox HBox *hbox = HBox::create(); - hbox->setScale(0.8); + hbox->setScale(0.8f); hbox->setTag(101); _verticalLayout->addChild(hbox); @@ -384,7 +384,7 @@ bool UIFocusTestNestedLayout2::init() _horizontalLayout = HBox::create(); _horizontalLayout->setPosition(Vec2(winSize.width/2 - 200, winSize.height - 70)); _uiLayer->addChild(_horizontalLayout); - _horizontalLayout->setScale(0.6); + _horizontalLayout->setScale(0.6f); _horizontalLayout->setFocused(true); _horizontalLayout->setLoopFocus(true); @@ -397,14 +397,14 @@ bool UIFocusTestNestedLayout2::init() w->setAnchorPoint(Vec2(0,1)); w->setTouchEnabled(true); w->setTag(i+count1); - w->setScaleY(2.4); + w->setScaleY(2.4f); w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestNestedLayout2::onImageViewClicked, this)); _horizontalLayout->addChild(w); } //add HBox into VBox VBox *vbox = VBox::create(); - vbox->setScale(0.8); + vbox->setScale(0.8f); vbox->setTag(101); _horizontalLayout->addChild(vbox); @@ -486,7 +486,7 @@ bool UIFocusTestNestedLayout3::init() _verticalLayout = VBox::create(); _verticalLayout->setPosition(Vec2(40, winSize.height - 70)); _uiLayer->addChild(_verticalLayout); - _verticalLayout->setScale(0.8); + _verticalLayout->setScale(0.8f); _verticalLayout->setFocused(true); _verticalLayout->setLoopFocus(true); @@ -602,7 +602,7 @@ bool UIFocusTestListView::init() _listView->setPosition(Vec2(40, 70)); _uiLayer->addChild(_listView); - _listView->setScale(0.8); + _listView->setScale(0.8f); _listView->setFocused(true); _listView->setLoopFocus(true); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp index f10366869d..8de636b9de 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp @@ -57,7 +57,7 @@ bool UIListViewTest_Vertical::init() listView->setBounceEnabled(true); listView->setBackGroundImage("cocosui/green_edit.png"); listView->setBackGroundImageScale9Enabled(true); - listView->setSize(Size(240, 130)); + listView->setContentSize(Size(240, 130)); listView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f + (backgroundSize.width - listView->getContentSize().width) / 2.0f, (widgetSize.height - backgroundSize.height) / 2.0f + @@ -74,7 +74,7 @@ bool UIListViewTest_Vertical::init() Layout* default_item = Layout::create(); default_item->setTouchEnabled(true); - default_item->setSize(default_button->getContentSize()); + default_item->setContentSize(default_button->getContentSize()); default_button->setPosition(Vec2(default_item->getContentSize().width / 2.0f, default_item->getContentSize().height / 2.0f)); default_item->addChild(default_button); @@ -106,10 +106,10 @@ bool UIListViewTest_Vertical::init() Button* custom_button = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); custom_button->setName("Title Button"); custom_button->setScale9Enabled(true); - custom_button->setSize(default_button->getContentSize()); + custom_button->setContentSize(default_button->getContentSize()); Layout *custom_item = Layout::create(); - custom_item->setSize(custom_button->getContentSize()); + custom_item->setContentSize(custom_button->getContentSize()); custom_button->setPosition(Vec2(custom_item->getContentSize().width / 2.0f, custom_item->getContentSize().height / 2.0f)); custom_item->addChild(custom_button); @@ -123,10 +123,10 @@ bool UIListViewTest_Vertical::init() Button* custom_button = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); custom_button->setName("Title Button"); custom_button->setScale9Enabled(true); - custom_button->setSize(default_button->getContentSize()); + custom_button->setContentSize(default_button->getContentSize()); Layout *custom_item = Layout::create(); - custom_item->setSize(custom_button->getContentSize()); + custom_item->setContentSize(custom_button->getContentSize()); custom_button->setPosition(Vec2(custom_item->getContentSize().width / 2.0f, custom_item->getContentSize().height / 2.0f)); custom_item->addChild(custom_button); custom_item->setTag(1); @@ -255,7 +255,7 @@ bool UIListViewTest_Horizontal::init() listView->setBounceEnabled(true); listView->setBackGroundImage("cocosui/green_edit.png"); listView->setBackGroundImageScale9Enabled(true); - listView->setSize(Size(240, 130)); + listView->setContentSize(Size(240, 130)); listView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f + (backgroundSize.width - listView->getContentSize().width) / 2.0f, (widgetSize.height - backgroundSize.height) / 2.0f + @@ -270,7 +270,7 @@ bool UIListViewTest_Horizontal::init() Layout *default_item = Layout::create(); default_item->setTouchEnabled(true); - default_item->setSize(default_button->getContentSize()); + default_item->setContentSize(default_button->getContentSize()); default_button->setPosition(Vec2(default_item->getContentSize().width / 2.0f, default_item->getContentSize().height / 2.0f)); default_item->addChild(default_button); @@ -295,10 +295,10 @@ bool UIListViewTest_Horizontal::init() Button* custom_button = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); custom_button->setName("Title Button"); custom_button->setScale9Enabled(true); - custom_button->setSize(default_button->getContentSize()); + custom_button->setContentSize(default_button->getContentSize()); Layout* custom_item = Layout::create(); - custom_item->setSize(custom_button->getContentSize()); + custom_item->setContentSize(custom_button->getContentSize()); custom_button->setPosition(Vec2(custom_item->getContentSize().width / 2.0f, custom_item->getContentSize().height / 2.0f)); custom_item->addChild(custom_button); @@ -312,10 +312,10 @@ bool UIListViewTest_Horizontal::init() Button* custom_button = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png"); custom_button->setName("Title Button"); custom_button->setScale9Enabled(true); - custom_button->setSize(default_button->getContentSize()); + custom_button->setContentSize(default_button->getContentSize()); Layout* custom_item = Layout::create(); - custom_item->setSize(custom_button->getContentSize()); + custom_item->setContentSize(custom_button->getContentSize()); custom_button->setPosition(Vec2(custom_item->getContentSize().width / 2.0f, custom_item->getContentSize().height / 2.0f)); custom_item->addChild(custom_button); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp index 7c590f4810..69ad20c90a 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager.cpp @@ -125,7 +125,7 @@ static const char* s_testArray[] = #endif }; -static UISceneManager *sharedInstance = NULL; +static UISceneManager *sharedInstance = nullptr; UISceneManager::UISceneManager() @@ -140,7 +140,7 @@ UISceneManager::~UISceneManager() UISceneManager * UISceneManager::sharedUISceneManager() { - if (sharedInstance == NULL) + if (sharedInstance == nullptr) { sharedInstance = new UISceneManager(); } @@ -391,5 +391,5 @@ Scene *UISceneManager::currentUIScene() return VideoPlayerTest::sceneWithTitle(s_testArray[_currentUISceneId]); #endif } - return NULL; + return nullptr; } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager_Editor.cpp index fcbc977ebf..38d81fc076 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISceneManager_Editor.cpp @@ -48,7 +48,7 @@ static const char* s_testArray[] = "UIScrollViewTest_Both_Editor", }; -static UISceneManager_Editor* sharedInstance = NULL; +static UISceneManager_Editor* sharedInstance = nullptr; UISceneManager_Editor::UISceneManager_Editor() { @@ -62,7 +62,7 @@ UISceneManager_Editor::~UISceneManager_Editor() UISceneManager_Editor* UISceneManager_Editor::sharedUISceneManager_Editor() { - if (sharedInstance == NULL) + if (sharedInstance == nullptr) { sharedInstance = new UISceneManager_Editor(); } @@ -181,5 +181,5 @@ Scene* UISceneManager_Editor::currentUIScene() break; } - return NULL; + return nullptr; } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp index b7e12095d0..0f9a93c5af 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp @@ -41,7 +41,7 @@ bool UIScene_Editor::init() pToggleItem->setPosition(Vec2(VisibleRect::right().x - 150, VisibleRect::top().y - 50));; - Menu* pMenu =Menu::create(pToggleItem, NULL); + Menu* pMenu =Menu::create(pToggleItem, nullptr); pMenu->setPosition( Vec2::ZERO ); addChild(pMenu, 1); diff --git a/tests/cpp-tests/Classes/ZwoptexTest/ZwoptexTest.cpp b/tests/cpp-tests/Classes/ZwoptexTest/ZwoptexTest.cpp index 333a0c0f8b..e2b4704a86 100644 --- a/tests/cpp-tests/Classes/ZwoptexTest/ZwoptexTest.cpp +++ b/tests/cpp-tests/Classes/ZwoptexTest/ZwoptexTest.cpp @@ -16,7 +16,7 @@ Layer* createZwoptexLayer(int nIndex) case 0: return new ZwoptexGenericTest(); } - return NULL; + return nullptr; } Layer* nextZwoptexTest() diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index 9eb2ea5447..b11d648d94 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -126,7 +126,7 @@ TestController::TestController() { // add close menu auto closeItem = MenuItemImage::create(s_pathClose, s_pathClose, CC_CALLBACK_1(TestController::closeCallback, this) ); - auto menu =Menu::create(closeItem, NULL); + auto menu =Menu::create(closeItem, nullptr); menu->setPosition( Vec2::ZERO ); closeItem->setPosition(Vec2( VisibleRect::right().x - 30, VisibleRect::top().y - 30)); @@ -533,7 +533,7 @@ void TestController::autorun() If socket(2) (or connect(2)) fails, we (close the socket and) try the next address. */ - for (rp = result; rp != NULL; rp = rp->ai_next) { + for (rp = result; rp != nullptr; rp = rp->ai_next) { sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); if (sfd == -1) @@ -549,7 +549,7 @@ void TestController::autorun() #endif } - if (rp == NULL) { /* No address succeeded */ + if (rp == nullptr) { /* No address succeeded */ CCLOG("autotest: could not connect!"); return; } diff --git a/tests/cpp-tests/Classes/testBasic.cpp b/tests/cpp-tests/Classes/testBasic.cpp index 9c0ea38104..e60f288055 100644 --- a/tests/cpp-tests/Classes/testBasic.cpp +++ b/tests/cpp-tests/Classes/testBasic.cpp @@ -41,7 +41,7 @@ void TestScene::onEnter() auto label = Label::createWithTTF(ttfConfig,"MainMenu"); auto menuItem = MenuItemLabel::create(label, testScene_callback ); - auto menu = Menu::create(menuItem, NULL); + auto menu = Menu::create(menuItem, nullptr); menu->setPosition( Vec2::ZERO ); menuItem->setPosition( Vec2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); diff --git a/tests/cpp-tests/Resources/Sprite3DTest/checkboard.png b/tests/cpp-tests/Resources/Sprite3DTest/checkboard.png deleted file mode 100644 index c7dc08d458..0000000000 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/checkboard.png and /dev/null differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/cube_anim.c3t b/tests/cpp-tests/Resources/Sprite3DTest/cube_anim.c3t deleted file mode 100644 index d455d956f0..0000000000 --- a/tests/cpp-tests/Resources/Sprite3DTest/cube_anim.c3t +++ /dev/null @@ -1,162 +0,0 @@ -{ - "version": "1.2", - "file_type": "c3t", - "mesh_data": [ - { - "version": "1.2", - "mesh_vertex_attribute": [ - { - "size":3, - "type":"GL_FLOAT", - "vertex_attribute":"VERTEX_ATTRIB_POSITION" - }, - { - "size":3, - "type":"GL_FLOAT", - "vertex_attribute":"VERTEX_ATTRIB_NORMAL" - }, - { - "size":2, - "type":"GL_FLOAT", - "vertex_attribute":"VERTEX_ATTRIB_TEX_COORD" - }, - { - "size":4, - "type":"GL_FLOAT", - "vertex_attribute":"VERTEX_ATTRIB_BLEND_WEIGHT" - }, - { - "size":4, - "type":"GL_FLOAT", - "vertex_attribute":"VERTEX_ATTRIB_BLEND_INDEX" - } - ], - "body":[ - { - "vertices": [ - 0.000000, -2.259414, -2.259414, 0.000000, 0.000000, -1.000000, 0.582997, 0.456003, 0.500033, 0.499967, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - -5.314565, -2.259414, -2.259414, 0.000000, 0.000000, -1.000000, 0.582997, 0.168971, 0.933581, 0.066419, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, - 0.000000, 2.259414, -2.259414, 0.000000, 0.000000, -1.000000, 0.827052, 0.456003, 0.500111, 0.499889, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - -5.314565, 2.259414, -2.259414, 0.000000, 0.000000, -1.000000, 0.827052, 0.168971, 0.932199, 0.067801, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, - 0.000000, -2.259414, 2.259414, 0.000000, -1.000000, 0.000000, 0.253258, 0.705932, 0.500033, 0.499967, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - -5.314565, -2.259414, 2.259414, 0.000000, -1.000000, 0.000000, 0.253258, 0.418900, 0.933581, 0.066419, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, - -5.314565, -2.259414, -2.259414, 0.000000, -1.000000, 0.000000, 0.497313, 0.418900, 0.933581, 0.066419, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, - 0.000000, -2.259414, -2.259414, 0.000000, -1.000000, 0.000000, 0.497313, 0.705932, 0.500033, 0.499967, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - -5.314565, 2.259414, 2.259414, -1.000000, 0.000000, 0.000000, 0.753117, 0.748774, 0.932199, 0.067801, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, - -5.314565, -2.259414, -2.259414, -1.000000, 0.000000, 0.000000, 0.997172, 0.992829, 0.933581, 0.066419, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, - -5.314565, -2.259414, 2.259414, -1.000000, 0.000000, 0.000000, 0.753117, 0.992829, 0.933581, 0.066419, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, - -5.314565, 2.259414, -2.259414, -1.000000, 0.000000, 0.000000, 0.997172, 0.748774, 0.932199, 0.067801, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, - 5.314565, -2.259414, -2.259414, 0.000000, 0.000000, -1.000000, 0.582997, 0.743034, 0.932057, 0.067943, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 5.314565, 2.259414, -2.259414, 0.000000, 0.000000, -1.000000, 0.827052, 0.743034, 0.938571, 0.061429, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 5.314565, -2.259414, 2.259414, 0.000000, -1.000000, 0.000000, 0.253258, 0.992964, 0.932057, 0.067943, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 5.314565, -2.259414, -2.259414, 0.000000, -1.000000, 0.000000, 0.497313, 0.992964, 0.932057, 0.067943, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 5.314565, 2.259414, 2.259414, 1.000000, 0.000000, 0.000000, 0.503187, 0.992829, 0.938571, 0.061429, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 5.314565, -2.259414, 2.259414, 1.000000, 0.000000, 0.000000, 0.503187, 0.748774, 0.932057, 0.067943, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 5.314565, -2.259414, -2.259414, 1.000000, 0.000000, 0.000000, 0.747243, 0.748774, 0.932057, 0.067943, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 5.314565, 2.259414, -2.259414, 1.000000, 0.000000, 0.000000, 0.747243, 0.992829, 0.938571, 0.061429, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 0.000000, 2.259414, 2.259414, 0.000000, 1.000000, 0.000000, 0.003328, 0.705932, 0.500111, 0.499889, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - -5.314565, 2.259414, -2.259414, 0.000000, 1.000000, 0.000000, 0.247384, 0.992964, 0.932199, 0.067801, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, - -5.314565, 2.259414, 2.259414, 0.000000, 1.000000, 0.000000, 0.003328, 0.992964, 0.932199, 0.067801, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, - 0.000000, 2.259414, -2.259414, 0.000000, 1.000000, 0.000000, 0.247384, 0.705932, 0.500111, 0.499889, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 5.314565, 2.259414, 2.259414, 0.000000, 1.000000, 0.000000, 0.003328, 0.418900, 0.938571, 0.061429, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 5.314565, 2.259414, -2.259414, 0.000000, 1.000000, 0.000000, 0.247384, 0.418900, 0.938571, 0.061429, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 0.000000, 2.259414, 2.259414, 0.000000, 0.000000, 1.000000, 0.290226, 0.413161, 0.500111, 0.499889, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - -5.314565, 2.259414, 2.259414, 0.000000, 0.000000, 1.000000, 0.003194, 0.413161, 0.932199, 0.067801, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, - -5.314565, -2.259414, 2.259414, 0.000000, 0.000000, 1.000000, 0.003194, 0.169105, 0.933581, 0.066419, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, - 0.000000, -2.259414, 2.259414, 0.000000, 0.000000, 1.000000, 0.290226, 0.169105, 0.500033, 0.499967, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 5.314565, 2.259414, 2.259414, 0.000000, 0.000000, 1.000000, 0.577257, 0.413161, 0.938571, 0.061429, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, - 5.314565, -2.259414, 2.259414, 0.000000, 0.000000, 1.000000, 0.577257, 0.169105, 0.932057, 0.067943, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000 - ], - "vertex_size": 512, - "indices": [ - 0, 1, 2, 1, 3, 2, 4, 5, 6, 4, 6, 7, - 8, 9, 10, 9, 8, 11, 12, 0, 13, 0, 2, 13, - 14, 4, 7, 14, 7, 15, 16, 17, 18, 16, 18, 19, - 20, 21, 22, 21, 20, 23, 24, 23, 20, 23, 24, 25, - 26, 27, 28, 26, 28, 29, 30, 26, 29, 30, 29, 31 - ], - "index_number": 60 - } - ] - } - ], - "material_data": [ - { - "file_name": "Sprite3DTest/checkboard.png" - } - ], - "skin_data": [ - { - "id": "cubeanim:cube", - "bind_shape": [ 0.393701, 0.000000, 0.000000, 0.000000, 0.000000, 0.393701, 0.000000, 0.000000, 0.000000, -0.000000, 0.393701, 0.000000, 0.100748, 0.000000, -0.457948, 1.000000], - "bones": [ - { - "node": "bone1", - "bind_pos": [ 0.999989, 0.004613, 0.000000, 0.000000, -0.004613, 0.999989, 0.000000, 0.000000, -0.000000, -0.000000, 1.000000, 0.000000, -0.036861, 0.049203, 0.000000, 1.000000] - }, - { - "node": "bone", - "bind_pos": [ 0.999958, 0.009184, 0.000000, 0.000000, -0.009184, 0.999958, 0.000000, 0.000000, -0.000000, -0.000000, 1.000000, 0.000000, -5.393930, -0.000000, -0.000000, 1.000000] - } - ] - }, - { - "id": "root", - "children": [ - { - "id": "bone", - "children": [ - { - "id": "bone1", - "children": [ - { - "id": "eff" - } - ] - } - ] - } - ] - } - ], - "animation_data": [ - { - "id": "Take 001", - "bones": [ - { - "id": "bone1", - "keyframes": [ - { - "rotation":[ - { - "keytime": 0.000000, - "value": [ 0.000000, -0.000000, -0.002285, 0.999997] - }, - { - "keytime": 0.333332, - "value": [ 0.000000, -0.000000, -0.002285, 0.999997] - }, - { - "keytime": 0.666664, - "value": [ 0.000000, -0.000000, 0.089457, 0.995991] - }, - { - "keytime": 0.800000, - "value": [ 0.000000, -0.000000, 0.184131, 0.982902] - }, - { - "keytime": 0.933328, - "value": [ 0.000000, -0.000000, 0.274421, 0.961610] - }, - { - "keytime": 1.000000, - "value": [ 0.000000, -0.000000, 0.362349, 0.932043] - } - ] - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/tools/cocos2d-console b/tools/cocos2d-console index 7fc616bcbc..ce3e25bcd2 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit 7fc616bcbcfd9b60e8b1188ba974e4f66621beb8 +Subproject commit ce3e25bcd273eaacd516d179587997ce8f62df70 diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index 81750a9172..704d9d79ad 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -35,7 +35,7 @@ classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* M # will apply to all class names. This is a convenience wildcard to be able to skip similar named # functions from all classes. -skip = Node::[setGLServerState description getUserObject .*UserData getGLServerState .*schedule getPosition$ setContentSize setAnchorPoint], +skip = Node::[setGLServerState description getUserObject .*UserData getGLServerState .*schedule getPosition$ setContentSize setAnchorPoint enumerateChildren], Sprite::[getQuad getBlendFunc ^setPosition$ setBlendFunc], SpriteBatchNode::[getBlendFunc setBlendFunc getDescendants], MotionStreak::[getBlendFunc setBlendFunc draw update], @@ -129,7 +129,8 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS Mesh::[create], Sprite3D::[getSkin], Animation3D::[getBoneCurveByName], - Animation3DCache::[*] + Animation3DCache::[*], + Sprite3DMaterialCache::[*] rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame], ProgressTimer::[setReverseProgress=setReverseDirection],