fix redraw at top-left of map
[Tsunagari.git] / src / animation.h
bloba52c7e8767b47c7da32a90df644b7640b2a9830f
1 /******************************
2 ** Tsunagari Tile Engine **
3 ** animation.h **
4 ** Copyright 2011 OmegaSDG **
5 ******************************/
7 #ifndef ANIMATED_H
8 #define ANIMATED_H
10 #include <vector>
12 #include <Gosu/Graphics.hpp>
14 #include "resourcer.h"
16 namespace Gosu {
17 class Image;
20 class Animation
22 public:
23 Animation();
24 Animation(ImageRef frame);
26 void addFrame(ImageRef frame);
27 void setFrameLen(int milliseconds);
29 bool needsRedraw(int milliseconds) const;
30 void updateFrame(int milliseconds);
31 Gosu::Image* frame() const;
33 private:
34 //! List of images in animation.
35 std::vector<ImageRef> frames;
37 //! Current graphic displaying on screen.
38 Gosu::Image* img;
40 //! Are we animated? Same as frames.size() > 1
41 bool animated;
43 //! Length of each frame in animation.
44 int frameLen;
46 //! Total length of one complete cycle through animation.
47 int animLen;
49 //! Index of frame currently displaying on screen.
50 int frameShowing;
53 #endif