summaryrefslogtreecommitdiff
path: root/src/graphics/animation.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics/animation.h')
-rw-r--r--src/graphics/animation.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/graphics/animation.h b/src/graphics/animation.h
new file mode 100644
index 0000000..87b4427
--- /dev/null
+++ b/src/graphics/animation.h
@@ -0,0 +1,44 @@
+#ifndef GRAPHICS_ANIMATION_H
+#define GRAPHICS_ANIMATION_H
+
+#include <SFML/Graphics.hpp>
+
+namespace Graphics{
+
+ class Animation{
+ protected:
+ int i_;
+ int count_;
+ int lastTime_;
+ int switchTime_;
+ unsigned int w_, h_;
+ sf::IntRect rect_;
+ sf::Texture texture_;
+ sf::Sprite sprite_;
+ bool ticked(int deltaTime);
+ public:
+ Animation();
+ ~Animation();
+ Animation(const char* filename, int count, int switchTime);
+ sf::Sprite& next(int deltaTime);
+ };
+
+ class OneShotAnimation : Animation {
+ public:
+ OneShotAnimation();
+ OneShotAnimation(const char* filename, int count, int switchTime);
+ bool finished();
+ sf::Sprite& next(int deltaTime);
+ };
+
+ class BouncingAnimation : Animation{
+ private:
+ bool up_;
+ public:
+ BouncingAnimation();
+ BouncingAnimation(const char* filename, int count, int switchTime);
+ ~BouncingAnimation();
+ sf::Sprite& next(int deltaTime);
+ };
+}
+#endif // GRAPHICS_ANIMATION_H