diff options
Diffstat (limited to 'src/animatedsprite.h')
-rw-r--r-- | src/animatedsprite.h | 66 |
1 files changed, 22 insertions, 44 deletions
diff --git a/src/animatedsprite.h b/src/animatedsprite.h index 54b63cc0..5a19ee0d 100644 --- a/src/animatedsprite.h +++ b/src/animatedsprite.h @@ -22,19 +22,18 @@ #ifndef ANIMATEDSPRITE_H #define ANIMATEDSPRITE_H -#include "resources/spritedef.h" +#include "sprite.h" #include <map> #include <string> class Animation; -class Graphics; struct Frame; /** * Animates a sprite by adding playback state. */ -class AnimatedSprite +class AnimatedSprite : public Sprite { public: /** @@ -53,59 +52,39 @@ class AnimatedSprite static AnimatedSprite *load(const std::string &filename, int variant = 0); - /** - * Destructor. - */ virtual ~AnimatedSprite(); - /** - * Resets the animated sprite. - */ - void reset(); + bool reset(); - /** - * Plays an action using the current direction - */ - void play(SpriteAction action); + bool play(std::string action); - /** - * Inform the animation of the passed time so that it can output the - * correct animation frame. - */ - void update(int time); + bool update(int time); - /** - * Draw the current animation frame at the coordinates given in screen - * pixels. - */ bool draw(Graphics* graphics, int posX, int posY) const; - /** - * gets the width in pixels of the image of the current frame - */ int getWidth() const; - /** - * gets the height in pixels of the image of the current frame - */ int getHeight() const; - /** - * Sets the direction. - */ - void setDirection(SpriteDirection direction); + int getOffsetX() const; - /** - * Sets the alpha value of the animated sprite - */ - void setAlpha(float alpha) - { mAlpha = alpha; } + int getOffsetY() const; - /** - * Returns the current alpha opacity of the animated sprite. - */ - virtual float getAlpha() const - { return mAlpha; } + const Image* getImage() const; + + bool setDirection(SpriteDirection direction); + + int getNumberOfLayers() + { return 1; } + + virtual bool drawnWhenBehind() const + { return true; } + + size_t getCurrentFrame() const; + + size_t getFrameCount() const; + + int getDuration() const; private: bool updateCurrentAnimation(unsigned int dt); @@ -120,7 +99,6 @@ class AnimatedSprite Action *mAction; /**< The currently active action. */ Animation *mAnimation; /**< The currently active animation. */ Frame *mFrame; /**< The currently active frame. */ - float mAlpha; /**< The alpha opacity used to draw */ }; #endif |