#ifndef ANIMATION_H #define ANIMATION_H #include #include #include #include #include #include #include #include "boost/shared_ptr.hpp" struct TFrame { boost::shared_ptr Pixmap; size_t TimeToPlay; std::string FrameName; int ShiftX; int ShiftY; TFrame(boost::shared_ptr pixmap, size_t timeToPlay, const std::string& frameName) : Pixmap(pixmap) , TimeToPlay(timeToPlay) , FrameName(frameName) , ShiftX(0) , ShiftY(0) { } TFrame(const TFrame& frame) { Pixmap = frame.Pixmap; TimeToPlay = frame.TimeToPlay; FrameName = frame.FrameName; ShiftX = frame.ShiftX; ShiftY = frame.ShiftY; } TFrame& operator=(const TFrame& frame) { if (&frame == this) { return *this; } Pixmap = frame.Pixmap; TimeToPlay = frame.TimeToPlay; FrameName = frame.FrameName; ShiftX = frame.ShiftX; ShiftY = frame.ShiftY; return *this; } }; struct TFrameData { float TexCoordFromX; float TexCoordFromY; float TexCoordToX; float TexCoordToY; size_t TimeToPlay; }; class MainWindow; class TAnimation : public QObject { Q_OBJECT protected: std::vector FrameList; MainWindow* Window; public: explicit TAnimation(QObject *parent = 0); void SetMainWindow(MainWindow* window); void AddFrame(const TFrame& frame); TFrame& GetFrame(int i); size_t GetFrameCount(); int GetMaxWidth(); int GetMaxHeight(); void FillSheet(boost::shared_ptr sheetPixmap, std::vector& frameDataArr); void Clear(); public slots: void LoadFrame(); }; #endif // ANIMATION_H