代码:
/** @class SpriteFrame
* @brief A SpriteFrame has:
- texture: A Texture2D that will be used by the Sprite
- rectangle: A rectangle of the texture
精灵帧
纹理:精灵使用的2D纹理
矩形:纹理的矩形
You can modify the frame of a Sprite by doing:
你可以通过下面的方法修改一个精灵的帧:
SpriteFrame *frame = SpriteFrame::frameWithTexture(texture, rect, offset);
sprite->setDisplayFrame(frame);
*/
class CC_DLL SpriteFrame : public Ref, public Clonable
{
public:
/** Create a SpriteFrame with a texture filename, rect in points.
It is assumed that the frame was not trimmed.
*
* @param filename Texture file name.
* @param rect A specified rect.
* @return An autoreleased SpriteFrame object.
*/
// 创建一个精灵帧
static SpriteFrame* create(const std::string& filename, const Rect& rect);
/** 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.
*
* @param filename Texture filename
* @param rect A specified rect.
* @param rotated Is rotated if true.
* @param offset A specified offset.
* @param origin