diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-10-19 17:46:46 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-10-19 17:46:46 +0000 |
commit | 41cf359468d6379bc0e033bee9ac148d1b9255dd (patch) | |
tree | d351692d76e861607fd504366ae22374613b0fec /src/resources/spritedef.h | |
parent | c3e36e443698b001e98219e48cc97e259ada0a1d (diff) | |
download | mana-41cf359468d6379bc0e033bee9ac148d1b9255dd.tar.gz mana-41cf359468d6379bc0e033bee9ac148d1b9255dd.tar.bz2 mana-41cf359468d6379bc0e033bee9ac148d1b9255dd.tar.xz mana-41cf359468d6379bc0e033bee9ac148d1b9255dd.zip |
Factored code between resource handlers. Implemented failure-friendly sprite loader.
Diffstat (limited to 'src/resources/spritedef.h')
-rw-r--r-- | src/resources/spritedef.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index 55d7f459..121f23cc 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.h @@ -71,28 +71,26 @@ class SpriteDef : public Resource { public: /** - * Constructor. + * Loads a sprite definition file. */ - SpriteDef(const std::string &idPath, - const std::string &file, int variant); + static SpriteDef *load(std::string const &file, int variant); /** - * Destructor. + * Returns the specified action. */ - ~SpriteDef(); + Action *getAction(SpriteAction action) const; + + private: /** - * Returns the specified action. + * Constructor. */ - Action* - getAction(SpriteAction action) const; + SpriteDef(): mAction(NULL), mDirection(DIRECTION_DOWN), mLastTime(0) {} - private: /** - * Loads a sprite definition file. + * Destructor. */ - void - load(const std::string &file, int variant); + ~SpriteDef(); /** * Loads an imageset element. @@ -121,6 +119,11 @@ class SpriteDef : public Resource includeSprite(xmlNodePtr includeNode); /** + * Complete missing actions by copying existing ones. + */ + void substituteActions(); + + /** * When there are no animations defined for the action "complete", its * animations become a copy of those of the action "with". */ |