26 #include <boost/lexical_cast.hpp>
43 m_animation_endtime(-1),
59 std::map<uint32_t, FrameInfo>::const_iterator i(
m_framemap.end());
65 uint32_t frametime = i->first + i->second.duration;
75 std::map<uint32_t, FrameInfo>::const_iterator i(
m_framemap.upper_bound(timestamp));
77 val = i->second.index;
84 return size > 0 && index >= 0 && index < size;
102 std::map<uint32_t, FrameInfo>::const_iterator i(
m_framemap.upper_bound(timestamp));
104 val = i->second.image;
virtual ResourceState getState()
int32_t getFrameDuration(int32_t index) const
Gets the frame duration for given (indexed) frame.
void setDirection(uint32_t direction)
Animation direction tells how this animation is associated with movement when played starting from fr...
int32_t m_animation_endtime
SharedPtr< Image > ImagePtr
Contains information about one animation frame (duration + frame index + frame pointer) ...
ImagePtr getFrameByTimestamp(uint32_t timestamp)
Gets the frame image that matches the given timestamp.
std::vector< FrameInfo > m_frames
uint32_t getFrameCount() const
Get the number of frames.
int32_t getFrameIndex(uint32_t timestamp)
Get the frame index that matches given timestamp.
std::map< uint32_t, FrameInfo > m_framemap
ImagePtr getFrame(int32_t index)
Gets the frame iamge that matches the given index.
void addFrame(ImagePtr image, uint32_t duration)
Adds new frame into animation Frames must be added starting from first frame.
bool isValidIndex(int32_t index) const
Checks for animation frame index overflows.