Background2DAnimation.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef BACKGROUND_2D_ANIMATION_H
  2. #define BACKGROUND_2D_ANIMATION_H
  3. #include <OgreString.h>
  4. #include <OgreVector2.h>
  5. #include <vector>
  6. #include "map/QGearsTile.h"
  7. class Background2D;
  8. class Background2DAnimation
  9. {
  10. public:
  11. Background2DAnimation( const Ogre::String& name, Background2D* background, const int tile_index );
  12. virtual ~Background2DAnimation();
  13. enum State
  14. {
  15. ONCE,
  16. LOOPED
  17. };
  18. void AddTime( const float time );
  19. const Ogre::String& GetName() const;
  20. void SetTime( const float time );
  21. float GetTime() const;
  22. void SetLength( const float time );
  23. float GetLength() const;
  24. virtual void AddUVKeyFrame( const QGears::KeyFrame key_frame );
  25. virtual void AddUVKeyFrame( const float time, const Ogre::Vector4& uv );
  26. virtual void AddUVKeyFrame( const float time, const float u1, const float v1, const float u2, const float v2 );
  27. private:
  28. Background2DAnimation();
  29. Ogre::String m_Name;
  30. Background2D* m_Background;
  31. int m_TileIndex;
  32. float m_Time;
  33. float m_Length;
  34. struct Background2DKeyFrameUV
  35. {
  36. float time;
  37. float u1;
  38. float v1;
  39. float u2;
  40. float v2;
  41. };
  42. std::vector< Background2DKeyFrameUV > m_UV;
  43. };
  44. #endif // BACKGROUND_2D_ANIMATION_H