MyGUI  3.2.2
MyGUI_PolygonalSkin.h
Go to the documentation of this file.
1 /*
2  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3  * Distributed under the MIT License
4  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5  */
6 
7 #ifndef MYGUI_POLYGONAL_SKIN_H_
8 #define MYGUI_POLYGONAL_SKIN_H_
9 
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_Types.h"
12 #include "MyGUI_ISubWidgetRect.h"
13 #include "MyGUI_RenderFormat.h"
14 
15 namespace MyGUI
16 {
17 
18  class MYGUI_EXPORT PolygonalSkin :
19  public ISubWidgetRect
20  {
22 
23  public:
24  PolygonalSkin();
25  virtual ~PolygonalSkin();
26 
28  void setPoints(const std::vector<FloatPoint>& _points);
29 
31  void setWidth(float _width);
32 
34  void setStroke(size_t _value);
35 
36  virtual void setAlpha(float _alpha);
37 
38  virtual void setVisible(bool _visible);
39 
40  virtual void setStateData(IStateInfo* _data);
41 
42  virtual void createDrawItem(ITexture* _texture, ILayerNode* _node);
43  virtual void destroyDrawItem();
44 
45  // метод для отрисовки себя
46  virtual void doRender();
47 
48  /*internal:*/
49  virtual void _updateView();
50  virtual void _correctView();
51 
52  virtual void _setAlign(const IntSize& _oldsize);
53 
54  virtual void _setUVSet(const FloatRect& _rect);
55  virtual void _setColour(const Colour& _value);
56 
57  protected:
58  void _rebuildGeometry();
59  FloatPoint _getPerpendicular(const FloatPoint& _point1, const FloatPoint& _point2);
60  // line from center of p1-p2 line to p3
61  FloatPoint _getMiddleLine(const FloatPoint& _point1, const FloatPoint& _point2, const FloatPoint& _point3);
62 
63  private:
64  bool mGeometryOutdated;
65 
66  float mLineWidth;
67  size_t mLineStroke;
68  std::vector<FloatPoint> mLinePoints;
69  float mLineLength;
70 
71  std::vector<FloatPoint> mResultVerticiesPos;
72  std::vector<FloatPoint> mResultVerticiesUV;
73 
74  size_t mVertexCount;
75 
76  bool mEmptyView;
77 
78  VertexColourType mVertexFormat;
79  uint32 mCurrentColour;
80 
81  FloatRect mCurrentTexture;
82  IntCoord mCurrentCoord;
83 
84  ILayerNode* mNode;
85  RenderItem* mRenderItem;
86  };
87 
88 } // namespace MyGUI
89 
90 #endif // MYGUI_POLYGONAL_SKIN_H_
MyGUI::types::TRect< float >
MyGUI_RenderFormat.h
MyGUI::ILayerNode
Definition: MyGUI_ILayerNode.h:27
MyGUI_ISubWidgetRect.h
MyGUI::types::TPoint
Definition: MyGUI_TPoint.h:18
MyGUI::RenderItem
Definition: MyGUI_RenderItem.h:22
MyGUI::PolygonalSkin
Definition: MyGUI_PolygonalSkin.h:18
MyGUI::uint32
unsigned int uint32
Definition: MyGUI_Types.h:48
MyGUI::IStateInfo
Definition: MyGUI_IStateInfo.h:16
MyGUI_Prerequest.h
MyGUI::VertexColourType
Definition: MyGUI_RenderFormat.h:15
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:61
MyGUI::types::TSize< int >
MyGUI::ISubWidgetRect
Definition: MyGUI_ISubWidgetRect.h:17
MyGUI::ITexture
Definition: MyGUI_ITexture.h:26
MyGUI::Colour
Definition: MyGUI_Colour.h:16
MyGUI_Types.h
MyGUI::types::TCoord< int >
MyGUI
Definition: MyGUI_ActionController.h:14