MyGUI: MyGUI_PolygonalSkin.h Source File

MyGUI 3.4.3

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#include "MyGUI_VertexData.h"
15
16namespace MyGUI
17{
18
19 class MYGUI_EXPORT PolygonalSkin : public ISubWidgetRect
20 {
21 MYGUI_RTTI_DERIVED(PolygonalSkin)
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)
61 const;
62
63 private:
64 bool mGeometryOutdated{false};
65
66 float mLineWidth{1.0f};
67 size_t mLineStroke{0};
68 std::vector<FloatPoint> mLinePoints;
69 float mLineLength{0.0f};
70
71 std::vector<FloatPoint> mResultVerticiesPos;
72 std::vector<FloatPoint> mResultVerticiesUV;
73
74 size_t mVertexCount{VertexQuad::VertexCount};
75
76 bool mEmptyView{false};
77
78 VertexColourType mVertexFormat;
79 uint32 mCurrentColour{0xFFFFFFFF};
80
81 FloatRect mCurrentTexture;
82 IntCoord mCurrentCoord;
83
84 ILayerNode* mNode{nullptr};
85 RenderItem* mRenderItem{nullptr};
86 };
87
88} // namespace MyGUI
89
90#endif // MYGUI_POLYGONAL_SKIN_H_
MyGUI_ISubWidgetRect.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:69
MyGUI_RenderFormat.h
MyGUI_Types.h
MyGUI_VertexData.h
MyGUI::ILayerNode
Definition MyGUI_ILayerNode.h:29
MyGUI::IStateInfo
Definition MyGUI_IStateInfo.h:17
MyGUI::ISubWidgetRect
Definition MyGUI_ISubWidgetRect.h:18
MyGUI::ITexture
Definition MyGUI_ITexture.h:28
MyGUI::PolygonalSkin::PolygonalSkin
PolygonalSkin()
Definition MyGUI_PolygonalSkin.cpp:17
MyGUI::PolygonalSkin::_getMiddleLine
FloatPoint _getMiddleLine(const FloatPoint &_point1, const FloatPoint &_point2, const FloatPoint &_point3) const
Definition MyGUI_PolygonalSkin.cpp:517
MyGUI::PolygonalSkin::_correctView
void _correctView() override
Definition MyGUI_PolygonalSkin.cpp:108
MyGUI::PolygonalSkin::destroyDrawItem
void destroyDrawItem() override
Definition MyGUI_PolygonalSkin.cpp:207
MyGUI::PolygonalSkin::_rebuildGeometry
void _rebuildGeometry()
Definition MyGUI_PolygonalSkin.cpp:274
MyGUI::PolygonalSkin::createDrawItem
void createDrawItem(ITexture *_texture, ILayerNode *_node) override
Definition MyGUI_PolygonalSkin.cpp:198
MyGUI::PolygonalSkin::_setAlign
void _setAlign(const IntSize &_oldsize) override
Definition MyGUI_PolygonalSkin.cpp:116
MyGUI::PolygonalSkin::_getPerpendicular
FloatPoint _getPerpendicular(const FloatPoint &_point1, const FloatPoint &_point2) const
Definition MyGUI_PolygonalSkin.cpp:504
MyGUI::PolygonalSkin::setPoints
void setPoints(const std::vector< FloatPoint > &_points)
Definition MyGUI_PolygonalSkin.cpp:27
MyGUI::PolygonalSkin::setStateData
void setStateData(IStateInfo *_data) override
Definition MyGUI_PolygonalSkin.cpp:259
MyGUI::PolygonalSkin::setVisible
void setVisible(bool _visible) override
Definition MyGUI_PolygonalSkin.cpp:87
MyGUI::PolygonalSkin::setAlpha
void setAlpha(float _alpha) override
Definition MyGUI_PolygonalSkin.cpp:99
MyGUI::PolygonalSkin::_setUVSet
void _setUVSet(const FloatRect &_rect) override
Definition MyGUI_PolygonalSkin.cpp:264
MyGUI::PolygonalSkin::setWidth
void setWidth(float _width)
Definition MyGUI_PolygonalSkin.cpp:75
MyGUI::PolygonalSkin::_updateView
void _updateView() override
Definition MyGUI_PolygonalSkin.cpp:157
MyGUI::PolygonalSkin::doRender
void doRender() override
Definition MyGUI_PolygonalSkin.cpp:216
MyGUI::PolygonalSkin::_setColour
void _setColour(const Colour &_value) override
Definition MyGUI_PolygonalSkin.cpp:250
MyGUI::PolygonalSkin::setStroke
void setStroke(size_t _value)
Definition MyGUI_PolygonalSkin.cpp:81
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::uint32
uint32_t uint32
Definition MyGUI_Types.h:48
MyGUI::FloatRect
types::TRect< float > FloatRect
Definition MyGUI_Types.h:34
MyGUI::FloatPoint
types::TPoint< float > FloatPoint
Definition MyGUI_Types.h:28
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
MyGUI::IntSize
types::TSize< int > IntSize
Definition MyGUI_Types.h:30
MyGUI::Colour
Definition MyGUI_Colour.h:17