aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/graphics/animations/animation.h
blob: 72565fc22f8bbaab05411607af24f6dc834b3773 (plain)
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
#ifndef __JE_ANIMATION_H__
#define __JE_ANIMATION_H__

#include <vector>
#include <string>

#include "../../common/object.h"

#include "../sprite.h"

namespace JinEngine
{
    namespace Graphics
    {
        namespace Animations
        {

            ///
            /// Animation clip with key. 
            ///
            class Animation : public Object
            {
            public:
                Animation();
                
                void addFrame(const Sprite* frame);

                void addFrames(const std::vector<Sprite*>& frames);

                void setLoop(bool loop);

                void setSpeed(float speed);

                bool isLoop() const;

                float getSpeed() const;

                uint getFrameCount() const;

                const Sprite* getFrame(uint index) const;

            private:

                std::vector<const Sprite*> mFrames;

                ///
                /// Frame per second.
                ///
                float mSpeed;

                float mLoop;
                
            };

        } // namespace Animations
    } // namespace Graphics
} // namespace JinEngine

#endif