aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/animation/je_animation.h
diff options
context:
space:
mode:
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;
};