MyGUI  3.4.1
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 
19  public ISubWidgetRect
20  {
22 
23  public:
24  PolygonalSkin();
25 
27  void setPoints(const std::vector<FloatPoint>& _points);
28 
30  void setWidth(float _width);
31 
33  void setStroke(size_t _value);
34 
35  void setAlpha(float _alpha) override;
36 
37  void setVisible(bool _visible) override;
38 
39  void setStateData(IStateInfo* _data) override;
40 
41  void createDrawItem(ITexture* _texture, ILayerNode* _node) override;
42  void destroyDrawItem() override;
43 
44  // метод для отрисовки себя
45  void doRender() override;
46 
47  /*internal:*/
48  void _updateView() override;
49  void _correctView() override;
50 
51  void _setAlign(const IntSize& _oldsize) override;
52 
53  void _setUVSet(const FloatRect& _rect) override;
54  void _setColour(const Colour& _value) override;
55 
56  protected:
57  void _rebuildGeometry();
58  FloatPoint _getPerpendicular(const FloatPoint& _point1, const FloatPoint& _point2) const;
59  // line from center of p1-p2 line to p3
60  FloatPoint _getMiddleLine(const FloatPoint& _point1, const FloatPoint& _point2, const FloatPoint& _point3) const;
61 
62  private:
63  bool mGeometryOutdated;
64 
65  float mLineWidth;
66  size_t mLineStroke;
67  std::vector<FloatPoint> mLinePoints;
68  float mLineLength;
69 
70  std::vector<FloatPoint> mResultVerticiesPos;
71  std::vector<FloatPoint> mResultVerticiesUV;
72 
73  size_t mVertexCount;
74 
75  bool mEmptyView;
76 
77  VertexColourType mVertexFormat;
78  uint32 mCurrentColour;
79 
80  FloatRect mCurrentTexture;
81  IntCoord mCurrentCoord;
82 
83  ILayerNode* mNode;
84  RenderItem* mRenderItem;
85  };
86 
87 } // namespace MyGUI
88 
89 #endif // MYGUI_POLYGONAL_SKIN_H_
#define MYGUI_EXPORT
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:48
uint32_t uint32
Definition: MyGUI_Types.h:47