UiAnimation.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef UI_ANIMATION_H
  2. #define UI_ANIMATION_H
  3. #include <OgreString.h>
  4. #include <Ogre.h>
  5. #include <vector>
  6. class UiWidget;
  7. struct UiKeyFrameFloat
  8. {
  9. float time;
  10. float value;
  11. };
  12. struct UiKeyFrameVector2
  13. {
  14. float time;
  15. Ogre::Vector2 value;
  16. };
  17. class UiAnimation
  18. {
  19. public:
  20. UiAnimation( const Ogre::String& name, UiWidget* widget );
  21. virtual ~UiAnimation();
  22. enum State
  23. {
  24. DEFAULT,
  25. ONCE
  26. };
  27. void AddTime( const float time );
  28. const Ogre::String& GetName() const;
  29. void SetTime( const float time );
  30. float GetTime() const;
  31. void SetLength( const float time );
  32. float GetLength() const;
  33. void AddScaleKeyFrame( const UiKeyFrameVector2& key_frame );
  34. void AddXKeyFrame( const UiKeyFrameVector2& key_frame );
  35. void AddYKeyFrame( const UiKeyFrameVector2& key_frame );
  36. void AddWidthKeyFrame( const UiKeyFrameVector2& key_frame );
  37. void AddHeightKeyFrame( const UiKeyFrameVector2& key_frame );
  38. void AddRotationKeyFrame( const UiKeyFrameFloat& key_frame );
  39. void AddAlphaKeyFrame( const UiKeyFrameFloat& key_frame );
  40. void AddScissorKeyFrame( const UiKeyFrameVector2& x1, const UiKeyFrameVector2& y1, const UiKeyFrameVector2& x2, const UiKeyFrameVector2& y2 );
  41. private:
  42. UiAnimation();
  43. float KeyFrameGetValue( std::vector< UiKeyFrameFloat >& data );
  44. Ogre::Vector2 KeyFrameGetValue( std::vector< UiKeyFrameVector2 >& data );
  45. Ogre::String m_Name;
  46. UiWidget* m_Widget;
  47. float m_Time;
  48. float m_Length;
  49. std::vector< UiKeyFrameVector2 > m_Scale;
  50. std::vector< UiKeyFrameVector2 > m_X;
  51. std::vector< UiKeyFrameVector2 > m_Y;
  52. std::vector< UiKeyFrameVector2 > m_Width;
  53. std::vector< UiKeyFrameVector2 > m_Height;
  54. std::vector< UiKeyFrameFloat > m_Rotation;
  55. std::vector< UiKeyFrameFloat > m_Alpha;
  56. std::vector< UiKeyFrameVector2 > m_ScissorXTop;
  57. std::vector< UiKeyFrameVector2 > m_ScissorYLeft;
  58. std::vector< UiKeyFrameVector2 > m_ScissorXBottom;
  59. std::vector< UiKeyFrameVector2 > m_ScissorYRight;
  60. };
  61. #endif // UI_ANIMATION_H