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/animatedsprite.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/animatedsprite.h') diff --git a/src/animatedsprite.h b/src/animatedsprite.h index e87a9885..73dfa529 100644 --- a/src/animatedsprite.h +++ b/src/animatedsprite.h @@ -33,6 +33,7 @@ class Action; class Graphics; class Spriteset; +struct AnimationPhase; enum SpriteAction { @@ -97,7 +98,8 @@ class AnimatedSprite * Inform the animation of the passed time so that it can output the * correct animation phase. */ - void update(int time); + void + update(int time); /** * Draw the current animation phase at the coordinates given in screen @@ -107,13 +109,13 @@ class AnimatedSprite draw(Graphics* graphics, Sint32 posX, Sint32 posY) const; /** - * gets the width in pixels of the current animation phase. + * Returns the width in pixels of the current animation phase. */ int getWidth() const; /** - * gets the height in pixels of the current animation phase. + * Returns the height in pixels of the current animation phase. */ int getHeight() const; @@ -135,6 +137,12 @@ class AnimatedSprite void substituteAction(SpriteAction complete, SpriteAction with); + /** + * Returns the current animation frame. + */ + const AnimationPhase* + getCurrentPhase() const; + /** * Gets an integer property from an xmlNodePtr. * -- cgit v1.2.3-60-g2f50