aboutsummaryrefslogtreecommitdiffstats
path: root/include/components.hpp
diff options
context:
space:
mode:
authorAndy <drumsetmonkey@gmail.com>2016-11-28 08:43:31 -0500
committerAndy <drumsetmonkey@gmail.com>2016-11-28 08:43:31 -0500
commit320f5d3506a8e0062606b9a178dd40d5a89b37c5 (patch)
tree9f8f765099093928718a12f914ba247bfca79d8b /include/components.hpp
parentb1d3354d93187a6bededc280ddb6dee5b159bbe7 (diff)
Animate and menu
Diffstat (limited to 'include/components.hpp')
-rw-r--r--include/components.hpp22
1 files changed, 16 insertions, 6 deletions
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<std::pair<SpriteData, vec2>>;
+
//TODO
/**
* @struct Sprite
@@ -202,14 +204,25 @@ struct Sprite {
return dim;
}
- std::vector<std::pair<SpriteData, vec2>> sprite;
+ Frame sprite;
bool faceLeft;
};
//TODO
struct Animate {
- std::vector<std::pair<SpriteData, vec2>> sprite_e;
- std::vector<std::pair<SpriteData, vec2>> sprite_c;
+ // COMMENT
+ std::vector<Frame> frame;
+ // COMMENT
+ std::vector<Frame>::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
*/