aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/graphics/animations/animator.h
blob: 263c7cbfddc65a1b61df2e195e35e8521d123cb6 (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
60
61
62
63
64
65
66
67
68
69
70
#ifndef __JE_ANIMATOR_H__
#define __JE_ANIMATOR_H__

#include <string>

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

#include "animation.h"

namespace JinEngine
{
    namespace Graphics
    {
        namespace Animations
        {

            class Animator : public Object, public Renderable
            {
            public:
                Animator();

                void play();

                void pause();

                void resume(); 

                void update(float dt);

                void rewind();

                void render(float x, float y, float sx, float sy, float r) const override;

                void setAnimation(const Animation* anim);

                void forceToFrame(uint index);

                void setSpeed(float speed);

                void setDefaultSpeed();

                void setLoop(bool loop);

                void setDefaultLoop();

                float getSpeed();

                uint getFrameCount();

            private:
                const Animation* mAnimation;

                uint mIndex;

                float mTick;

                bool mIsActive;

                float mSpeed;

                bool mLoop;

            };

        }
    }
}

#endif