A SpriteFrame has: More...
Public Member Functions | |
const Rect & | getRectInPixels () const |
Get rect of the sprite frame. More... | |
void | setRectInPixels (const Rect &rectInPixels) |
Set rect of the sprite frame. More... | |
var | setRectInPixels ( var rectInPixels) |
Set rect of the sprite frame. More... | |
local | setRectInPixels ( local rectInPixels) |
Set rect of the sprite frame. More... | |
bool | isRotated () const |
Is the sprite frame rotated or not. More... | |
void | setRotated (bool rotated) |
Set rotated of the sprite frame. More... | |
var | setRotated ( var rotated) |
Set rotated of the sprite frame. More... | |
local | setRotated ( local rotated) |
Set rotated of the sprite frame. More... | |
const Rect & | getRect () const |
Get rect of the frame. More... | |
var | getRect () |
Get rect of the frame. More... | |
local | getRect () |
Get rect of the frame. More... | |
void | setRect (const Rect &rect) |
Set rect of the frame. More... | |
var | setRect ( var rect) |
Set rect of the frame. More... | |
local | setRect ( local rect) |
Set rect of the frame. More... | |
const Rect & | getCenterRect () const |
Get center rect of the frame. More... | |
void | setCenterRectInPixels (const Rect ¢erRect) |
setCenterRect More... | |
var | setCenterRectInPixels ( var centerRect) |
setCenterRect More... | |
local | setCenterRectInPixels ( local centerRect) |
setCenterRect More... | |
bool | hasCenterRect () const |
hasCenterRect More... | |
const Vec2 & | getOffsetInPixels () const |
Get offset of the frame. More... | |
local | getOffsetInPixels () |
Get offset of the frame. More... | |
void | setOffsetInPixels (const Vec2 &offsetInPixels) |
Set offset of the frame. More... | |
const Size & | getOriginalSizeInPixels () const |
Get original size of the trimmed image. More... | |
void | setOriginalSizeInPixels (const Size &sizeInPixels) |
Set original size of the trimmed image. More... | |
const Size & | getOriginalSize () const |
Get original size of the trimmed image. More... | |
void | setOriginalSize (const Size &sizeInPixels) |
Set original size of the trimmed image. More... | |
var | setOriginalSize ( var sizeInPixels) |
Set original size of the trimmed image. More... | |
local | setOriginalSize ( local sizeInPixels) |
Set original size of the trimmed image. More... | |
Texture2D * | getTexture () |
Get texture of the frame. More... | |
void | setTexture (Texture2D *pobTexture) |
Set texture of the frame, the texture is retained. More... | |
var | setTexture ( var pobTexture) |
Set texture of the frame, the texture is retained. More... | |
local | setTexture ( local pobTexture) |
Set texture of the frame, the texture is retained. More... | |
const Vec2 & | getOffset () const |
Get offset of the frame. More... | |
var | getOffset () |
Get offset of the frame. More... | |
local | getOffset () |
Get offset of the frame. More... | |
void | setOffset (const Vec2 &offsets) |
Set offset of the frame. More... | |
var | setOffset ( var offsets) |
Set offset of the frame. More... | |
local | setOffset ( local offsets) |
Set offset of the frame. More... | |
const Vec2 & | getAnchorPoint () const |
Get anchor point of the frame. More... | |
void | setAnchorPoint (const Vec2 &anchorPoint) |
Set anchor point of the frame. More... | |
var | setAnchorPoint ( var anchorPoint) |
Set anchor point of the frame. More... | |
local | setAnchorPoint ( local anchorPoint) |
Set anchor point of the frame. More... | |
bool | hasAnchorPoint () const |
Check if anchor point is defined for the frame. More... | |
local | hasAnchorPoint () |
Check if anchor point is defined for the frame. More... | |
virtual SpriteFrame * | clone () const override |
Returns a copy of the Ref. More... | |
void | setPolygonInfo (const PolygonInfo &polygonInfo) |
Set the polygon info for polygon mesh sprites. More... | |
var | setPolygonInfo ( var polygonInfo) |
Set the polygon info for polygon mesh sprites. More... | |
local | setPolygonInfo ( local polygonInfo) |
Set the polygon info for polygon mesh sprites. More... | |
const PolygonInfo & | getPolygonInfo () const |
Get the polygonInfo for this sprite. More... | |
local | getPolygonInfo () |
Get the polygonInfo for this sprite. More... | |
bool | hasPolygonInfo () const |
Check if sprite frame is a polygon sprite. More... | |
var | hasPolygonInfo () |
Check if sprite frame is a polygon sprite. More... | |
local | hasPolygonInfo () |
Check if sprite frame is a polygon sprite. More... | |
Public Member Functions inherited from Ref | |
void | retain () |
Retains the ownership. More... | |
void | release () |
Releases the ownership immediately. More... | |
local | release () |
Releases the ownership immediately. More... | |
Ref * | autorelease () |
Releases the ownership sometime soon automatically. More... | |
unsigned int | getReferenceCount () const |
Returns the Ref's current reference count. More... | |
local | getReferenceCount () |
Returns the Ref's current reference count. More... | |
virtual | ~Ref () |
Destructor. More... | |
Public Member Functions inherited from Clonable | |
Ref * | copy () const |
Returns a copy of the Ref. More... | |
Static Public Member Functions | |
static SpriteFrame * | create (const std::string &filename, const Rect &rect) |
Create a SpriteFrame with a texture filename, rect in points. More... | |
var | create ( var filename, var rect) |
Create a SpriteFrame with a texture filename, rect in points. More... | |
local | create ( local filename, local rect) |
Create a SpriteFrame with a texture filename, rect in points. More... | |
static SpriteFrame * | create (const std::string &filename, const Rect &rect, bool rotated, const Vec2 &offset, const Size &originalSize) |
Create a SpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels. More... | |
local | create ( local filename, local rect, local rotated, local offset, local originalSize) |
Create a SpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels. More... | |
static SpriteFrame * | createWithTexture (Texture2D *pobTexture, const Rect &rect) |
Create a SpriteFrame with a texture, rect in points. More... | |
local | createWithTexture ( local pobTexture, local rect) |
Create a SpriteFrame with a texture, rect in points. More... | |
static SpriteFrame * | createWithTexture (Texture2D *pobTexture, const Rect &rect, bool rotated, const Vec2 &offset, const Size &originalSize) |
Create a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. More... | |
var | createWithTexture ( var pobTexture, var rect, var rotated, var offset, var originalSize) |
Create a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. More... | |
local | createWithTexture ( local pobTexture, local rect, local rotated, local offset, local originalSize) |
Create a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. More... | |
Protected Member Functions | |
bool | initWithTexture (Texture2D *pobTexture, const Rect &rect) |
Initializes a SpriteFrame with a texture, rect in points. More... | |
var | initWithTexture ( var pobTexture, var rect) |
Initializes a SpriteFrame with a texture, rect in points. More... | |
local | initWithTexture ( local pobTexture, local rect) |
Initializes a SpriteFrame with a texture, rect in points. More... | |
bool | initWithTextureFilename (const std::string &filename, const Rect &rect) |
Initializes a SpriteFrame with a texture filename, rect in points; It is assumed that the frame was not 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. More... | |
var | initWithTexture ( var pobTexture, var rect, var rotated, var offset, var originalSize) |
Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. More... | |
local | initWithTexture ( local pobTexture, local rect, local rotated, local offset, local originalSize) |
Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. More... | |
bool | initWithTextureFilename (const std::string &filename, const Rect &rect, bool rotated, const Vec2 &offset, const Size &originalSize) |
Initializes a SpriteFrame with a texture, rect, rotated, offset and originalSize in pixels. More... | |
Additional Inherited Members | |
Public Attributes inherited from Ref | |
unsigned int | _ID |
object id, ScriptSupport need public _ID | |
local | _ID |
object id, ScriptSupport need public _ID | |
int | _luaID |
Lua reference id. | |
local | _luaID |
Lua reference id. | |
void * | _scriptObject |
scriptObject, support for swift | |
local | _scriptObject |
scriptObject, support for swift | |
bool | _rooted |
When true, it means that the object was already rooted. | |
local | _rooted |
When true, it means that the object was already rooted. | |
A SpriteFrame has:
You can modify the frame of a Sprite by doing:
|
static |
Create a SpriteFrame with a texture filename, rect in points.
It is assumed that the frame was not trimmed.
filename | Texture file name. |
rect | A specified rect. |
|
static |
Create a SpriteFrame with a texture filename, rect in points.
It is assumed that the frame was not trimmed.
filename | Texture file name. |
rect | A specified rect. |
|
static |
Create a SpriteFrame with a texture filename, rect in points.
It is assumed that the frame was not trimmed.
filename | Texture file name. |
rect | A specified rect. |
|
static |
Create a SpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in pixels of the frame before being trimmed.
filename | Texture filename |
rect | A specified rect. |
rotated | Is rotated if true. |
offset | A specified offset. |
originalSize | A specified original size. |
|
static |
Create a SpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in pixels of the frame before being trimmed.
filename | Texture filename |
rect | A specified rect. |
rotated | Is rotated if true. |
offset | A specified offset. |
originalSize | A specified original size. |
|
static |
Create a SpriteFrame with a texture filename, rect, rotated, offset and originalSize in pixels.
The originalSize is the size in pixels of the frame before being trimmed.
filename | Texture filename |
rect | A specified rect. |
rotated | Is rotated if true. |
offset | A specified offset. |
originalSize | A specified original size. |
|
static |
Create a SpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
pobTexture | The texture pointer. |
rect | A specified rect. |
|
static |
Create a SpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
pobTexture | The texture pointer. |
rect | A specified rect. |
|
static |
Create a SpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
pobTexture | The texture pointer. |
rect | A specified rect. |
|
static |
Create 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.
pobTexture | The texture pointer. |
rect | A specified rect. |
rotated | Is rotated if true. |
offset | A specified offset. |
originalSize | A specified original size. |
|
static |
Create 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.
pobTexture | The texture pointer. |
rect | A specified rect. |
rotated | Is rotated if true. |
offset | A specified offset. |
originalSize | A specified original size. |
|
static |
Create 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.
pobTexture | The texture pointer. |
rect | A specified rect. |
rotated | Is rotated if true. |
offset | A specified offset. |
originalSize | A specified original size. |
|
inline |
Get rect of the sprite frame.
|
inline |
Get rect of the sprite frame.
|
inline |
Get rect of the sprite frame.
void setRectInPixels | ( | const Rect & | rectInPixels | ) |
Set rect of the sprite frame.
rectInPixels | The rect of the sprite frame, in pixels. |
var setRectInPixels | ( | var | rectInPixels | ) |
Set rect of the sprite frame.
rectInPixels | The rect of the sprite frame, in pixels. |
local setRectInPixels | ( | local | rectInPixels | ) |
Set rect of the sprite frame.
rectInPixels | The rect of the sprite frame, in pixels. |
|
inline |
Is the sprite frame rotated or not.
|
inline |
Is the sprite frame rotated or not.
|
inline |
Is the sprite frame rotated or not.
|
inline |
Set rotated of the sprite frame.
rotated | Rotated the sprite frame if true. |
|
inline |
Set rotated of the sprite frame.
rotated | Rotated the sprite frame if true. |
|
inline |
Set rotated of the sprite frame.
rotated | Rotated the sprite frame if true. |
|
inline |
Get rect of the frame.
|
inline |
Get rect of the frame.
|
inline |
Get rect of the frame.
void setRect | ( | const Rect & | rect | ) |
Set rect of the frame.
rect | The rect of the sprite. |
var setRect | ( | var | rect | ) |
Set rect of the frame.
rect | The rect of the sprite. |
local setRect | ( | local | rect | ) |
Set rect of the frame.
rect | The rect of the sprite. |
|
inline |
Get center rect of the frame.
Useful to create 9-slice sprites
|
inline |
Get center rect of the frame.
Useful to create 9-slice sprites
|
inline |
Get center rect of the frame.
Useful to create 9-slice sprites
void setCenterRectInPixels | ( | const Rect & | centerRect | ) |
setCenterRect
Useful to implement "9 sliced" sprites. The sprite will be sliced into a 3 x 3 grid. The four corners of this grid are applied without performing any scaling. The upper- and lower-middle parts are scaled horizontally, and the left- and right-middle parts are scaled vertically. The center is scaled in both directions. Important: The scaling is based the Sprite's trimmed size.
Limitations: Does not work when the sprite is part of SpriteBatchNode
.
centerRect | the Rect in points |
var setCenterRectInPixels | ( | var | centerRect | ) |
setCenterRect
Useful to implement "9 sliced" sprites. The sprite will be sliced into a 3 x 3 grid. The four corners of this grid are applied without performing any scaling. The upper- and lower-middle parts are scaled horizontally, and the left- and right-middle parts are scaled vertically. The center is scaled in both directions. Important: The scaling is based the Sprite's trimmed size.
Limitations: Does not work when the sprite is part of SpriteBatchNode
.
centerRect | the Rect in points |
local setCenterRectInPixels | ( | local | centerRect | ) |
setCenterRect
Useful to implement "9 sliced" sprites. The sprite will be sliced into a 3 x 3 grid. The four corners of this grid are applied without performing any scaling. The upper- and lower-middle parts are scaled horizontally, and the left- and right-middle parts are scaled vertically. The center is scaled in both directions. Important: The scaling is based the Sprite's trimmed size.
Limitations: Does not work when the sprite is part of SpriteBatchNode
.
centerRect | the Rect in points |
bool hasCenterRect | ( | ) | const |
hasCenterRect
var hasCenterRect | ( | ) |
hasCenterRect
local hasCenterRect | ( | ) |
hasCenterRect
const Vec2& getOffsetInPixels | ( | ) | const |
Get offset of the frame.
var getOffsetInPixels | ( | ) |
Get offset of the frame.
local getOffsetInPixels | ( | ) |
Get offset of the frame.
void setOffsetInPixels | ( | const Vec2 & | offsetInPixels | ) |
Set offset of the frame.
offsetInPixels | The offset of the sprite frame, in pixels. |
var setOffsetInPixels | ( | var | offsetInPixels | ) |
Set offset of the frame.
offsetInPixels | The offset of the sprite frame, in pixels. |
local setOffsetInPixels | ( | local | offsetInPixels | ) |
Set offset of the frame.
offsetInPixels | The offset of the sprite frame, in pixels. |
|
inline |
Get original size of the trimmed image.
|
inline |
Get original size of the trimmed image.
|
inline |
Get original size of the trimmed image.
|
inline |
Set original size of the trimmed image.
sizeInPixels | The original size of the trimmed image, in pixels. |
|
inline |
Set original size of the trimmed image.
sizeInPixels | The original size of the trimmed image, in pixels. |
|
inline |
Set original size of the trimmed image.
sizeInPixels | The original size of the trimmed image, in pixels. |
|
inline |
Get original size of the trimmed image.
|
inline |
Get original size of the trimmed image.
|
inline |
Get original size of the trimmed image.
|
inline |
Set original size of the trimmed image.
sizeInPixels | The original size of the trimmed image. |
|
inline |
Set original size of the trimmed image.
sizeInPixels | The original size of the trimmed image. |
|
inline |
Set original size of the trimmed image.
sizeInPixels | The original size of the trimmed image. |
Texture2D* getTexture | ( | ) |
Get texture of the frame.
var getTexture | ( | ) |
Get texture of the frame.
local getTexture | ( | ) |
Get texture of the frame.
void setTexture | ( | Texture2D * | pobTexture | ) |
Set texture of the frame, the texture is retained.
pobTexture | The texture of the sprite frame. |
var setTexture | ( | var | pobTexture | ) |
Set texture of the frame, the texture is retained.
pobTexture | The texture of the sprite frame. |
local setTexture | ( | local | pobTexture | ) |
Set texture of the frame, the texture is retained.
pobTexture | The texture of the sprite frame. |
const Vec2& getOffset | ( | ) | const |
Get offset of the frame.
var getOffset | ( | ) |
Get offset of the frame.
local getOffset | ( | ) |
Get offset of the frame.
void setOffset | ( | const Vec2 & | offsets | ) |
Set offset of the frame.
offsets | The offset of the sprite frame. |
var setOffset | ( | var | offsets | ) |
Set offset of the frame.
offsets | The offset of the sprite frame. |
local setOffset | ( | local | offsets | ) |
Set offset of the frame.
offsets | The offset of the sprite frame. |
const Vec2& getAnchorPoint | ( | ) | const |
Get anchor point of the frame.
var getAnchorPoint | ( | ) |
Get anchor point of the frame.
local getAnchorPoint | ( | ) |
Get anchor point of the frame.
void setAnchorPoint | ( | const Vec2 & | anchorPoint | ) |
Set anchor point of the frame.
anchorPoint | The anchor point of the sprite frame. |
var setAnchorPoint | ( | var | anchorPoint | ) |
Set anchor point of the frame.
anchorPoint | The anchor point of the sprite frame. |
local setAnchorPoint | ( | local | anchorPoint | ) |
Set anchor point of the frame.
anchorPoint | The anchor point of the sprite frame. |
bool hasAnchorPoint | ( | ) | const |
Check if anchor point is defined for the frame.
var hasAnchorPoint | ( | ) |
Check if anchor point is defined for the frame.
local hasAnchorPoint | ( | ) |
Check if anchor point is defined for the frame.
|
overridevirtual |
void setPolygonInfo | ( | const PolygonInfo & | polygonInfo | ) |
Set the polygon info for polygon mesh sprites.
polygonInfo | triangle mesh of the sprite |
var setPolygonInfo | ( | var | polygonInfo | ) |
Set the polygon info for polygon mesh sprites.
polygonInfo | triangle mesh of the sprite |
local setPolygonInfo | ( | local | polygonInfo | ) |
Set the polygon info for polygon mesh sprites.
polygonInfo | triangle mesh of the sprite |
const PolygonInfo& getPolygonInfo | ( | ) | const |
Get the polygonInfo for this sprite.
var getPolygonInfo | ( | ) |
Get the polygonInfo for this sprite.
local getPolygonInfo | ( | ) |
Get the polygonInfo for this sprite.
bool hasPolygonInfo | ( | ) | const |
Check if sprite frame is a polygon sprite.
var hasPolygonInfo | ( | ) |
Check if sprite frame is a polygon sprite.
local hasPolygonInfo | ( | ) |
Check if sprite frame is a polygon sprite.
Initializes a SpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
|
protected |
Initializes a SpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
|
protected |
Initializes a SpriteFrame with a texture, rect in points.
It is assumed that the frame was not trimmed.
|
protected |
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.
|
protected |
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.
|
protected |
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.
|
protected |
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.
|
protected |
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.
|
protected |
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.