add basic image loading
[exterlulz-musk.git] / musk / animation.h
blob6095bebe14f7aabe83a60523b3caf7041a6f86ef
1 #ifndef MUSK_ANIMATION_H_
2 #define MUSK_ANIMATION_H_
4 #include "image.h"
6 #include <string>
7 #include <vector>
9 namespace musk {
11 class Animation : public Image
13 public:
14 // TODO: doc: duration is the duration of each frame (in ms)
15 Animation(const std::string& path,
16 size_t frames = 1, uint32_t durations = 250);
18 virtual int width() const;
20 unsigned int durationForFrame(size_t n) const;
22 void reset();
23 void step(uint32_t ticks);
25 private:
26 size_t frames_;
27 std::vector<uint32_t> durations_;
29 size_t currentFrame_;
30 uint32_t currentTicks_;
32 int width_;
35 } // namespace musk
37 #endif // MUSK_ANIMATION_H_