summaryrefslogtreecommitdiff
path: root/src/resources/spritedef.h
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-19 17:46:46 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-19 17:46:46 +0000
commit41cf359468d6379bc0e033bee9ac148d1b9255dd (patch)
treed351692d76e861607fd504366ae22374613b0fec /src/resources/spritedef.h
parentc3e36e443698b001e98219e48cc97e259ada0a1d (diff)
downloadMana-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.h27
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".
*/