diff options
author | Andy <drumsetmonkey@gmail.com> | 2016-11-30 14:13:31 -0500 |
---|---|---|
committer | Andy <drumsetmonkey@gmail.com> | 2016-11-30 14:13:31 -0500 |
commit | 8c80ad1431512979e364e540a239e806851e4ada (patch) | |
tree | f40ac2a3f2a67429e1f3c68629048e8af4b09e81 /include | |
parent | e06726a9e933ffa4195878fd784cecb1a66ca20a (diff) |
Animation
Diffstat (limited to 'include')
-rw-r--r-- | include/components.hpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/include/components.hpp b/include/components.hpp index 551df53..4f8ef56 100644 --- a/include/components.hpp +++ b/include/components.hpp @@ -13,8 +13,9 @@ #include <common.hpp> #include <texture.hpp> #include <events.hpp> - #include <atomic> +#include <tinyxml2.h> +using namespace tinyxml2; /** * @struct Position @@ -138,6 +139,8 @@ struct SpriteData { using Frame = std::vector<std::pair<SpriteData, vec2>>; +std::vector<Frame> developFrame(XMLElement*); + //TODO /** * @struct Sprite @@ -214,14 +217,20 @@ struct Animate { std::vector<Frame> frame; // COMMENT std::vector<Frame>::iterator currentFrame; - + + Animate(){ + currentFrame = std::begin(frame); + } + // COMMENT Frame nextFrame() { - if (currentFrame != std::end(frame)) - currentFrame++; - else + std::rotate(frame.begin(), frame.begin()+1, frame.end()); + return frame[0]; + /*if (currentFrame < std::end(frame)) + return (*currentFrame++); + else currentFrame = std::begin(frame); - return *currentFrame; + return (*currentFrame);*/ } }; |