7 Animation::Animation(const string
& path
, size_t frames
, uint32_t durations
) :
17 width_
= Image::width() / frames_
;
21 width_
= Image::width();
25 durations_
.assign(frames_
, durations
);
28 int Animation::width() const {
32 unsigned int Animation::durationForFrame(size_t n
) const {
33 return durations_
.at(n
);
36 void Animation::reset() {
40 void Animation::step(uint32_t ticks
)
42 currentTicks_
+= ticks
;
43 if (currentTicks_
< durationForFrame(currentFrame_
)) {
46 currentTicks_
-= durationForFrame(currentFrame_
);
47 currentFrame_
= (currentFrame_
+ 1) % frames_
;
49 clipMask_
.x
+= width();
50 if (clipMask_
.x
>= Image::width()) {