diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2016-11-30 21:11:32 -0500 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2016-11-30 21:11:32 -0500 |
commit | 44a42be2087b0d6e4b732596029d8f41d7ca6b40 (patch) | |
tree | 3c5ee20a47fcc55173b7026ebc8139d02810494d /include/components.hpp | |
parent | 1024fe8305e5b0a7bb1f660a1cee077172d84534 (diff) |
Some more anim
Diffstat (limited to 'include/components.hpp')
-rw-r--r-- | include/components.hpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/include/components.hpp b/include/components.hpp index 4f8ef56..d630f83 100644 --- a/include/components.hpp +++ b/include/components.hpp @@ -216,21 +216,24 @@ struct Animate { // COMMENT std::vector<Frame> frame; // COMMENT - std::vector<Frame>::iterator currentFrame; + uint index; Animate(){ - currentFrame = std::begin(frame); + index = 0; } // COMMENT Frame nextFrame() { - 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);*/ + if (index < frame.size() - 1) { + index++; + } else { + index = 0; + } + return frame.at(index); + } + + Frame firstFrame() { + return frame.front(); } }; |