summaryrefslogtreecommitdiff
path: root/src/animatedsprite.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-02 23:05:46 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-02 23:05:46 +0000
commit8676da1517a86105e4cb4970fd3a7886f7d0c214 (patch)
tree5c4b3b7748c62d9375799f375e13c4b58a89498a /src/animatedsprite.h
parent8714de88fe9715b5a4014f16d15bc55f8860cdcf (diff)
downloadmana-client-8676da1517a86105e4cb4970fd3a7886f7d0c214.tar.gz
mana-client-8676da1517a86105e4cb4970fd3a7886f7d0c214.tar.bz2
mana-client-8676da1517a86105e4cb4970fd3a7886f7d0c214.tar.xz
mana-client-8676da1517a86105e4cb4970fd3a7886f7d0c214.zip
Some cleanups, fixes and a small start on a solution for the animated sprite
synchronization problem (resetting all animations).
Diffstat (limited to 'src/animatedsprite.h')
-rw-r--r--src/animatedsprite.h54
1 files changed, 31 insertions, 23 deletions
diff --git a/src/animatedsprite.h b/src/animatedsprite.h
index 16b30077..89394d6c 100644
--- a/src/animatedsprite.h
+++ b/src/animatedsprite.h
@@ -78,6 +78,13 @@ class AnimatedSprite
~AnimatedSprite();
/**
+ * Resets the animated sprite. This is used to synchronize several
+ * animated sprites.
+ */
+ void
+ reset();
+
+ /**
* Plays an action using the current direction that will have a
* duration of the specified time, 0 means default.
*/
@@ -118,27 +125,14 @@ class AnimatedSprite
mDirection = direction;
}
- protected:
+ private:
/**
* When there are no animations defined for the action "complete", its
* animations become a copy of those of the action "with".
*/
void
- substituteAction(SpriteAction complete,
- SpriteAction with);
-
- typedef std::map<std::string, Spriteset*> Spritesets;
- typedef Spritesets::iterator SpritesetIterator;
- Spritesets mSpritesets;
- typedef std::map<SpriteAction, Action*> Actions;
- typedef Actions::iterator ActionIterator;
- Actions mActions;
- Action *mAction;
- SpriteDirection mDirection;
- int mLastTime;
- float mSpeed;
+ substituteAction(SpriteAction complete, SpriteAction with);
- private:
/**
* Gets an integer property from an xmlNodePtr.
*
@@ -146,25 +140,39 @@ class AnimatedSprite
* TODO: shared in a static utility class.
*/
static int
- getProperty(xmlNodePtr node, const char* name, int def);
+ getProperty(xmlNodePtr node, const char *name, int def);
/**
* Gets a string property from an xmlNodePtr.
*/
static std::string
- getProperty(xmlNodePtr node, const char* name, const std::string& def);
+ getProperty(xmlNodePtr node, const char *name, const std::string &def);
/**
- * converts a string into a SpriteAction enum
+ * Converts a string into a SpriteAction enum.
*/
- SpriteAction
- makeSpriteAction(const std::string& action);
+ static SpriteAction
+ makeSpriteAction(const std::string &action);
/**
- * converts a string into a SpriteDirection enum
+ * Converts a string into a SpriteDirection enum.
*/
- SpriteDirection
- makeSpriteDirection(const std::string& direction);
+ static SpriteDirection
+ makeSpriteDirection(const std::string &direction);
+
+
+ typedef std::map<std::string, Spriteset*> Spritesets;
+ typedef Spritesets::iterator SpritesetIterator;
+
+ typedef std::map<SpriteAction, Action*> Actions;
+ typedef Actions::iterator ActionIterator;
+
+ Spritesets mSpritesets;
+ Actions mActions;
+ Action *mAction;
+ SpriteDirection mDirection;
+ int mLastTime;
+ float mSpeed;
};
#endif