|
ShitEngine
基于 C++20 与 SDL3 的轻量级 2D 游戏引擎
|
逐帧动画数据 更多...
#include <Animation.h>
Public 成员函数 | |
| Animation (float duration=0.1f, bool loop=true) | |
| ~Animation () | |
| void | addFrame (const SDL_FRect &frame) |
| 添加单帧 | |
| void | addFrames (const std::vector< SDL_FRect > &frames) |
| 批量添加帧 | |
| SDL_FRect | getFrame (float elapsedTime) const |
| 根据已播放时间返回当前帧的源矩形 | |
| void | setLoop (bool loop) |
| void | setDuration (float duration) |
| bool | isLooping () const |
| float | getDuration () const |
| int | getFrameCount () const |
逐帧动画数据
存储一组帧矩形(SDL_FRect)及每帧持续时间。 getFrame(elapsedTime) 根据当前播放时间返回对应帧。 通常由 AnimationComponent 自动管理,不直接使用。
| Animation | ( | float | duration = 0.1f, |
| bool | loop = true ) |
| ~Animation | ( | ) |
| void addFrame | ( | const SDL_FRect & | frame | ) |
添加单帧
| void addFrames | ( | const std::vector< SDL_FRect > & | frames | ) |
批量添加帧
|
inline |
| SDL_FRect getFrame | ( | float | elapsedTime | ) | const |
根据已播放时间返回当前帧的源矩形
|
inline |
|
inline |
|
inline |
|
inline |