| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #pragma once
- #include "CPaletteRGBA.h"
- namespace Gfx
- {
- struct SH3DefFile;
- class CImage;
- class CAnimation
- {
- protected:
- size_t framesCount;
- ui32 width;
- ui32 height;
- inline CAnimation(ui32 fc, ui32 w, ui32 h) : framesCount(fc), width(w), height(h) {};
- public:
- static CAnimation* makeFromDEF(const SH3DefFile& def, size_t fileSize);
- virtual ~CAnimation();
- virtual CImage* getFrame(ui32 fnr) = 0;
- inline size_t getFramesCount() { return framesCount; };
- inline ui32 getWidth() { return width; };
- inline ui32 getHeight() { return height; };
- };
- class COneFrameAnimation : CAnimation
- {
- friend class CAnimation;
- CImage& frame;
- protected:
- COneFrameAnimation(CImage& img);
- public:
- virtual ~COneFrameAnimation();
- virtual CImage* getFrame(ui32 fnr);
- };
- #ifdef _MSC_VER
- #pragma warning(disable : 4200)
- #pragma warning(disable : 4291)
- #endif
- class CPalettedAnimation : CAnimation
- {
- friend class CAnimation;
- CPaletteRGBA palette;
- CImage* frames[];
- protected:
- CPalettedAnimation(const SH3DefFile& def, size_t fileSize);
- inline void* operator new(size_t size, size_t frCount) {
- return ::operator new(size + frCount * sizeof(void*));
- }
- public:
- virtual ~CPalettedAnimation();
- virtual CImage* getFrame(ui32 fnr);
- };
- #ifdef _MSC_VER
- #pragma warning(default : 4200)
- #pragma warning(default : 4291)
- #endif
- }
|