From 487a86fe7dc9904f445d91667095f641f72f7c81 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Thu, 20 May 2010 01:35:17 -0600 Subject: Buffer layered sprites under SDL This improves framerate and allows transparent overlay for complex sprites. Two copies of the buffer are kept, one at full opacity, one with variable opactiy, to reduce calls to setAlpha. Reviewed-by: Bertram --- src/sprite.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/sprite.h') diff --git a/src/sprite.h b/src/sprite.h index d8345ab8..2bcd754a 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -33,19 +33,25 @@ class Sprite /** * Resets the sprite. + * + * @returns true if the sprite changed, false otherwise */ - virtual void reset() = 0; + virtual bool reset() = 0; /** - * Plays an action using the current direction + * Plays an action using the current direction. + * + * @returns true if the sprite changed, false otherwise */ - virtual void play(SpriteAction action) = 0; + virtual bool play(SpriteAction action) = 0; /** * Inform the animation of the passed time so that it can output the * correct animation frame. + * + * @returns true if the sprite changed, false otherwise */ - virtual void update(int time) = 0; + virtual bool update(int time) = 0; /** * Draw the current animation frame at the coordinates given in screen @@ -66,12 +72,14 @@ class Sprite /** * Returns a reference to the current image being drawn. */ - virtual Image* getImage() const = 0; + virtual const Image* getImage() const = 0; /** * Sets the direction. + * + * @returns true if the sprite changed, false otherwise */ - virtual void setDirection(SpriteDirection direction) = 0; + virtual bool setDirection(SpriteDirection direction) = 0; /** * Sets the alpha value of the animated sprite -- cgit v1.2.3-70-g09d2