OSDN Git Service

fix cmake/Macros.cmake
[moflib/moflib.git] / moflib-1.0 / src / mof / Sprite.hpp
1 #pragma once
2 #include "mof/Rectangle.hpp"
3 #include <memory>
4 #include "mof/Texture.hpp"
5 #include "mof/VertexTypes.hpp"
6 #include "mof/stream/Manipulator.hpp"
7 #include "mof/Matrix2D.hpp"
8 #include "mof/Component2D.hpp"
9 #include "mof/ColorComponent.hpp"
10 #include "mof/TextureComponent.hpp"
11 #include "mof/Drawable.hpp"
12 #include <vector>
13
14
15 namespace mof{
16         
17         class Font;
18
19         class Sprite
20     : 
21         public Component2D ,
22         public ColorComponent ,
23         public TextureComponent ,
24         public Drawable
25     {
26
27         public : 
28                 typedef std::shared_ptr<Sprite> ptr;
29
30                 Sprite
31         (
32                         const Rectangle<int>& rect ,
33                         const std::shared_ptr<Texture>& pTexture ,
34                         const Rectangle<real>& tRect
35                 );
36
37                 Sprite
38         (
39                         const std::shared_ptr<Texture>& pTexture ,
40                         const Rectangle<real>& tRect
41         );
42
43                 virtual ~Sprite();
44                 virtual void update();
45                 virtual void draw() const;
46                 virtual void setVisible(bool visible);
47         virtual void setPositionStream( const Vector2DStream& stream );
48         virtual void setSizeStream( const Vector2DStream& stream );
49         virtual void setColorStream( const ColorStream& stream );
50                 mof::Vector2D getPreferredSize() const;
51
52
53
54                 static void append
55         (
56                         std::vector<VertexXYZRHWCUV>& list ,
57                         const Rectangle<float>& region , 
58                         Color color ,
59                         const Rectangle<real>& textureCoordinates
60                 );
61
62                 static Sprite* createTextSprite
63         (
64                         const Font& font , 
65                         const tstring& text
66                 );
67     private:
68         struct Impl;
69                 boost::scoped_ptr<Impl> m_pImpl;
70         };
71
72
73 } // namespace mof