diff options
Diffstat (limited to 'engines/sword25/gfx/animationresource.h')
-rw-r--r-- | engines/sword25/gfx/animationresource.h | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/engines/sword25/gfx/animationresource.h b/engines/sword25/gfx/animationresource.h index 2bc052c39c..ca0fd9ca23 100644 --- a/engines/sword25/gfx/animationresource.h +++ b/engines/sword25/gfx/animationresource.h @@ -39,13 +39,12 @@ // Includes // ----------------------------------------------------------------------------- +#include "common/xmlparser.h" #include "sword25/kernel/common.h" #include "sword25/kernel/resource.h" #include "sword25/gfx/animationdescription.h" #include "sword25/gfx/animation.h" -class TiXmlElement; - namespace Sword25 { // ----------------------------------------------------------------------------- @@ -59,9 +58,9 @@ class PackageManager; // Class Definition // ----------------------------------------------------------------------------- -class AnimationResource : public Resource, public AnimationDescription { +class AnimationResource : public Resource, public AnimationDescription, public Common::XMLParser { public: - AnimationResource(const Common::String &FileName); + AnimationResource(const Common::String &filename); virtual ~AnimationResource(); virtual const Frame &GetFrame(unsigned int Index) const { @@ -100,18 +99,35 @@ public: private: bool m_Valid; - Common::Array<Frame> m_Frames; - - //@{ - /** @name Dokument-Parser Methoden */ + Common::Array<Frame> m_Frames; - bool ParseAnimationTag(TiXmlElement &AnimationTag, int &FPS, Animation::ANIMATION_TYPES &AnimationType); - bool ParseFrameTag(TiXmlElement &FrameTag, Frame &Frame, PackageManager &PackageManager); + PackageManager * _pPackage; - //@} bool ComputeFeatures(); bool PrecacheAllFrames() const; + + // Parser + CUSTOM_XML_PARSER(AnimationResource) { + XML_KEY(animation) + XML_PROP(fps, true) + XML_PROP(type, true) + + XML_KEY(frame) + XML_PROP(file, true) + XML_PROP(hotspotx, true) + XML_PROP(hotspoty, true) + XML_PROP(fliph, false) + XML_PROP(flipv, false) + KEY_END() + KEY_END() + } PARSER_END() + + bool parseBooleanKey(Common::String s, bool &result); + + // Parser callback methods + bool parserCallback_animation(ParserNode *node); + bool parserCallback_frame(ParserNode *node); }; } // End of namespace Sword25 |