summaryrefslogtreecommitdiff
path: root/Source/Asura.Engine/Graphics/Animation.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Asura.Engine/Graphics/Animation.h')
-rw-r--r--Source/Asura.Engine/Graphics/Animation.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/Source/Asura.Engine/Graphics/Animation.h b/Source/Asura.Engine/Graphics/Animation.h
new file mode 100644
index 0000000..391da22
--- /dev/null
+++ b/Source/Asura.Engine/Graphics/Animation.h
@@ -0,0 +1,128 @@
+#ifndef __AE_ANIMATION_H__
+#define __AE_ANIMATION_H__
+
+#include "Sprite.h"
+#include "Component.h"
+#include "Manager.hpp"
+#include "SpriteRenderer.h"
+#include "Containers/Map.h"
+#include "Containers/Vector.hpp"
+#include "Containers/StringMap.hpp"
+#include "Filesystem/Asset.h"
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ ///
+ /// ؼ֡
+ ///
+ struct Frame
+ {
+ uint mask; //
+ float time;
+ Sprite* sprite;
+ };
+
+ ///
+ /// SpriteԸıspriteĴСתšimageAnimationͨanimator޸ġ
+ ///
+ class Animation final : public Filesystem::Asset
+ {
+ public:
+
+ enum UpdateMask
+ {
+ Scale = 1,
+ Position = 1 << 1,
+ Rotation = 1 << 2,
+ Sprite = 1 << 3
+ };
+
+ struct Definition
+ {
+
+ };
+
+ ///
+ /// ʱһ֡
+ ///
+ Frame GetFrame(float t);
+
+ ///
+ /// ùؼ֡
+ ///
+ uint GetKeyFrameCount();
+
+ ///
+ /// Ƿѭ
+ ///
+ uint GetLoop();
+
+ ///
+ /// ȡʱ
+ ///
+ uint GetDuration();
+
+ private:
+
+ ///
+ /// ؼ֡
+ ///
+ Containers::Vector<Frame> mFrames;
+
+ ///
+ /// ʱ
+ ///
+ float mDuration;
+
+ ///
+ /// Ƿѭ
+ ///
+ bool mLoop;
+
+ ///
+ /// ID
+ ///
+ uint mID;
+
+ UpdateMask mUpdateMask;
+
+ };
+
+ class AnimationManager : public Manager
+ {
+ public:
+
+ Containers::String GetAnimationName(uint ID);
+
+ uint GetAnimationID(const Containers::String& name);
+
+ Animation* GetAnimation(uint ID);
+
+ Animation* GetAnimation(const Containers::String& name);
+
+ ///
+ /// ӶID
+ ///
+ uint AddAnimation(Animation* animation);
+
+ private:
+
+ ///
+ /// ӳIDanimation
+ ///
+ Containers::StringMap<uint> mAnimationIDs;
+
+ ///
+ /// ӳkeyanimation
+ ///
+ Containers::Map<uint, Animation*> mAnimations;
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file