diff options
author | chai <chaifix@163.com> | 2019-01-19 01:44:05 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-01-19 01:44:05 +0800 |
commit | 91e589d1678a8187c307e09b98b67ec4133092ff (patch) | |
tree | ee2761f047568ca7164b27399c0b2fb2f21c26b0 /Source/Asura.Engine/Graphics/Animation.h | |
parent | 91346d709abb37a063d0c29ddeb2d1a849d3afc2 (diff) |
*游戏框架改用脚本实现
Diffstat (limited to 'Source/Asura.Engine/Graphics/Animation.h')
-rw-r--r-- | Source/Asura.Engine/Graphics/Animation.h | 128 |
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 |