mirror of https://github.com/axmolengine/axmol.git
Fixed #5533: Add SpriteFrame's constructor and make constructor & init functions protected
This commit is contained in:
parent
0ca9a98f4a
commit
bb7cf801e6
|
@ -69,6 +69,13 @@ SpriteFrame* SpriteFrame::create(const std::string& filename, const Rect& rect,
|
|||
return spriteFrame;
|
||||
}
|
||||
|
||||
SpriteFrame::SpriteFrame(void)
|
||||
: _rotated(false)
|
||||
, _texture(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool SpriteFrame::initWithTexture(Texture2D* texture, const Rect& rect)
|
||||
{
|
||||
Rect rectInPixels = CC_RECT_POINTS_TO_PIXELS(rect);
|
||||
|
|
|
@ -75,34 +75,6 @@ public:
|
|||
The originalSize is the size in points of the frame before being trimmed.
|
||||
*/
|
||||
static SpriteFrame* createWithTexture(Texture2D* pobTexture, const Rect& rect, bool rotated, const Vec2& offset, const Size& originalSize);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~SpriteFrame(void);
|
||||
|
||||
/** Initializes a SpriteFrame with a texture, rect in points.
|
||||
It is assumed that the frame was not trimmed.
|
||||
*/
|
||||
bool initWithTexture(Texture2D* pobTexture, const Rect& rect);
|
||||
|
||||
/** Initializes a SpriteFrame with a texture filename, rect in points;
|
||||
It is assumed that the frame was not trimmed.
|
||||
*/
|
||||
bool initWithTextureFilename(const std::string& filename, const Rect& rect);
|
||||
|
||||
/** Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
|
||||
The originalSize is the size in points of the frame before being trimmed.
|
||||
*/
|
||||
bool initWithTexture(Texture2D* pobTexture, const Rect& rect, bool rotated, const Vec2& offset, const Size& originalSize);
|
||||
|
||||
/** Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
|
||||
The originalSize is the size in pixels of the frame before being trimmed.
|
||||
|
||||
@since v1.1
|
||||
*/
|
||||
bool initWithTextureFilename(const std::string& filename, const Rect& rect, bool rotated, const Vec2& offset, const Size& originalSize);
|
||||
|
||||
|
||||
// attributes
|
||||
inline const Rect& getRectInPixels() const { return _rectInPixels; }
|
||||
|
@ -141,6 +113,39 @@ public:
|
|||
|
||||
// Overrides
|
||||
virtual SpriteFrame *clone() const override;
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
/**
|
||||
* @lua NA
|
||||
*/
|
||||
SpriteFrame(void);
|
||||
|
||||
/**
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~SpriteFrame(void);
|
||||
|
||||
/** Initializes a SpriteFrame with a texture, rect in points.
|
||||
It is assumed that the frame was not trimmed.
|
||||
*/
|
||||
bool initWithTexture(Texture2D* pobTexture, const Rect& rect);
|
||||
|
||||
/** Initializes a SpriteFrame with a texture filename, rect in points;
|
||||
It is assumed that the frame was not trimmed.
|
||||
*/
|
||||
bool initWithTextureFilename(const std::string& filename, const Rect& rect);
|
||||
|
||||
/** Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
|
||||
The originalSize is the size in points of the frame before being trimmed.
|
||||
*/
|
||||
bool initWithTexture(Texture2D* pobTexture, const Rect& rect, bool rotated, const Vec2& offset, const Size& originalSize);
|
||||
|
||||
/** Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels.
|
||||
The originalSize is the size in pixels of the frame before being trimmed.
|
||||
|
||||
@since v1.1
|
||||
*/
|
||||
bool initWithTextureFilename(const std::string& filename, const Rect& rect, bool rotated, const Vec2& offset, const Size& originalSize);
|
||||
|
||||
protected:
|
||||
Vec2 _offset;
|
||||
|
|
Loading…
Reference in New Issue