From 2835b094da6bb1b7ce366fcc9066f1abd01c2e27 Mon Sep 17 00:00:00 2001 From: Vladimir Timofeev Date: Thu, 30 Oct 2014 17:25:46 +0300 Subject: [PATCH] Cleanup order of fields initialization. Make initialization order to match declarations. This change twice reduces number of warnings when compiling on MacOS X with Xcode 6.1 Warnings was like "Field 'XXXX' will be initialized after field 'YYYY'" --- cocos/2d/CCCamera.cpp | 4 +-- cocos/2d/CCDrawNode.cpp | 12 ++++---- cocos/2d/CCFastTMXLayer.cpp | 4 +-- cocos/2d/CCFontFreeType.cpp | 6 ++-- cocos/2d/CCLabel.cpp | 28 +++++++++---------- cocos/2d/CCLight.cpp | 2 +- cocos/2d/CCNode.cpp | 12 ++++---- cocos/2d/CCRenderTexture.cpp | 10 +++---- cocos/2d/CCSprite.cpp | 4 +-- cocos/2d/CCTextFieldTTF.cpp | 2 +- cocos/3d/CCAnimate3D.cpp | 6 ++-- cocos/3d/CCAnimationCurve.inl | 4 +-- cocos/3d/CCBundle3D.cpp | 6 ++-- cocos/3d/CCBundle3DData.h | 4 +-- cocos/3d/CCMesh.cpp | 8 +++--- cocos/3d/CCMeshSkin.cpp | 2 +- cocos/base/CCEventController.cpp | 4 +-- cocos/base/CCEventFocus.cpp | 4 +-- .../cocosbuilder/CCBKeyframe.cpp | 4 +-- .../cocostudio/WidgetReader/WidgetReader.cpp | 8 +++--- cocos/network/WebSocket.cpp | 6 ++-- cocos/renderer/CCGLProgramState.cpp | 22 +++++++-------- cocos/renderer/CCMeshCommand.cpp | 10 +++---- cocos/renderer/CCVertexIndexBuffer.cpp | 6 ++-- cocos/renderer/CCVertexIndexData.h | 6 ++-- cocos/ui/UIButton.cpp | 2 +- cocos/ui/UIEditBox/UIEditBox.cpp | 2 +- cocos/ui/UILayout.cpp | 16 +++++------ cocos/ui/UILayoutComponent.cpp | 8 +++--- cocos/ui/UIListView.cpp | 4 +-- cocos/ui/UIPageView.cpp | 14 +++++----- cocos/ui/UIScale9Sprite.cpp | 2 +- cocos/ui/UISlider.cpp | 4 +-- cocos/ui/UIWidget.cpp | 22 +++++++-------- extensions/GUI/CCScrollView/CCScrollView.cpp | 2 +- extensions/assets-manager/AssetsManagerEx.cpp | 14 +++++----- .../assets-manager/CCEventAssetsManagerEx.cpp | 6 ++-- extensions/assets-manager/Downloader.cpp | 4 +-- 38 files changed, 142 insertions(+), 142 deletions(-) diff --git a/cocos/2d/CCCamera.cpp b/cocos/2d/CCCamera.cpp index 27dd0284db..e6f07605a4 100644 --- a/cocos/2d/CCCamera.cpp +++ b/cocos/2d/CCCamera.cpp @@ -66,9 +66,9 @@ Camera* Camera::createOrthographic(float zoomX, float zoomY, float nearPlane, fl } Camera::Camera() -: _cameraFlag(1) -, _scene(nullptr) +: _scene(nullptr) , _viewProjectionDirty(true) +, _cameraFlag(1) { } diff --git a/cocos/2d/CCDrawNode.cpp b/cocos/2d/CCDrawNode.cpp index 3edbe0bbac..894927f5ae 100644 --- a/cocos/2d/CCDrawNode.cpp +++ b/cocos/2d/CCDrawNode.cpp @@ -106,23 +106,23 @@ static inline Tex2F __t(const Vec2 &v) DrawNode::DrawNode() : _vao(0) , _vbo(0) +, _vaoGLPoint(0) +, _vboGLPoint(0) +, _vaoGLLine(0) +, _vboGLLine(0) , _bufferCapacity(0) , _bufferCount(0) , _buffer(nullptr) -, _dirty(false) -, _vaoGLPoint(0) -, _vboGLPoint(0) , _bufferCapacityGLPoint(0) , _bufferCountGLPoint(0) , _bufferGLPoint(nullptr) , _pointColor(1,1,1,1) , _pointSize(1) -, _dirtyGLPoint(false) -, _vaoGLLine(0) -, _vboGLLine(0) , _bufferCapacityGLLine(0) , _bufferCountGLLine(0) , _bufferGLLine(nullptr) +, _dirty(false) +, _dirtyGLPoint(false) , _dirtyGLLine(false) { _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED; diff --git a/cocos/2d/CCFastTMXLayer.cpp b/cocos/2d/CCFastTMXLayer.cpp index fc4d7dc29b..ad84ecac3f 100644 --- a/cocos/2d/CCFastTMXLayer.cpp +++ b/cocos/2d/CCFastTMXLayer.cpp @@ -113,11 +113,11 @@ TMXLayer::TMXLayer() , _tiles(nullptr) , _tileSet(nullptr) , _layerOrientation(FAST_TMX_ORIENTATION_ORTHO) -,_texture(nullptr) +, _texture(nullptr) , _vertexZvalue(0) , _useAutomaticVertexZ(false) -, _dirty(true) , _quadsDirty(true) +, _dirty(true) , _vertexBuffer(nullptr) , _vData(nullptr) , _indexBuffer(nullptr) diff --git a/cocos/2d/CCFontFreeType.cpp b/cocos/2d/CCFontFreeType.cpp index 1ee2c1aebc..446c24f0d3 100644 --- a/cocos/2d/CCFontFreeType.cpp +++ b/cocos/2d/CCFontFreeType.cpp @@ -94,9 +94,9 @@ FT_Library FontFreeType::getFTLibrary() FontFreeType::FontFreeType(bool distanceFieldEnabled /* = false */,int outline /* = 0 */) : _fontRef(nullptr) -,_distanceFieldEnabled(distanceFieldEnabled) -,_outlineSize(0.0f) -,_stroker(nullptr) +, _stroker(nullptr) +, _distanceFieldEnabled(distanceFieldEnabled) +, _outlineSize(0.0f) { if (outline > 0) { diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 79ec70dfca..098142f03d 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -235,30 +235,30 @@ bool Label::setCharMap(const std::string& charMapFile, int itemWidth, int itemHe Label::Label(FontAtlas *atlas /* = nullptr */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */,bool useDistanceField /* = false */,bool useA8Shader /* = false */) -: _reusedLetter(nullptr) -, _commonLineHeight(0.0f) +: _isOpacityModifyRGB(false) +, _contentDirty(false) +, _fontAtlas(atlas) +, _textSprite(nullptr) +, _compatibleMode(false) +, _reusedLetter(nullptr) , _additionalKerning(0.0f) +, _commonLineHeight(0.0f) , _lineBreakWithoutSpaces(false) +, _horizontalKernings(nullptr) , _maxLineWidth(0) +, _labelDimensions(Size::ZERO) , _labelWidth(0) , _labelHeight(0) -, _labelDimensions(Size::ZERO) , _hAlignment(hAlignment) , _vAlignment(vAlignment) -, _horizontalKernings(nullptr) -, _fontAtlas(atlas) -, _isOpacityModifyRGB(false) +, _currNumLines(-1) +, _fontScale(1.0f) , _useDistanceField(useDistanceField) , _useA8Shader(useA8Shader) -, _fontScale(1.0f) -, _uniformEffectColor(0) -, _currNumLines(-1) -, _textSprite(nullptr) -, _contentDirty(false) -, _shadowDirty(false) -, _compatibleMode(false) -, _insideBounds(true) , _effectColorF(Color4F::BLACK) +, _uniformEffectColor(0) +, _shadowDirty(false) +, _insideBounds(true) { setAnchorPoint(Vec2::ANCHOR_MIDDLE); reset(); diff --git a/cocos/2d/CCLight.cpp b/cocos/2d/CCLight.cpp index 30c98b37a4..45777ff5bc 100644 --- a/cocos/2d/CCLight.cpp +++ b/cocos/2d/CCLight.cpp @@ -44,8 +44,8 @@ void BaseLight::setRotationFromDirection( const Vec3 &direction ) BaseLight::BaseLight() : _intensity(1.0f) -, _enabled(true) , _lightFlag(LightFlag::LIGHT0) +, _enabled(true) { } diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 2a0d78965e..27597bb248 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -82,16 +82,18 @@ Node::Node(void) , _scaleX(1.0f) , _scaleY(1.0f) , _scaleZ(1.0f) -, _positionZ(0.0f) , _position(Vec2::ZERO) +, _positionZ(0.0f) +, _usingNormalizedPosition(false) +, _normalizedPositionDirty(false) , _skewX(0.0f) , _skewY(0.0f) , _anchorPointInPoints(Vec2::ZERO) , _anchorPoint(Vec2::ZERO) , _contentSize(Size::ZERO) -, _useAdditionalTransform(false) , _transformDirty(true) , _inverseDirty(true) +, _useAdditionalTransform(false) , _transformUpdated(true) // children (lazy allocs) // lazy alloc @@ -100,6 +102,8 @@ Node::Node(void) , _parent(nullptr) // "whole screen" objects. like Scenes and Layers, should set _ignoreAnchorPointForPosition to true , _tag(Node::INVALID_TAG) +, _name("") +, _hashOfName(0) // userData is always inited as nil , _userData(nullptr) , _userObject(nullptr) @@ -125,10 +129,6 @@ Node::Node(void) , _realColor(Color3B::WHITE) , _cascadeColorEnabled(false) , _cascadeOpacityEnabled(false) -, _usingNormalizedPosition(false) -, _normalizedPositionDirty(false) -, _name("") -, _hashOfName(0) , _cameraMask(1) { // set default scheduler and actionManager diff --git a/cocos/2d/CCRenderTexture.cpp b/cocos/2d/CCRenderTexture.cpp index 201cf0cfc1..5285506af6 100644 --- a/cocos/2d/CCRenderTexture.cpp +++ b/cocos/2d/CCRenderTexture.cpp @@ -40,7 +40,11 @@ NS_CC_BEGIN // implementation RenderTexture RenderTexture::RenderTexture() -: _FBO(0) +: _keepMatrix(false) +, _rtTextureRect(Rect::ZERO) +, _fullRect(Rect::ZERO) +, _fullviewPort(Rect::ZERO) +, _FBO(0) , _depthRenderBufffer(0) , _oldFBO(0) , _texture(0) @@ -53,10 +57,6 @@ RenderTexture::RenderTexture() , _clearStencil(0) , _autoDraw(false) , _sprite(nullptr) -, _keepMatrix(false) -, _rtTextureRect(Rect::ZERO) -, _fullRect(Rect::ZERO) -, _fullviewPort(Rect::ZERO) , _saveFileCallback(nullptr) { #if CC_ENABLE_CACHE_TEXTURE_DATA diff --git a/cocos/2d/CCSprite.cpp b/cocos/2d/CCSprite.cpp index 3deb8978ed..564acd98ef 100644 --- a/cocos/2d/CCSprite.cpp +++ b/cocos/2d/CCSprite.cpp @@ -259,10 +259,10 @@ bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect, bool rotated) } Sprite::Sprite(void) -: _shouldBeHidden(false) +: _batchNode(nullptr) +, _shouldBeHidden(false) , _texture(nullptr) , _insideBounds(true) -, _batchNode(nullptr) { #if CC_SPRITE_DEBUG_DRAW _debugDrawNode = DrawNode::create(); diff --git a/cocos/2d/CCTextFieldTTF.cpp b/cocos/2d/CCTextFieldTTF.cpp index 591d62fb20..1e971665f9 100644 --- a/cocos/2d/CCTextFieldTTF.cpp +++ b/cocos/2d/CCTextFieldTTF.cpp @@ -55,8 +55,8 @@ TextFieldTTF::TextFieldTTF() , _charCount(0) , _inputText("") , _placeHolder("") // prevent Label initWithString assertion -, _secureTextEntry(false) , _colorText(Color4B::WHITE) +, _secureTextEntry(false) { _colorSpaceHolder.r = _colorSpaceHolder.g = _colorSpaceHolder.b = 127; _colorSpaceHolder.a = 255; diff --git a/cocos/3d/CCAnimate3D.cpp b/cocos/3d/CCAnimate3D.cpp index b89805c4dd..0fc5d5b8a4 100644 --- a/cocos/3d/CCAnimate3D.cpp +++ b/cocos/3d/CCAnimate3D.cpp @@ -247,13 +247,13 @@ void Animate3D::setWeight(float weight) } Animate3D::Animate3D() -: _absSpeed(1.f) +: _state(Animate3D::Animate3DState::Running) +, _animation(nullptr) +, _absSpeed(1.f) , _weight(1.f) , _start(0.f) , _last(1.f) -, _animation(nullptr) , _playReverse(false) -, _state(Animate3D::Animate3DState::Running) , _accTransTime(0.0f) , _lastTime(0.0f) { diff --git a/cocos/3d/CCAnimationCurve.inl b/cocos/3d/CCAnimationCurve.inl index ac2207bf9b..41380f8c89 100644 --- a/cocos/3d/CCAnimationCurve.inl +++ b/cocos/3d/CCAnimationCurve.inl @@ -103,8 +103,8 @@ float AnimationCurve::getEndTime() const template AnimationCurve::AnimationCurve() -: _keytime(nullptr) -, _value(nullptr) +: _value(nullptr) +, _keytime(nullptr) , _count(0) , _componentSizeByte(0) , _evaluateFun(nullptr) diff --git a/cocos/3d/CCBundle3D.cpp b/cocos/3d/CCBundle3D.cpp index a80eb35819..a7ac817ee4 100644 --- a/cocos/3d/CCBundle3D.cpp +++ b/cocos/3d/CCBundle3D.cpp @@ -2181,14 +2181,14 @@ Reference* Bundle3D::seekToFirstType(unsigned int type) } Bundle3D::Bundle3D() - :_isBinary(false), - _modelPath(""), + : _modelPath(""), _path(""), _version(""), _jsonBuffer(nullptr), _binaryBuffer(nullptr), _referenceCount(0), - _references(nullptr) + _references(nullptr), + _isBinary(false) { } diff --git a/cocos/3d/CCBundle3DData.h b/cocos/3d/CCBundle3DData.h index 63c5916c89..2e477e49eb 100644 --- a/cocos/3d/CCBundle3DData.h +++ b/cocos/3d/CCBundle3DData.h @@ -364,10 +364,10 @@ public: } Animation3DData(const Animation3DData& other) - : _totalTime(other._totalTime) - , _translationKeys(other._translationKeys) + : _translationKeys(other._translationKeys) , _rotationKeys(other._rotationKeys) , _scaleKeys(other._scaleKeys) + , _totalTime(other._totalTime) { } diff --git a/cocos/3d/CCMesh.cpp b/cocos/3d/CCMesh.cpp index 2ab7417034..f21c507166 100644 --- a/cocos/3d/CCMesh.cpp +++ b/cocos/3d/CCMesh.cpp @@ -36,14 +36,14 @@ using namespace std; NS_CC_BEGIN Mesh::Mesh() -: _visible(true) -, _texture(nullptr) +: _texture(nullptr) , _skin(nullptr) +, _visible(true) +, _isTransparent(false) , _meshIndexData(nullptr) -, _visibleChanged(nullptr) , _glProgramState(nullptr) , _blend(BlendFunc::ALPHA_NON_PREMULTIPLIED) -, _isTransparent(false) +, _visibleChanged(nullptr) { } diff --git a/cocos/3d/CCMeshSkin.cpp b/cocos/3d/CCMeshSkin.cpp index 901ca212d7..d192796df4 100644 --- a/cocos/3d/CCMeshSkin.cpp +++ b/cocos/3d/CCMeshSkin.cpp @@ -33,8 +33,8 @@ static int PALETTE_ROWS = 3; MeshSkin::MeshSkin() : _rootBone(nullptr) -, _matrixPalette(nullptr) , _skeleton(nullptr) +, _matrixPalette(nullptr) { } diff --git a/cocos/base/CCEventController.cpp b/cocos/base/CCEventController.cpp index 3176f7d82c..1c0eebb1e1 100644 --- a/cocos/base/CCEventController.cpp +++ b/cocos/base/CCEventController.cpp @@ -30,8 +30,8 @@ NS_CC_BEGIN EventController::EventController(ControllerEventType type, Controller* controller, int keyCode) : Event(Type::GAME_CONTROLLER) , _controllerEventType(type) -, _keyCode(keyCode) , _controller(controller) +, _keyCode(keyCode) , _isConnected(true) { @@ -41,8 +41,8 @@ EventController::EventController(ControllerEventType type, Controller* controlle : Event(Type::GAME_CONTROLLER) , _controllerEventType(type) , _controller(controller) -, _isConnected(isConnected) , _keyCode(0) +, _isConnected(isConnected) { } diff --git a/cocos/base/CCEventFocus.cpp b/cocos/base/CCEventFocus.cpp index 442f72372c..92ff539dcb 100644 --- a/cocos/base/CCEventFocus.cpp +++ b/cocos/base/CCEventFocus.cpp @@ -30,8 +30,8 @@ NS_CC_BEGIN EventFocus::EventFocus(ui::Widget *widgetLoseFocus, ui::Widget* widgetGetFocus) :Event(Type::FOCUS), -_widgetLoseFocus(widgetLoseFocus), -_widgetGetFocus(widgetGetFocus) +_widgetGetFocus(widgetGetFocus), +_widgetLoseFocus(widgetLoseFocus) { } diff --git a/cocos/editor-support/cocosbuilder/CCBKeyframe.cpp b/cocos/editor-support/cocosbuilder/CCBKeyframe.cpp index ef0ffcdeea..bd4040bbde 100644 --- a/cocos/editor-support/cocosbuilder/CCBKeyframe.cpp +++ b/cocos/editor-support/cocosbuilder/CCBKeyframe.cpp @@ -5,10 +5,10 @@ using namespace cocos2d; namespace cocosbuilder { CCBKeyframe::CCBKeyframe() -: _time(0.0f) +: _object(nullptr) +, _time(0.0f) , _easingType(EasingType::INSTANT) , _easingOpt(0.0f) -, _object(nullptr) {} CCBKeyframe::~CCBKeyframe() diff --git a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp index 00b8dce09f..757df9e31a 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/WidgetReader.cpp @@ -69,12 +69,12 @@ namespace cocostudio WidgetReader::WidgetReader() :_sizePercentX(0.0f), _sizePercentY(0.0f), - _isAdaptScreen(false), - _width(0.0f), - _height(0.0f), _positionPercentX(0.0f), _positionPercentY(0.0f), - _opacity(255) + _width(0.0f), + _height(0.0f), + _opacity(255), + _isAdaptScreen(false) { valueToInt = [=](const std::string& str) -> int{ return atoi(str.c_str()); diff --git a/cocos/network/WebSocket.cpp b/cocos/network/WebSocket.cpp index 934b1e0c6a..ec35a1309e 100644 --- a/cocos/network/WebSocket.cpp +++ b/cocos/network/WebSocket.cpp @@ -222,15 +222,15 @@ enum WS_MSG { WebSocket::WebSocket() : _readyState(State::CONNECTING) , _port(80) +, _pendingFrameDataLen(0) +, _currentDataLen(0) +, _currentData(nullptr) , _wsHelper(nullptr) , _wsInstance(nullptr) , _wsContext(nullptr) , _delegate(nullptr) , _SSLConnection(0) , _wsProtocols(nullptr) -, _pendingFrameDataLen(0) -, _currentDataLen(0) -, _currentData(nullptr) { } diff --git a/cocos/renderer/CCGLProgramState.cpp b/cocos/renderer/CCGLProgramState.cpp index 7025992f61..2006e72a9d 100644 --- a/cocos/renderer/CCGLProgramState.cpp +++ b/cocos/renderer/CCGLProgramState.cpp @@ -48,16 +48,16 @@ NS_CC_BEGIN // UniformValue::UniformValue() -: _useCallback(false) -, _uniform(nullptr) +: _uniform(nullptr) , _glprogram(nullptr) +, _useCallback(false) { } UniformValue::UniformValue(Uniform *uniform, GLProgram* glprogram) -: _useCallback(false) -, _uniform(uniform) +: _uniform(uniform) , _glprogram(glprogram) +, _useCallback(false) { } @@ -182,15 +182,15 @@ void UniformValue::setMat4(const Mat4& value) // VertexAttribValue::VertexAttribValue() -: _useCallback(false) -, _vertexAttrib(nullptr) +: _vertexAttrib(nullptr) +, _useCallback(false) , _enabled(false) { } VertexAttribValue::VertexAttribValue(VertexAttrib *vertexAttrib) -: _useCallback(false) -, _vertexAttrib(vertexAttrib) +: _vertexAttrib(vertexAttrib) +, _useCallback(false) , _enabled(false) { } @@ -274,10 +274,10 @@ GLProgramState* GLProgramState::getOrCreateWithGLProgram(GLProgram *glprogram) } GLProgramState::GLProgramState() -: _vertexAttribsFlags(0) -, _glprogram(nullptr) +: _uniformAttributeValueDirty(true) , _textureUnitIndex(1) -, _uniformAttributeValueDirty(true) +, _vertexAttribsFlags(0) +, _glprogram(nullptr) { #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8) /** listen the event that renderer was recreated on Android/WP8 */ diff --git a/cocos/renderer/CCMeshCommand.cpp b/cocos/renderer/CCMeshCommand.cpp index 74f8b6b9bd..96d43291cc 100644 --- a/cocos/renderer/CCMeshCommand.cpp +++ b/cocos/renderer/CCMeshCommand.cpp @@ -78,17 +78,17 @@ static const char *s_ambientLightUniformColorName = "u_AmbientLightSour MeshCommand::MeshCommand() : _textureID(0) -, _blendType(BlendFunc::DISABLE) , _glProgramState(nullptr) -, _cullFaceEnabled(false) -, _cullFace(GL_BACK) -, _depthTestEnabled(false) -, _depthWriteEnabled(false) +, _blendType(BlendFunc::DISABLE) , _displayColor(1.0f, 1.0f, 1.0f, 1.0f) , _matrixPalette(nullptr) , _matrixPaletteSize(0) , _materialID(0) , _vao(0) +, _cullFaceEnabled(false) +, _cullFace(GL_BACK) +, _depthTestEnabled(false) +, _depthWriteEnabled(false) , _lightMask(-1) { _type = RenderCommand::Type::MESH_COMMAND; diff --git a/cocos/renderer/CCVertexIndexBuffer.cpp b/cocos/renderer/CCVertexIndexBuffer.cpp index ff8285078e..c387398f38 100644 --- a/cocos/renderer/CCVertexIndexBuffer.cpp +++ b/cocos/renderer/CCVertexIndexBuffer.cpp @@ -56,10 +56,10 @@ VertexBuffer* VertexBuffer::create(int sizePerVertex, int vertexNumber) } VertexBuffer::VertexBuffer() -: _vbo(0) -, _vertexNumber(0) +: _recreateVBOEventListener(nullptr) +, _vbo(0) , _sizePerVertex(0) -, _recreateVBOEventListener(nullptr) +, _vertexNumber(0) { #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) diff --git a/cocos/renderer/CCVertexIndexData.h b/cocos/renderer/CCVertexIndexData.h index 300e1d9feb..78499c5cd3 100644 --- a/cocos/renderer/CCVertexIndexData.h +++ b/cocos/renderer/CCVertexIndexData.h @@ -35,17 +35,17 @@ class VertexBuffer; struct CC_DLL VertexStreamAttribute { VertexStreamAttribute() - : _offset(0),_semantic(0),_type(0),_size(0), _normalize(false) + : _normalize(false),_offset(0),_semantic(0),_type(0),_size(0) { } VertexStreamAttribute(int offset, int semantic, int type, int size) - : _offset(offset),_semantic(semantic),_type(type),_size(size), _normalize(false) + : _normalize(false),_offset(offset),_semantic(semantic),_type(type),_size(size) { } VertexStreamAttribute(int offset, int semantic, int type, int size, bool normalize) - : _offset(offset),_semantic(semantic),_type(type),_size(size), _normalize(normalize) + : _normalize(normalize),_offset(offset),_semantic(semantic),_type(type),_size(size) { } diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index a5c66f1802..b27d746735 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -46,6 +46,7 @@ _buttonNormalRenderer(nullptr), _buttonClickedRenderer(nullptr), _buttonDisableRenderer(nullptr), _titleRenderer(nullptr), +_zoomScale(0.1f), _normalFileName(""), _clickedFileName(""), _disabledFileName(""), @@ -65,7 +66,6 @@ _normalTextureScaleXInSize(1.0f), _normalTextureScaleYInSize(1.0f), _pressedTextureScaleXInSize(1.0f), _pressedTextureScaleYInSize(1.0f), -_zoomScale(0.1f), _normalTextureLoaded(false), _pressedTextureLoaded(false), _disabledTextureLoaded(false), diff --git a/cocos/ui/UIEditBox/UIEditBox.cpp b/cocos/ui/UIEditBox/UIEditBox.cpp index 85fb8145a2..73a504930d 100644 --- a/cocos/ui/UIEditBox/UIEditBox.cpp +++ b/cocos/ui/UIEditBox/UIEditBox.cpp @@ -38,13 +38,13 @@ EditBox::EditBox(void) , _editBoxInputMode(EditBox::InputMode::SINGLE_LINE) , _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS) , _keyboardReturnType(KeyboardReturnType::DEFAULT) +, _backgroundSprite(nullptr) , _fontSize(-1) , _placeholderFontSize(-1) , _colText(Color3B::WHITE) , _colPlaceHolder(Color3B::GRAY) , _maxLength(0) , _adjustHeight(0.0f) -, _backgroundSprite(nullptr) #if CC_ENABLE_SCRIPT_BINDING , _scriptEditBoxHandler(0) #endif diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index 1a1e9b66ac..9b75316cbf 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -51,13 +51,15 @@ static GLint s_layer = -1; IMPLEMENT_CLASS_GUI_INFO(Layout) Layout::Layout(): -_clippingEnabled(false), _backGroundScale9Enabled(false), _backGroundImage(nullptr), _backGroundImageFileName(""), _backGroundImageCapInsets(Rect::ZERO), _colorType(BackGroundColorType::NONE), _bgImageTexType(TextureResType::LOCAL), +_backGroundImageTextureSize(Size::ZERO), +_backGroundImageColor(Color3B::WHITE), +_backGroundImageOpacity(255), _colorRender(nullptr), _gradientRender(nullptr), _cColor(Color3B::WHITE), @@ -65,14 +67,13 @@ _gStartColor(Color3B::WHITE), _gEndColor(Color3B::WHITE), _alongVector(Vec2(0.0f, -1.0f)), _cOpacity(255), -_backGroundImageTextureSize(Size::ZERO), +_clippingEnabled(false), _layoutType(Type::ABSOLUTE), _clippingType(ClippingType::STENCIL), _clippingStencil(nullptr), _scissorRectDirty(false), _clippingRect(Rect::ZERO), _clippingParent(nullptr), -_doLayoutDirty(true), _clippingRectDirty(true), _currentStencilEnabled(GL_FALSE), _currentStencilWriteMask(~0), @@ -86,12 +87,11 @@ _currentDepthWriteMask(GL_TRUE), _currentAlphaTestEnabled(GL_FALSE), _currentAlphaTestFunc(GL_ALWAYS), _currentAlphaTestRef(1), -_backGroundImageColor(Color3B::WHITE), -_backGroundImageOpacity(255), -_passFocusToChild(true), +_doLayoutDirty(true), +_isInterceptTouch(false), _loopFocus(false), -_isFocusPassing(false), -_isInterceptTouch(false) +_passFocusToChild(true), +_isFocusPassing(false) { //no-op } diff --git a/cocos/ui/UILayoutComponent.cpp b/cocos/ui/UILayoutComponent.cpp index 19c7401d16..64f6f39beb 100644 --- a/cocos/ui/UILayoutComponent.cpp +++ b/cocos/ui/UILayoutComponent.cpp @@ -31,10 +31,10 @@ NS_CC_BEGIN namespace ui { LayoutComponent::LayoutComponent() - :_actived(true) - ,_usingPercentContentSize(false) - ,_usingPercentPosition(false) - ,_referencePoint(ReferencePoint::BOTTOM_LEFT) + : _usingPercentContentSize(false) + , _referencePoint(ReferencePoint::BOTTOM_LEFT) + , _usingPercentPosition(false) + , _actived(true) { _name = __LAYOUT_COMPONENT_NAME; } diff --git a/cocos/ui/UIListView.cpp b/cocos/ui/UIListView.cpp index 2f05a2f6d0..0b8615eafc 100644 --- a/cocos/ui/UIListView.cpp +++ b/cocos/ui/UIListView.cpp @@ -35,10 +35,10 @@ ListView::ListView(): _model(nullptr), _gravity(Gravity::CENTER_VERTICAL), _itemsMargin(0.0f), -_listViewEventListener(nullptr), -_listViewEventSelector(nullptr), _curSelectedIndex(0), _refreshViewDirty(true), +_listViewEventListener(nullptr), +_listViewEventSelector(nullptr), _eventCallback(nullptr) { this->setTouchEnabled(true); diff --git a/cocos/ui/UIPageView.cpp b/cocos/ui/UIPageView.cpp index 11485d11ff..976854d302 100644 --- a/cocos/ui/UIPageView.cpp +++ b/cocos/ui/UIPageView.cpp @@ -31,22 +31,22 @@ namespace ui { IMPLEMENT_CLASS_GUI_INFO(PageView) PageView::PageView(): +_isAutoScrolling(false), +_autoScrollDistance(0.0f), +_autoScrollSpeed(0.0f), +_autoScrollDirection(AutoScrollDirection::LEFT), _curPageIdx(0), _touchMoveDirection(TouchDirection::LEFT), _leftBoundaryChild(nullptr), _rightBoundaryChild(nullptr), _leftBoundary(0.0f), _rightBoundary(0.0f), -_isAutoScrolling(false), -_autoScrollDistance(0.0f), -_autoScrollSpeed(0.0f), -_autoScrollDirection(AutoScrollDirection::LEFT), +_customScrollThreshold(0.0), +_usingCustomScrollThreshold(false), _childFocusCancelOffset(5.0f), _pageViewEventListener(nullptr), _pageViewEventSelector(nullptr), -_eventCallback(nullptr), -_customScrollThreshold(0.0), -_usingCustomScrollThreshold(false) +_eventCallback(nullptr) { this->setTouchEnabled(true); } diff --git a/cocos/ui/UIScale9Sprite.cpp b/cocos/ui/UIScale9Sprite.cpp index 26ad2c0dad..1882f907d1 100644 --- a/cocos/ui/UIScale9Sprite.cpp +++ b/cocos/ui/UIScale9Sprite.cpp @@ -45,11 +45,11 @@ namespace ui { , _bottomLeft(nullptr) , _bottom(nullptr) , _bottomRight(nullptr) + , _scale9Enabled(true) , _insetLeft(0) , _insetTop(0) , _insetRight(0) , _insetBottom(0) - , _scale9Enabled(true) { this->setAnchorPoint(Vec2(0.5,0.5)); } diff --git a/cocos/ui/UISlider.cpp b/cocos/ui/UISlider.cpp index a71fe22220..921e462e31 100644 --- a/cocos/ui/UISlider.cpp +++ b/cocos/ui/UISlider.cpp @@ -57,14 +57,14 @@ _capInsetsBarRenderer(Rect::ZERO), _capInsetsProgressBarRenderer(Rect::ZERO), _sliderEventListener(nullptr), _sliderEventSelector(nullptr), +_eventCallback(nullptr), _barTexType(TextureResType::LOCAL), _progressBarTexType(TextureResType::LOCAL), _ballNTexType(TextureResType::LOCAL), _ballPTexType(TextureResType::LOCAL), _ballDTexType(TextureResType::LOCAL), _barRendererAdaptDirty(true), -_progressBarRendererDirty(true), -_eventCallback(nullptr) +_progressBarRendererDirty(true) { setTouchEnabled(true); } diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index 024e9b53a8..1ef01292f9 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -141,28 +141,28 @@ _enabled(true), _bright(true), _touchEnabled(false), _highlight(false), +_affectByClipping(false), +_ignoreSize(false), +_propagateTouchEvents(true), _brightStyle(BrightStyle::NONE), -_touchBeganPosition(Vec2::ZERO), -_touchMovePosition(Vec2::ZERO), -_touchEndPosition(Vec2::ZERO), -_touchEventListener(nullptr), -_touchEventSelector(nullptr), +_sizeType(SizeType::ABSOLUTE), +_positionType(PositionType::ABSOLUTE), _actionTag(0), _customSize(Size::ZERO), -_ignoreSize(false), -_affectByClipping(false), -_sizeType(SizeType::ABSOLUTE), _sizePercent(Vec2::ZERO), -_positionType(PositionType::ABSOLUTE), _positionPercent(Vec2::ZERO), _hitted(false), _touchListener(nullptr), +_touchBeganPosition(Vec2::ZERO), +_touchMovePosition(Vec2::ZERO), +_touchEndPosition(Vec2::ZERO), _flippedX(false), _flippedY(false), +_layoutParameterType(LayoutParameter::Type::NONE), _focused(false), _focusEnabled(true), -_layoutParameterType(LayoutParameter::Type::NONE), -_propagateTouchEvents(true) +_touchEventListener(nullptr), +_touchEventSelector(nullptr) { } diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index c9d2f19669..da76d278b4 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -62,8 +62,8 @@ ScrollView::ScrollView() , _touchLength(0.0f) , _minScale(0.0f) , _maxScale(0.0f) -, _touchListener(nullptr) , _scissorRestored(false) +, _touchListener(nullptr) { } diff --git a/extensions/assets-manager/AssetsManagerEx.cpp b/extensions/assets-manager/AssetsManagerEx.cpp index 3011e81bda..f7557c2888 100644 --- a/extensions/assets-manager/AssetsManagerEx.cpp +++ b/extensions/assets-manager/AssetsManagerEx.cpp @@ -50,20 +50,20 @@ const std::string AssetsManagerEx::BATCH_UPDATE_ID = "@batch_update"; AssetsManagerEx::AssetsManagerEx(const std::string& manifestUrl, const std::string& storagePath) : _updateState(State::UNCHECKED) -, _waitToUpdate(false) -, _totalToDownload(0) -, _totalWaitToDownload(0) -, _percent(0) -, _percentByFile(0) -, _manifestUrl(manifestUrl) +, _assets(nullptr) , _storagePath("") , _cacheVersionPath("") , _cacheManifestPath("") , _tempManifestPath("") -, _assets(nullptr) +, _manifestUrl(manifestUrl) , _localManifest(nullptr) , _tempManifest(nullptr) , _remoteManifest(nullptr) +, _waitToUpdate(false) +, _percent(0) +, _percentByFile(0) +, _totalToDownload(0) +, _totalWaitToDownload(0) { // Init variables _eventDispatcher = Director::getInstance()->getEventDispatcher(); diff --git a/extensions/assets-manager/CCEventAssetsManagerEx.cpp b/extensions/assets-manager/CCEventAssetsManagerEx.cpp index ba2c0f8d2f..7eea7d1300 100644 --- a/extensions/assets-manager/CCEventAssetsManagerEx.cpp +++ b/extensions/assets-manager/CCEventAssetsManagerEx.cpp @@ -31,14 +31,14 @@ NS_CC_EXT_BEGIN EventAssetsManagerEx::EventAssetsManagerEx(const std::string& eventName, cocos2d::extension::AssetsManagerEx *manager, const EventCode &code, float percent/* = 0 */, float percentByFile/* = 0*/, const std::string& assetId/* = "" */, const std::string& message/* = "" */, int curle_code/* = CURLE_OK*/, int curlm_code/* = CURLM_OK*/) : EventCustom(eventName) -, _manager(manager) , _code(code) +, _manager(manager) +, _message(message) +, _assetId(assetId) , _curle_code(curle_code) , _curlm_code(curlm_code) , _percent(percent) , _percentByFile(percentByFile) -, _assetId(assetId) -, _message(message) { } diff --git a/extensions/assets-manager/Downloader.cpp b/extensions/assets-manager/Downloader.cpp index 7e8ef08c4a..21a7eb463b 100644 --- a/extensions/assets-manager/Downloader.cpp +++ b/extensions/assets-manager/Downloader.cpp @@ -145,10 +145,10 @@ int downloadProgressFunc(Downloader::ProgressData *ptr, double totalToDownload, } Downloader::Downloader() -: _onError(nullptr) +: _connectionTimeout(DEFAULT_TIMEOUT) +, _onError(nullptr) , _onProgress(nullptr) , _onSuccess(nullptr) -, _connectionTimeout(DEFAULT_TIMEOUT) , _supportResuming(false) { _fileUtils = FileUtils::getInstance();