12 void Animation::addFrame(ImageRef frame
)
14 frames
.push_back(frame
);
15 animLen
= frameLen
* (int)frames
.size();
16 if (frames
.size() == 1)
18 if (frames
.size() > 1)
22 void Animation::setFrameLen(int milliseconds
)
24 frameLen
= milliseconds
;
25 animLen
= frameLen
* (int)frames
.size();
28 bool Animation::needsUpdate(int milliseconds
) const
31 int frame
= (milliseconds
% animLen
) / frameLen
;
32 if (frame
!= frameShowing
)
38 void Animation::updateFrame(int milliseconds
)
41 frameShowing
= (milliseconds
% animLen
) / frameLen
;
42 img
= frames
[frameShowing
].get();
46 Gosu::Image
* Animation::image() const