From 63772f7d72fe6d46663f742da5536446fee8ceee Mon Sep 17 00:00:00 2001 From: pandamicro Date: Wed, 26 Mar 2014 18:45:08 +0800 Subject: [PATCH] Fixed #4566: Constructor added for LayerGradient --- cocos/2d/CCLayer.cpp | 21 +++++++++++++++++---- cocos/2d/CCLayer.h | 4 ++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/cocos/2d/CCLayer.cpp b/cocos/2d/CCLayer.cpp index feb6c9c12e..71b8bea558 100644 --- a/cocos/2d/CCLayer.cpp +++ b/cocos/2d/CCLayer.cpp @@ -629,7 +629,20 @@ std::string LayerColor::getDescription() const } // // LayerGradient -// +// +LayerGradient::LayerGradient() +: _startColor(Color4B(0, 0, 0, 255)) +, _endColor(Color4B(0, 0, 0, 255)) +, _startOpacity(255) +, _endOpacity(255) +, _alongVector(Point(0, -1)) +, _compressedInterpolation(true) +{ + +} +LayerGradient::~LayerGradient() { + +} LayerGradient* LayerGradient::create(const Color4B& start, const Color4B& end) { LayerGradient * layer = new LayerGradient(); @@ -684,9 +697,9 @@ bool LayerGradient::initWithColor(const Color4B& start, const Color4B& end, cons _endColor.g = end.g; _endColor.b = end.b; - _endOpacity = end.a; - _startOpacity = start.a; - _alongVector = v; + _endOpacity = end.a; + _startOpacity = start.a; + _alongVector = v; _compressedInterpolation = true; diff --git a/cocos/2d/CCLayer.h b/cocos/2d/CCLayer.h index b1f96f5c78..32f0d702a4 100644 --- a/cocos/2d/CCLayer.h +++ b/cocos/2d/CCLayer.h @@ -391,6 +391,10 @@ public: const Point& getVector() const; virtual std::string getDescription() const override; + +CC_CONSTRUCTOR_ACCESS: + LayerGradient(); + virtual ~LayerGradient(); protected: virtual void updateColor() override;