1 /******************************
2 ** Tsunagari Tile Engine **
4 ** Copyright 2011 OmegaSDG **
5 ******************************/
18 Animation::Animation(ImageRef frame
)
24 void Animation::addFrame(ImageRef frame
)
26 frames
.push_back(frame
);
27 animLen
= frameLen
* (int)frames
.size();
28 if (frames
.size() == 1)
30 if (frames
.size() > 1)
34 void Animation::setFrameLen(int milliseconds
)
36 frameLen
= milliseconds
;
37 animLen
= frameLen
* (int)frames
.size();
40 bool Animation::needsRedraw(int milliseconds
) const
43 int frame
= (milliseconds
% animLen
) / frameLen
;
44 if (frame
!= frameShowing
)
50 void Animation::updateFrame(int milliseconds
)
53 frameShowing
= (milliseconds
% animLen
) / frameLen
;
54 img
= frames
[frameShowing
].get();
58 Gosu::Image
* Animation::frame() const