This repository was archived by the owner on Jan 18, 2024. It is now read-only.
forked from rpbpolis/spic-prj-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAnimator.hpp
75 lines (62 loc) · 1.96 KB
/
Animator.hpp
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef ANIMATOR_H_
#define ANIMATOR_H_
#include "Component.hpp"
#include "Sprite.hpp"
#include <vector>
#include <memory>
#if __has_include("Animator_includes.hpp")
#include "Animator_includes.hpp"
#endif
namespace spic {
/**
* @brief A component which can play animated sequences of sprites.
* @spicapi
*/
class Animator : public Component {
public:
/**
* @brief Constructor.
* @param fps The amount of frames the animator will cycle though per second.
* @param sprites An list of sprites to loop through.
* @sharedapi
*/
Animator(int fps, const std::vector<std::shared_ptr<Sprite>>& sprites);
/**
* @brief Start playing the image sequence.
* @param looping If true, will automatically start again when done.
* @spicapi
*/
void Play(bool looping);
/**
* @brief Stop playing the image sequence. Whatever sprite was displayed
* last will remain shown.
* @spicapi
*/
void Stop();
/**
* @brief Get the frames per second of the animator
* @return An integer representing the frames per second of the animator
* @sharedapi
*/
int FPS() const;
/**
* @brief Set the new frames per second of the animator
* @param newFps An integer representing the new frames per second of the animator
* @sharedapi
*/
void FPS(int newFps);
#if __has_include("Animator_public.hpp")
#include "Animator_public.hpp"
#endif
private:
/**
* @brief frames per second (playing speed)
* @spicapi
*/
int fps;
#if __has_include("Animator_private.hpp")
#include "Animator_private.hpp"
#endif
};
}
#endif // ANIMATOR_H_