OSDN Git Service

fix cmake/Macros.cmake
[moflib/moflib.git] / moflib-1.0 / src / mof / stream / BoundsAnimation.hpp
1 #pragma once
2 #include "mof/KeyFrameAnimation.hpp"
3 #include "mof/Rectangle.hpp"
4 #include "mof/Vector2D.hpp"
5
6 namespace mof
7 {
8     class BoundsAnimation : public mof::Animation< mof::Rectangle<int> >
9     {
10     public:
11
12         BoundsAnimation
13         (
14             const mof::Animation<mof::Vector2D>::Handler& position ,
15             const mof::Animation<mof::Vector2D>::Handler& scale 
16         )
17         : m_position( position) , m_scale( scale )
18         {
19         }
20
21         mof::Rectangle<int> getValue( mof::FrameNumber frame ) const
22         {
23             mof::Vector2D position = m_position->getValue( frame );
24             mof::Vector2D scale = m_scale->getValue( frame );
25             return mof::Rectangle<int>
26             (
27                 position.x , position.y ,
28                 position.x + scale.x ,
29                 position.y + scale.y 
30             );
31         }
32
33     private:
34
35         mof::Animation<mof::Vector2D>::Handler m_position;
36         mof::Animation<mof::Vector2D>::Handler m_scale;
37     };
38 }