2D sprite-sheet clip player. 更多...
#include <SpriteAnim.h>
Public 成员函数 | |
| SpriteAnim () | |
| Sprite anim. | |
| ~SpriteAnim () | |
| Sprite anim. | |
| SpriteAnim (const SpriteAnim &)=delete | |
| SpriteAnim & | operator= (const SpriteAnim &)=delete |
| void | setSheet (SpriteSheet *sheet) |
| Optional sheet used by applyToQuad / bindQuad. | |
| SpriteSheet * | getSheet () const |
| Returns the sheet. | |
| void | play (SpriteClip *clip) |
| Play. | |
| void | playReverse (SpriteClip *clip) |
| Start at the clip end and play backward (speed becomes negative). | |
| void | stop () |
| Stops . | |
| void | pause () |
| Pause. | |
| void | resume () |
| Resume. | |
| void | setSpeed (float speed) |
| Sets the speed. | |
| float | getSpeed () const |
| Returns the speed. | |
| void | addSpeedCurveKey (float seconds, float multiplier) |
| Add a piecewise-linear speed multiplier key at curve time in seconds. | |
| void | clearSpeedCurve () |
| Remove all speed-curve keys and restore constant-speed playback. | |
| void | resetSpeedCurve () |
| Restart speed-curve sampling from zero without changing clip time. | |
| void | setSpeedCurveLoop (bool loop) |
| Choose whether speed-curve time wraps after its last key. | |
| void | setSpeedCurveInterpolation (const std::string &mode) |
| Set speed-curve interpolation: linear, smooth, or cubic. | |
| float | getSpeedCurveValue () const |
| Return the current sampled curve multiplier. | |
| void | setFrame (int clipFrame) |
| Sets the frame. | |
| void | step (int frames) |
| Step. | |
| void | playOnce (SpriteClip *clip) |
| Play once. | |
| void | queue (SpriteClip *clip) |
| Queue. | |
| std::string | consumeEvent () |
| Consume event. | |
| void | setTime (float seconds) |
| Sets the time. | |
| float | getTime () const |
| Returns the time. | |
| void | setLoop (bool loop) |
| Sets the loop. | |
| bool | getLoop () const |
| Returns the loop. | |
| bool | isPlaying () const |
| True when playing. | |
| bool | isPaused () const |
| True when paused. | |
| bool | isFinished () const |
| True when finished. | |
| int | getLoopCount () const |
| Return loop boundaries crossed since play started. | |
| bool | consumeCompleted () |
| Consume and clear the one-shot completion event. | |
| int | consumeLooped () |
| Consume and clear pending loop events, returning their count. | |
| SpriteClip * | getClip () const |
| Returns the clip. | |
| int | getClipFrame () const |
| Index inside the current clip (0..clipFrameCount-1), or -1. | |
| int | getSheetFrame () const |
| Sheet frame index for the current cell, or -1. | |
| void | bindQuad (graphics::Quad *quad) |
| Keep this Quad's viewport updated each update/play. | |
| void | unbindQuad () |
| Unbinds quad. | |
| graphics::Quad * | getBoundQuad () const |
| Returns the bound quad. | |
| void | bindSprite (graphics::Renderable2D *sprite) |
| Bind a Sprite2D so trimmed frame layout is synchronized automatically. | |
| void | applyToQuad (graphics::Quad *quad) const |
| Write current sheet frame into quad (requires sheet). | |
| eve::Result< void > | advance (const eve::SimulationStep &step) |
| Advance playback. Returns true while still active (playing or paused). Auto-applies to boundQuad when sheet is set. | |
| bool | hasCurrentTick () const noexcept |
| Whether this sprite animation has consumed a scheduler step. | |
| eve::SimulationTick | currentTick () const noexcept |
| Last scheduler tick consumed by this sprite animation. | |
| bool | update (float dt) |
| Legacy seconds facade; explicitly forwards to advance(). | |
友元 | |
| class | Animation |
详细描述
2D sprite-sheet clip player.
Advances frame time, optionally keeps a bound Quad in sync with the current sheet cell. Register with Animation for module-level anim.advance(step). Script type: SpriteAnim.
在文件 SpriteAnim.h 第 26 行定义.
构造及析构函数说明
◆ SpriteAnim() [1/2]
|
default |
Sprite anim.
◆ ~SpriteAnim()
| eve::animation::SpriteAnim::~SpriteAnim | ( | ) |
Sprite anim.
在文件 SpriteAnim.cpp 第 18 行定义.
◆ SpriteAnim() [2/2]
|
delete |
成员函数说明
◆ addSpeedCurveKey()
| void eve::animation::SpriteAnim::addSpeedCurveKey | ( | float | seconds, |
| float | multiplier | ||
| ) |
Add a piecewise-linear speed multiplier key at curve time in seconds.
在文件 SpriteAnim.cpp 第 68 行定义.
◆ advance()
| eve::Result< void > eve::animation::SpriteAnim::advance | ( | const eve::SimulationStep & | step | ) |
Advance playback. Returns true while still active (playing or paused). Auto-applies to boundQuad when sheet is set.
Advance playback by one scheduler-owned deterministic step.
在文件 SpriteAnim.cpp 第 291 行定义.
引用了 eve::Applied, eve::Result< T >::failure(), eve::animation::detail::secondsForStep(), step, eve::Status::success() , 以及 eve::Result< T >::success().
被这些函数引用 update().
◆ applyToQuad()
| void eve::animation::SpriteAnim::applyToQuad | ( | graphics::Quad * | quad | ) | const |
Write current sheet frame into quad (requires sheet).
在文件 SpriteAnim.cpp 第 183 行定义.
引用了 eve::animation::SpriteSheet::applyToQuad() , 以及 getSheetFrame().
◆ bindQuad()
| void eve::animation::SpriteAnim::bindQuad | ( | graphics::Quad * | quad | ) |
Keep this Quad's viewport updated each update/play.
在文件 SpriteAnim.cpp 第 175 行定义.
◆ bindSprite()
| void eve::animation::SpriteAnim::bindSprite | ( | graphics::Renderable2D * | sprite | ) |
Bind a Sprite2D so trimmed frame layout is synchronized automatically.
在文件 SpriteAnim.cpp 第 181 行定义.
◆ clearSpeedCurve()
| void eve::animation::SpriteAnim::clearSpeedCurve | ( | ) |
Remove all speed-curve keys and restore constant-speed playback.
在文件 SpriteAnim.cpp 第 75 行定义.
◆ consumeCompleted()
| bool eve::animation::SpriteAnim::consumeCompleted | ( | ) |
◆ consumeEvent()
| std::string eve::animation::SpriteAnim::consumeEvent | ( | ) |
◆ consumeLooped()
| int eve::animation::SpriteAnim::consumeLooped | ( | ) |
Consume and clear pending loop events, returning their count.
在文件 SpriteAnim.cpp 第 144 行定义.
引用了 value.
◆ currentTick()
|
inlinenoexcept |
Last scheduler tick consumed by this sprite animation.
在文件 SpriteAnim.h 第 128 行定义.
◆ getBoundQuad()
|
inline |
Returns the bound quad.
在文件 SpriteAnim.h 第 112 行定义.
◆ getClip()
|
inline |
Returns the clip.
在文件 SpriteAnim.h 第 101 行定义.
◆ getClipFrame()
|
inline |
Index inside the current clip (0..clipFrameCount-1), or -1.
在文件 SpriteAnim.h 第 103 行定义.
◆ getLoop()
| bool eve::animation::SpriteAnim::getLoop | ( | ) | const |
Returns the loop.
在文件 SpriteAnim.cpp 第 166 行定义.
引用了 eve::animation::SpriteClip::getLoop().
被这些函数引用 step().
◆ getLoopCount()
|
inline |
Return loop boundaries crossed since play started.
在文件 SpriteAnim.h 第 94 行定义.
◆ getSheet()
|
inline |
Returns the sheet.
在文件 SpriteAnim.h 第 39 行定义.
◆ getSheetFrame()
| int eve::animation::SpriteAnim::getSheetFrame | ( | ) | const |
Sheet frame index for the current cell, or -1.
在文件 SpriteAnim.cpp 第 170 行定义.
引用了 eve::animation::SpriteClip::getSheetFrame().
被这些函数引用 applyToQuad().
◆ getSpeed()
|
inline |
Returns the speed.
在文件 SpriteAnim.h 第 55 行定义.
◆ getSpeedCurveValue()
| float eve::animation::SpriteAnim::getSpeedCurveValue | ( | ) | const |
Return the current sampled curve multiplier.
在文件 SpriteAnim.cpp 第 108 行定义.
◆ getTime()
|
inline |
Returns the time.
在文件 SpriteAnim.h 第 81 行定义.
◆ hasCurrentTick()
|
inlinenoexcept |
Whether this sprite animation has consumed a scheduler step.
在文件 SpriteAnim.h 第 126 行定义.
◆ isFinished()
|
inline |
True when finished.
在文件 SpriteAnim.h 第 92 行定义.
◆ isPaused()
|
inline |
True when paused.
在文件 SpriteAnim.h 第 90 行定义.
◆ isPlaying()
|
inline |
True when playing.
在文件 SpriteAnim.h 第 88 行定义.
◆ operator=()
|
delete |
◆ pause()
| void eve::animation::SpriteAnim::pause | ( | ) |
Pause.
在文件 SpriteAnim.cpp 第 56 行定义.
◆ play()
| void eve::animation::SpriteAnim::play | ( | SpriteClip * | clip | ) |
◆ playOnce()
| void eve::animation::SpriteAnim::playOnce | ( | SpriteClip * | clip | ) |
◆ playReverse()
| void eve::animation::SpriteAnim::playReverse | ( | SpriteClip * | clip | ) |
Start at the clip end and play backward (speed becomes negative).
在文件 SpriteAnim.cpp 第 39 行定义.
引用了 clip, eve::animation::SpriteClip::getDuration() , 以及 play().
◆ queue()
| void eve::animation::SpriteAnim::queue | ( | SpriteClip * | clip | ) |
◆ resetSpeedCurve()
| void eve::animation::SpriteAnim::resetSpeedCurve | ( | ) |
Restart speed-curve sampling from zero without changing clip time.
在文件 SpriteAnim.cpp 第 80 行定义.
◆ resume()
| void eve::animation::SpriteAnim::resume | ( | ) |
Resume.
在文件 SpriteAnim.cpp 第 60 行定义.
◆ setFrame()
| void eve::animation::SpriteAnim::setFrame | ( | int | clipFrame | ) |
Sets the frame.
在文件 SpriteAnim.cpp 第 116 行定义.
引用了 eve::animation::SpriteClip::getFrameCount(), eve::animation::SpriteClip::getFrameDuration(), setTime() , 以及 t.
被这些函数引用 step().
◆ setLoop()
| void eve::animation::SpriteAnim::setLoop | ( | bool | loop | ) |
◆ setSheet()
| void eve::animation::SpriteAnim::setSheet | ( | SpriteSheet * | sheet | ) |
Optional sheet used by applyToQuad / bindQuad.
在文件 SpriteAnim.cpp 第 22 行定义.
◆ setSpeed()
| void eve::animation::SpriteAnim::setSpeed | ( | float | speed | ) |
Sets the speed.
在文件 SpriteAnim.cpp 第 64 行定义.
◆ setSpeedCurveInterpolation()
| void eve::animation::SpriteAnim::setSpeedCurveInterpolation | ( | const std::string & | mode | ) |
Set speed-curve interpolation: linear, smooth, or cubic.
在文件 SpriteAnim.cpp 第 110 行定义.
◆ setSpeedCurveLoop()
|
inline |
◆ setTime()
| void eve::animation::SpriteAnim::setTime | ( | float | seconds | ) |
Sets the time.
在文件 SpriteAnim.cpp 第 150 行定义.
引用了 eve::animation::SpriteClip::getEvent().
被这些函数引用 setFrame().
◆ step()
| void eve::animation::SpriteAnim::step | ( | int | frames | ) |
Step.
在文件 SpriteAnim.cpp 第 124 行定义.
引用了 count, eve::animation::SpriteClip::getFrameCount(), getLoop(), setFrame() , 以及 target.
◆ stop()
| void eve::animation::SpriteAnim::stop | ( | ) |
Stops .
在文件 SpriteAnim.cpp 第 48 行定义.
◆ unbindQuad()
| void eve::animation::SpriteAnim::unbindQuad | ( | ) |
Unbinds quad.
在文件 SpriteAnim.cpp 第 180 行定义.
◆ update()
| bool eve::animation::SpriteAnim::update | ( | float | dt | ) |
Legacy seconds facade; explicitly forwards to advance().
在文件 SpriteAnim.cpp 第 300 行定义.
引用了 advance(), eve::animation::detail::legacyStep() , 以及 step.
友元及相关函数文档
◆ Animation
|
friend |
在文件 SpriteAnim.h 第 133 行定义.
该类的文档由以下文件生成:
- src/modules/animation/SpriteAnim.h
- src/modules/animation/SpriteAnim.cpp