summaryrefslogtreecommitdiff
path: root/src/animation.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-11-14 22:51:09 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-11-14 22:51:09 +0000
commit29bedd4da7e21b6dc644c8aa69d096db1516ea7b (patch)
treec33d35513bbf069e4e39c604bc2200ce100856e1 /src/animation.h
parent82f587f2f3795898ed4fb7b125bf34b7e13de7cd (diff)
downloadmana-client-29bedd4da7e21b6dc644c8aa69d096db1516ea7b.tar.gz
mana-client-29bedd4da7e21b6dc644c8aa69d096db1516ea7b.tar.bz2
mana-client-29bedd4da7e21b6dc644c8aa69d096db1516ea7b.tar.xz
mana-client-29bedd4da7e21b6dc644c8aa69d096db1516ea7b.zip
Resolve Image* of animation phase at load time instead of storing just the
spriteset index and looking it up later (checking validity should still be added). Also calculate animation length during loading instead of summing it up each time it is requested.
Diffstat (limited to 'src/animation.h')
-rw-r--r--src/animation.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/animation.h b/src/animation.h
index 8f62b9c4..0230e820 100644
--- a/src/animation.h
+++ b/src/animation.h
@@ -37,7 +37,7 @@ class Spriteset;
*/
struct AnimationPhase
{
- int image;
+ Image *image;
unsigned int delay;
int offsetX;
int offsetY;
@@ -65,7 +65,7 @@ class Animation
* Appends a new animation at the end of the sequence
*/
void
- addPhase(int image, unsigned int delay, int offsetX, int offsetY);
+ addPhase(Image *image, unsigned int delay, int offsetX, int offsetY);
/**
* Appends an animation terminator that states that the animation
@@ -82,7 +82,7 @@ class Animation
bool
update(unsigned int time);
- int
+ const AnimationPhase*
getCurrentPhase() const;
/**
@@ -101,13 +101,14 @@ class Animation
* Returns the length of this animation.
*/
int
- getLength();
+ getLength() const { return mLength; }
protected:
- static bool isTerminator(AnimationPhase);
+ static bool isTerminator(AnimationPhase phase);
std::list<AnimationPhase> mAnimationPhases;
std::list<AnimationPhase>::iterator iCurrentPhase;
unsigned int mTime;
+ int mLength;
};
#endif