UiAnimation.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef UI_ANIMATION_H
  2. #define UI_ANIMATION_H
  3. #include <OgreString.h>
  4. #include <OgreVector2.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 AddRotationKeyFrame( const UiKeyFrameFloat& key_frame );
  37. void AddAlphaKeyFrame( const UiKeyFrameFloat& key_frame );
  38. private:
  39. UiAnimation();
  40. Ogre::String m_Name;
  41. UiWidget* m_Widget;
  42. float m_Time;
  43. float m_Length;
  44. std::vector< UiKeyFrameVector2 > m_Scale;
  45. std::vector< UiKeyFrameVector2 > m_X;
  46. std::vector< UiKeyFrameVector2 > m_Y;
  47. std::vector< UiKeyFrameFloat > m_Rotation;
  48. std::vector< UiKeyFrameFloat > m_Alpha;
  49. };
  50. #endif // UI_ANIMATION_H