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