summaryrefslogtreecommitdiff
path: root/Source/Asura.Engine/Graphics/Animator.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Asura.Engine/Graphics/Animator.h')
-rw-r--r--Source/Asura.Engine/Graphics/Animator.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/Source/Asura.Engine/Graphics/Animator.h b/Source/Asura.Engine/Graphics/Animator.h
new file mode 100644
index 0000000..4d3d269
--- /dev/null
+++ b/Source/Asura.Engine/Graphics/Animator.h
@@ -0,0 +1,96 @@
+#ifndef __AE_ANIMATOR_H__
+#define __AE_ANIMATOR_H__
+
+#include "Component.h"
+#include "Animation.h"
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ ///
+ /// animationҪΪanimationĴ
+ ///
+ class Animator final : public Component
+ {
+ public:
+
+ void OnEnable() override;
+ void OnUpdate(uint32 milliseconds) override;
+
+ ///
+ /// animation
+ ///
+ void SetAnimation(uint ID);
+
+ ///
+ /// animation
+ ///
+ void SetAnimation(Animation* animation);
+
+ ///
+ /// animation״̬
+ ///
+ void SetTime(float time);
+
+ ///
+ /// ޸IJٶ
+ ///
+ void SetSpeed(float speed);
+
+ ///
+ /// Ƿѭ
+ ///
+ void SetLoop(bool isloop);
+
+ ///
+ /// ݹؼ֡޸animation
+ ///
+ void SetKeyFrame(uint keyFrame);
+
+ ///
+ /// õ
+ ///
+ void SetToBegin();
+
+ ///
+ /// õʼ
+ ///
+ void SetToEnd();
+
+ ///
+ /// ͣ
+ ///
+ void Pause();
+
+ private:
+
+ ///
+ /// ǰanimation
+ ///
+ Animation* mAnimation;
+
+ ///
+ /// AnimationҪһsprite renderer
+ ///
+ SpriteRenderer* mSpriteRenderer;
+
+ ///
+ /// ٶȣĬΪ1dt = mSpeed * DELTA_TIME
+ ///
+ float mSpeed;
+
+ ///
+ /// ǰִеʱ
+ ///
+ float mTime;
+
+ bool mLoop;
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file