Skip to content

Commit cda3b93

Browse files
committed
add Animation::isFinished()
1 parent 0369e10 commit cda3b93

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This file is a list of ideas for gf. Some of them will eventually be in gf. Othe
1414

1515
## graphics
1616

17+
- (event) add AnyScancode, AnyKeycode and AnyGamepadButton
1718
- (font) use Signed Distance Field for big size fonts
1819
- (curve/shape) add anti-aliasing to `Curve` and `Shape`
1920
- ideas: [vaserenderer](https://github.com/tyt2y3/vaserenderer),

include/gf/Animation.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ inline namespace v1 {
115115
*/
116116
void reset();
117117

118+
/**
119+
* @brief Tell if the animation is finished
120+
*/
121+
bool isFinished() const;
122+
118123
private:
119124
struct Frame {
120125
const Texture *texture;

library/graphics/Animation.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ inline namespace v1 {
111111
m_currentDurationInFrame = Time::zero();
112112
}
113113

114+
bool Animation::isFinished() const {
115+
return !m_loop && m_currentDurationInFrame < Time::zero() && m_currentFrame + 1 >= m_frames.size();
116+
}
117+
114118
#ifndef DOXYGEN_SHOULD_SKIP_THIS
115119
}
116120
#endif

0 commit comments

Comments
 (0)