Kiwano Engine v1.3.x
kiwano::SpriteFrame类 参考

精灵帧 更多...

#include <SpriteFrame.h>

Public 成员函数

 SpriteFrame (StringView file_path)
 创建精灵帧 更多...
 
 SpriteFrame (const Resource &res)
 创建精灵帧 更多...
 
 SpriteFrame (RefPtr< Texture > texture)
 创建精灵帧 更多...
 
 SpriteFrame (StringView file_path, const Rect &crop_rect)
 创建精灵帧 更多...
 
 SpriteFrame (const Resource &res, const Rect &crop_rect)
 创建精灵帧 更多...
 
 SpriteFrame (RefPtr< Texture > texture, const Rect &crop_rect)
 创建精灵帧 更多...
 
bool Load (StringView file_path)
 加载图像 更多...
 
bool Load (const Resource &res)
 加载图像 更多...
 
bool IsValid () const
 是否有效
 
const RectGetCropRect () const
 获取裁剪矩形
 
RefPtr< TextureGetTexture () const
 获取纹理
 
Size GetSize () const
 获取精灵帧大小
 
void SetCropRect (const Rect &crop_rect)
 裁剪精灵帧为矩形 更多...
 
void SetTexture (RefPtr< Texture > texture)
 设置纹理并重置裁剪矩形 更多...
 
Vector< SpriteFrameSplit (int cols, int rows, int max_num=-1, float padding_x=0, float padding_y=0)
 按行列分割精灵帧 更多...
 

详细描述

精灵帧

构造及析构函数说明

◆ SpriteFrame() [1/6]

kiwano::SpriteFrame::SpriteFrame ( StringView  file_path)

创建精灵帧

参数
file_path图像路径

◆ SpriteFrame() [2/6]

kiwano::SpriteFrame::SpriteFrame ( const Resource res)

创建精灵帧

参数
res图像资源

◆ SpriteFrame() [3/6]

kiwano::SpriteFrame::SpriteFrame ( RefPtr< Texture texture)

创建精灵帧

参数
texture纹理

◆ SpriteFrame() [4/6]

kiwano::SpriteFrame::SpriteFrame ( StringView  file_path,
const Rect crop_rect 
)

创建精灵帧

参数
file_path图像路径
crop_rect裁剪矩形

◆ SpriteFrame() [5/6]

kiwano::SpriteFrame::SpriteFrame ( const Resource res,
const Rect crop_rect 
)

创建精灵帧

参数
res图像资源
crop_rect裁剪矩形

◆ SpriteFrame() [6/6]

kiwano::SpriteFrame::SpriteFrame ( RefPtr< Texture texture,
const Rect crop_rect 
)

创建精灵帧

参数
texture纹理
crop_rect裁剪矩形

成员函数说明

◆ Load() [1/2]

bool kiwano::SpriteFrame::Load ( const Resource res)

加载图像

参数
res图像资源

◆ Load() [2/2]

bool kiwano::SpriteFrame::Load ( StringView  file_path)

加载图像

参数
file_path图像路径

◆ SetCropRect()

void kiwano::SpriteFrame::SetCropRect ( const Rect crop_rect)

裁剪精灵帧为矩形

参数
crop_rect裁剪矩形

◆ SetTexture()

void kiwano::SpriteFrame::SetTexture ( RefPtr< Texture texture)

设置纹理并重置裁剪矩形

参数
texture纹理

◆ Split()

Vector< SpriteFrame > kiwano::SpriteFrame::Split ( int  cols,
int  rows,
int  max_num = -1,
float  padding_x = 0,
float  padding_y = 0 
)

按行列分割精灵帧

参数
cols列数
rows行数
max_num最大帧数量,设-1为将分割后的图像全部作为序列帧
padding_xX方向间隔
padding_yY方向间隔