<animations> <animation id="1" duration="500" name="jump"> <frame gid="0" /> <frame gid="1" /> <frame gid="2" duration="100"/> </animation> </animations>
The xml may contain any number of <animation> tags, they will be stored in the map and can be recovered by their "id" attribute (id must always be an integer). "Duration" is a value in milliseconds that means the time elapsed in every frame of this animation, unless overwritten by another duration in the "frame" tag. The "name" attribute is optional, Easy2D won't do anything with it, but it helps you not getting lost in the middle of all these animations ;). In the frame tag, "gid" is the index of the frame (for example, if you use it in conjunction with an Tileset, gid should be a tile index).
If you want, you may assign these values by hand, because AnimationMap is a child of std::map, defined as follows:
class AnimationMap : public std::map< unsigned int, std::list<AnimationFrame> >
To use these values, it is desireable to assign this animation map to an instance of Animation, who has methods to control animation sequences.
This class also is a child of Resource, so it may be stored in ResourceMap if you want to share it among other objects.
Public Member Functions
|void||Load (xml_node<> *node)|
|Loads animation. |
|void e2d::graphics::AnimationMap::Load||(||xml_node<> *||node||)|
Fills the map with information contained in the already parsed xml tag passed as parameter.
|node||parsed <animations> tag (xml_node is part of RapidXML).|
|e2d::core::Exception||if map was already loaded (this->size() > 0) or xml_node is not an <animations> tag.|