aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/animations/je_animator.h
blob: 84b0385c08264c7d015b8113eb3aea5a9778147c (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
#ifndef __JE_ANIMATOR_H__
#define __JE_ANIMATOR_H__

#include <map>
#include <vector>
#include <string>

#include "je_animation.h"

namespace JinEngine
{
    namespace Graphics
    {
        namespace Animations
        {

            ///
            ///
            ///
            class Animator
            {
            public:
                void addAnimation(const std::string& key, Animation* clip);
                bool hasKey(const std::string& key);

                void play();
                void switchAnimationByKey(const std::string& key);
                void switchAnimation(const Animation* clip);

                ///
                /// Control clips.
                ///
                void stopAnimation();
                void pauseAnimation();
                void rewindAnimation();
                void startAnimation();

            private:
                ///
                /// Map a key to clips.
                ///
                std::map<std::string, Animation*> mAnimations;
                Animation* mCurrentAnimation;

            };

        }
    } // namespace Graphics
} // namespace JinEngine

#endif