![]() |
ShitEngine 1.4.2
基于 C++20 与 SDL3 的轻量级 2D 游戏引擎
|
Sprite sheet grid cutter 更多...
#include <SpriteSheet.h>
Public 成员函数 | |
| SpriteSheet (int rows, int cols, float frameWidth, float frameHeight, float margin=0.0f, float spacing=0.0f) | |
| ~SpriteSheet ()=default | |
| SpriteSheet (const SpriteSheet &)=default | |
| SpriteSheet & | operator= (const SpriteSheet &)=default |
| SpriteSheet (SpriteSheet &&) noexcept=default | |
| SpriteSheet & | operator= (SpriteSheet &&) noexcept=default |
| Rect | getFrameRect (int frameIndex) const |
| Rect | getFrameRect (int row, int col) const |
| int | getRows () const |
| int | getCols () const |
| float | getFrameWidth () const |
| float | getFrameHeight () const |
| float | getMargin () const |
| float | getSpacing () const |
| int | getFrameCount () const |
| void | setRows (int rows) |
| void | setCols (int cols) |
| void | setFrameWidth (float width) |
| void | setFrameHeight (float height) |
| void | setMargin (float margin) |
| void | setSpacing (float spacing) |
Sprite sheet grid cutter
Cuts a texture arranged in "rows x cols" grid into per-frame source rectangles (Rect). Optional margin (padding around the edges) and spacing (gap between frames), in pixels.
Usage: Shit::SpriteSheet sheet(4, 8, 32, 32); // 4 rows, 8 cols, 32x32 per frame Rect f = sheet.getFrameRect(5); // global frame 5 std::vector<int> walk{0,1,2,3,4,5}; animComp->play("walk", &sheet, walk, 0.1f, true);
| SpriteSheet | ( | int | rows, |
| int | cols, | ||
| float | frameWidth, | ||
| float | frameHeight, | ||
| float | margin = 0.0f, | ||
| float | spacing = 0.0f ) |
|
default |
|
default |
|
defaultnoexcept |
|
inline |
|
inline |
|
inline |
| Rect getFrameRect | ( | int | frameIndex | ) | const |
| Rect getFrameRect | ( | int | row, |
| int | col ) const |
|
inline |
|
inline |
|
inline |
|
inline |
|
default |
|
defaultnoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |