home *** CD-ROM | disk | FTP | other *** search
- #ifndef SEQUENCES_H
- #define SEQUENCES_H
-
- #include "String.h"
- #include <list>
- #include <vector>
- class HardwarePicture2D;
- class Scene2D;
-
- class Sequences
- {
- public:
- static const Sequences * load(const String & name, Scene2D * scene);
- static void unload(const Sequences * seq);
- static unsigned cached_count();
-
- explicit Sequences(const String & name, Scene2D * scene);
- virtual ~Sequences();
- void render_frame(unsigned seq, unsigned fr, unsigned alpha)const;
- unsigned get_width(unsigned seq, unsigned fr)const;
- unsigned get_sequence_count()const;
- unsigned get_height(unsigned seq, unsigned fr)const;
- unsigned get_frame_count(unsigned seq)const;
- unsigned get_duration(unsigned seq, unsigned fr)const;
-
- const String & get_name()const
- {
- return name;
- }
- private:
- struct Frame
- {
- unsigned duration;
- unsigned width;
- unsigned height;
- HardwarePicture2D * ha;
- Frame( unsigned duration, unsigned width, unsigned height, HardwarePicture2D * ha )
- : duration( duration ),
- width( width ),
- height( height ),
- ha( ha )
- {}
- };
-
- struct Sequence
- {
- unsigned get_frame_count()const;
- unsigned get_height(unsigned fr)const;
- unsigned get_width(unsigned fr)const;
- unsigned get_duration(unsigned fr)const;
- void render_frame(Scene2D * scene, unsigned fr, int alpha)const;
-
- std::vector<Frame> frames;
- };
-
- std::vector<Sequence> data;
- String name;
- Scene2D * scene;
- int ref_count;
-
- static std::list<Sequences *> * sequences;
- static int counter;
- };
- #endif //SEQUENCES_H