30 #include "ext/tinyxml/fife_tinyxml.h"
51 : m_vfs(vfs), m_imageManager(imageManager) {
56 bfs::path animPath(filename);
58 std::string animationFilename = animPath.string();
87 bfs::path animPath(filename);
89 std::string animationFilename = animPath.string();
112 catch (NotFound& e) {
124 TiXmlElement* root = doc.RootElement();
130 root->QueryValueAttribute(
"delay", &animDelay);
135 root->QueryValueAttribute(
"x_offset", &animXoffset);
136 root->QueryValueAttribute(
"y_offset", &animYoffset);
137 root->QueryValueAttribute(
"action", &action);
139 for (TiXmlElement* frameElement = root->FirstChildElement(
"frame"); frameElement; frameElement = frameElement->NextSiblingElement(
"frame")) {
143 const std::string* sourceId = frameElement->Attribute(std::string(
"source"));
146 bfs::path framePath(filename);
151 framePath = bfs::path(*sourceId);
163 int frameXoffset = 0;
164 int frameYoffset = 0;
166 int success = root->QueryValueAttribute(
"x_offset", &frameXoffset);
168 if (success == TIXML_SUCCESS) {
175 success = root->QueryValueAttribute(
"y_offset", &frameYoffset);
177 if (success == TIXML_SUCCESS) {
185 success = root->QueryValueAttribute(
"delay", &frameDelay);
187 if (success == TIXML_SUCCESS) {
188 animation->
addFrame(imagePtr, frameDelay);
191 animation->
addFrame(imagePtr, animDelay);
virtual ImagePtr create(IResourceLoader *loader=0)
Creates a blank Image but does not load it immediately.
virtual bool exists(const std::string &name)
Checks to see if an Image exists.
uint32_t getDataLength() const
get the complete datalength
void setXShift(int32_t xshift)
void reset(T *ptr=0)
reset this pointer to a null shared pointer this can be used to lower the reference count of the shar...
RawData * open(const std::string &path)
Open a file.
static Logger _log(LM_AUDIO)
void setActionFrame(int32_t num)
Sets the action frame.
virtual ImagePtr getPtr(const std::string &name)
AnimationLoader(VFS *vfs, ImageManager *imageManager)
#define FL_ERR(logger, msg)
bool HasParentPath(const bfs::path &path)
Helper function to determine if a path object has a parent path.
bfs::path GetParentPath(const bfs::path &path)
Helper function to retrieve a parent path object from a path object.
virtual AnimationPtr load(const std::string &filename)
std::string readString(size_t len)
read a string with len bytes, not assuming a terminating 0 Appends a null terminator character to the...
void addFrame(ImagePtr image, uint32_t duration)
Adds new frame into animation Frames must be added starting from first frame.
the main VFS (virtual file system) class
void setYShift(int32_t yshift)
ImageManager * m_imageManager
virtual bool isLoadable(const std::string &filename)
Used to access diffrent kinds of data.