aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/animation/je_animation.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-10-24 22:08:46 +0800
committerchai <chaifix@163.com>2018-10-24 22:08:46 +0800
commitd8d7963b9b658799b806d516bbd6b44c4baa28f8 (patch)
tree4a8c7c247e5c429a4ee50baf3b5be2032575aab6 /src/libjin/Graphics/animation/je_animation.h
parente98acfb0d497e9c4560554cba73eb5c313ea034a (diff)
+粒子系统测试
Diffstat (limited to 'src/libjin/Graphics/animation/je_animation.h')
-rw-r--r--src/libjin/Graphics/animation/je_animation.h40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/libjin/Graphics/animation/je_animation.h b/src/libjin/Graphics/animation/je_animation.h
index ca5758f..aa4c93f 100644
--- a/src/libjin/Graphics/animation/je_animation.h
+++ b/src/libjin/Graphics/animation/je_animation.h
@@ -1,11 +1,10 @@
#ifndef __JE_ANIMATION_H
#define __JE_ANIMATION_H
-#include <map>
#include <vector>
#include <string>
-#include "je_clip.h"
+#include "../je_sprite.h"
namespace JinEngine
{
@@ -13,32 +12,41 @@ namespace JinEngine
{
///
- ///
+ /// Animation clip with key.
///
class Animation
{
public:
- void addClip(const std::string& key, Clip* clip);
- bool hasKey(const std::string& key);
+ void onUpdate(float dt);
- void play();
- void switchClipByKey(const std::string& key);
- void switchClip(const Clip* clip);
+ void start();
+ void pause();
+ void stop();
+ void rewind();
+ void setSpeed(float speed);
///
- /// Control clips.
+ /// Get current frame index.
///
- void stopClip();
- void pauseClip();
- void rewindClip();
- void startClip();
+ uint getCurrentFrame();
+
+ ///
+ /// Set current frame index.
+ ///
+ /// @param frame Current frame to play.
+ ///
+ void setCurrentFrame(uint frame);
private:
///
- /// Map a key to clips.
+ /// Key frames.
+ ///
+ std::vector<Sprite*> mFrames;
+
+ ///
+ /// Animation playing speed.
///
- std::map<std::string, Clip*> mClips;
- Clip* mCurrentClip;
+ float mSpeed;
};