aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/animation/je_animator.h
blob: 973ff58d15d8360402911efc3a61c1a4beb2f6f6 (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
#ifndef __JE_ANIMATOR_H
#define __JE_ANIMATOR_H

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

#include "je_animation.h"

namespace JinEngine
{
    namespace Graphics
    {

        ///
        ///
        ///
        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