ShitEngine
基于 C++20 与 SDL3 的轻量级 2D 游戏引擎
载入中...
搜索中...
未找到
Animation类 参考final

逐帧动画数据 更多...

#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()

Animation ( float duration = 0.1f,
bool loop = true )

◆ ~Animation()

~Animation ( )

成员函数说明

◆ addFrame()

void addFrame ( const SDL_FRect & frame)

添加单帧

◆ addFrames()

void addFrames ( const std::vector< SDL_FRect > & frames)

批量添加帧

◆ getDuration()

float getDuration ( ) const
inline

◆ getFrame()

SDL_FRect getFrame ( float elapsedTime) const

根据已播放时间返回当前帧的源矩形

◆ getFrameCount()

int getFrameCount ( ) const
inline

◆ isLooping()

bool isLooping ( ) const
inline

◆ setDuration()

void setDuration ( float duration)
inline

◆ setLoop()

void setLoop ( bool loop)
inline

该类的文档由以下文件生成: