From 29bedd4da7e21b6dc644c8aa69d096db1516ea7b Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 14 Nov 2006 22:51:09 +0000 Subject: 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. --- src/animation.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/animation.h') 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 mAnimationPhases; std::list::iterator iCurrentPhase; unsigned int mTime; + int mLength; }; #endif -- cgit v1.2.3-70-g09d2