diff options
author | chai <chaifix@163.com> | 2018-11-20 21:43:01 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-11-20 21:43:01 +0800 |
commit | 9474767c68c48eff2618df80433b0b81ebf529c6 (patch) | |
tree | ef33099fb7aa63f5c80f52319f6bd8a158ea31c1 /src/libjin/graphics/animations/je_animation.h | |
parent | 5bd4477d4cf413e90a6b9ef5c8991798a687a0ec (diff) |
*动画
Diffstat (limited to 'src/libjin/graphics/animations/je_animation.h')
-rw-r--r-- | src/libjin/graphics/animations/je_animation.h | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/src/libjin/graphics/animations/je_animation.h b/src/libjin/graphics/animations/je_animation.h index a13a83b..4c2fd64 100644 --- a/src/libjin/graphics/animations/je_animation.h +++ b/src/libjin/graphics/animations/je_animation.h @@ -19,15 +19,22 @@ namespace JinEngine class Animation { public: + Animation(); + /// /// /// - void update(float dt); + void addFrame(const Sprite* frame); + + /// + /// + /// + void addFrames(const std::vector<Sprite*>& frames); /// /// /// - void start(); + void update(float dt); /// /// @@ -37,7 +44,7 @@ namespace JinEngine /// /// /// - void stop(); + void resume(); /// /// Force rewind. @@ -50,6 +57,11 @@ namespace JinEngine void setSpeed(float speed); /// + /// + /// + void setLoop(bool isLoop); + + /// /// Get current frame index. /// uint getCurrentFrameIndex(); @@ -57,7 +69,7 @@ namespace JinEngine /// /// /// - Sprite* getCurrentFrame(); + const Sprite* getCurrentFrame(); /// /// Set current frame index. @@ -71,17 +83,36 @@ namespace JinEngine /// void render(float x, float y, float sx, float sy, float r); + /// + /// + /// + Animation clone(); + private: + + void next(); + /// /// Key frames. /// - std::vector<Sprite*> mFrames; + std::vector<const Sprite*> mFrames; /// /// Animation playing speed. /// float mSpeed; + /// + /// + /// + float mTick; + + uint mIndex; + + float mLoop; + + bool mActive; + }; } // namespace Animations |