-
Notifications
You must be signed in to change notification settings - Fork 0
/
animation.h
61 lines (60 loc) · 1.75 KB
/
animation.h
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
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef ANIMATION_H
#define ANIMATION_H
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <vector>
#include <string>
#include <iostream>
using namespace std;
namespace SSJ {
class Animation
{
private:
sf::Time defaultFrameBreakTime;
vector <sf::Texture*> frames;
vector <sf::Time> framesBreakTime;
string animationName;
int defaultFrame;
bool smooth;
sf::Color alphaMask;
bool alphaMaskSet;
int currentFrame;
sf::Clock clock;
sf::Time stopTime;
bool stopAnimation;
bool animateOnce;
private:
int getNextFrameIndex();
public:
static map <string, Animation*> AnimationContainer;
static Animation * getAnimation(string name);
static void UpdateAllAnimation();
static void addAnimationToContainer(string, Animation *);
public:
Animation(string);
void AddFrame(const char *, sf::Time = sf::Time::Zero );
void AddFrame(string path, sf::IntRect clip, sf::Time = sf::Time::Zero );
sf::Time getDefaultFrameBreakTime() const;
void setDefaultFrameBreakTime( sf::Time value);
bool getSmooth() const;
void setSmooth(bool value);
sf::Color getAlphaMask() const;
void setAlphaMask(sf::Color value);
bool isAlphaMaskSet() ;
void disableAlphaMask();
void setDefaultFrame(int);
void setAnimateOnce(bool);
bool isAnimateOnce();
public:
void start();
void stop();
void restart();
void nextFrame();
void previousFrame();
void update();
sf::Texture* getCurrentFrame();
string getAnimationName() const;
void setAnimationName(string value);
};
}
#endif // ANIMATION_H