summaryrefslogtreecommitdiff
path: root/src/sprite.h
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-05-20 01:35:17 -0600
committerJared Adams <jaxad0127@gmail.com>2010-05-20 12:25:37 -0600
commit487a86fe7dc9904f445d91667095f641f72f7c81 (patch)
tree57191d175f7b2fe771f6b2da225bc2d9cb5ff1d9 /src/sprite.h
parent36832f3a5378f739da7040f0711b7101dbc2af02 (diff)
downloadmana-487a86fe7dc9904f445d91667095f641f72f7c81.tar.gz
mana-487a86fe7dc9904f445d91667095f641f72f7c81.tar.bz2
mana-487a86fe7dc9904f445d91667095f641f72f7c81.tar.xz
mana-487a86fe7dc9904f445d91667095f641f72f7c81.zip
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
Diffstat (limited to 'src/sprite.h')
-rw-r--r--src/sprite.h20
1 files changed, 14 insertions, 6 deletions
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