1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#ifndef GRAPHICS_ANIMATION_H
#define GRAPHICS_ANIMATION_H
#include <SFML/Graphics.hpp>
namespace Graphics{
class Animation{
protected:
int i_;
int count_;
int row_;
int lastTime_;
int switchTime_;
unsigned int w_, h_;
sf::IntRect rect_;
sf::Texture texture_;
bool ticked(int deltaTime);
public:
Animation();
~Animation();
Animation(const sf::Texture& texture, int count, int switchTime,
int height, int width, int row);
virtual sf::IntRect& next(int deltaTime);
virtual void reset();
virtual bool finished();
};
class OneShotAnimation : public Animation {
public:
OneShotAnimation();
OneShotAnimation(const sf::Texture& texture, int count, int
switchTime, int height, int width, int row);
sf::IntRect& next(int deltaTime) override;
bool finished() override;
};
class BouncingAnimation : public Animation{
private:
bool up_;
public:
BouncingAnimation();
BouncingAnimation(const sf::Texture& texture, int count, int
switchTime, int height, int width, int row);
~BouncingAnimation();
sf::IntRect& next(int deltaTime) override;
};
}
#endif // GRAPHICS_ANIMATION_H
|