Fixed #4566: Constructor added for LayerGradient

This commit is contained in:
pandamicro 2014-03-26 18:45:08 +08:00
parent 54e43a9da5
commit 63772f7d72
2 changed files with 21 additions and 4 deletions

View File

@ -629,7 +629,20 @@ std::string LayerColor::getDescription() const
} }
// //
// LayerGradient // 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* LayerGradient::create(const Color4B& start, const Color4B& end)
{ {
LayerGradient * layer = new LayerGradient(); LayerGradient * layer = new LayerGradient();
@ -684,9 +697,9 @@ bool LayerGradient::initWithColor(const Color4B& start, const Color4B& end, cons
_endColor.g = end.g; _endColor.g = end.g;
_endColor.b = end.b; _endColor.b = end.b;
_endOpacity = end.a; _endOpacity = end.a;
_startOpacity = start.a; _startOpacity = start.a;
_alongVector = v; _alongVector = v;
_compressedInterpolation = true; _compressedInterpolation = true;

View File

@ -391,6 +391,10 @@ public:
const Point& getVector() const; const Point& getVector() const;
virtual std::string getDescription() const override; virtual std::string getDescription() const override;
CC_CONSTRUCTOR_ACCESS:
LayerGradient();
virtual ~LayerGradient();
protected: protected:
virtual void updateColor() override; virtual void updateColor() override;