From 320f5d3506a8e0062606b9a178dd40d5a89b37c5 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 28 Nov 2016 08:43:31 -0500 Subject: Animate and menu --- include/components.hpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'include/components.hpp') diff --git a/include/components.hpp b/include/components.hpp index 367b8a3..774429d 100644 --- a/include/components.hpp +++ b/include/components.hpp @@ -136,6 +136,8 @@ struct SpriteData { vec2 size; }; +using Frame = std::vector>; + //TODO /** * @struct Sprite @@ -202,14 +204,25 @@ struct Sprite { return dim; } - std::vector> sprite; + Frame sprite; bool faceLeft; }; //TODO struct Animate { - std::vector> sprite_e; - std::vector> sprite_c; + // COMMENT + std::vector frame; + // COMMENT + std::vector::iterator currentFrame; + + // COMMENT + Frame nextFrame() { + if (currentFrame != std::end(frame)) + currentFrame++; + else + currentFrame = std::begin(frame); + return *currentFrame; + } }; //TODO @@ -240,8 +253,6 @@ struct Dialog { int rindex; }; - - // movement styles /** @@ -261,7 +272,6 @@ struct Wander { int countdown; }; - /** * SYSTEMS */ -- cgit v1.2.3