TDME2  1.9.200
GUITextureBaseNode.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #include <tdme/tdme.h>
7 #include <tdme/gui/fwd-tdme.h>
10 #include <tdme/gui/nodes/GUINode.h>
15 #include <tdme/math/Matrix3x3.h>
16 
17 using std::string;
18 
35 
36 /**
37  * GUI texture base node
38  * @author Andreas Drewke
39  */
41  : public GUINode
42 {
43  friend class tdme::gui::GUIParser;
44 public:
46  float horizontalScale { 1.0f };
47  float verticalScale { 1.0f };
48  };
49 
50 private:
52  bool mirrorX { false };
53  bool mirrorY { false };
57  Texture* maskTexture { nullptr };
58  float maskMaxValue;
59  int32_t maskTextureId { 0 };
60 
64  string mask;
65 
66 protected:
67  int32_t textureId { 0 };
68  int textureWidth { 0 };
69  int textureHeight { 0 };
70 
71  // forbid class copy
73 
74  /**
75  * Constructor
76  * @param screenNode screen node
77  * @param parentNode parent node
78  * @param id id
79  * @param flow flow
80  * @param alignments alignments
81  * @param requestedConstraints requested constraints
82  * @param backgroundColor background color
83  * @param backgroundImage background image
84  * @param backgroundImageScale9Grid background image scale 9 grid
85  * @param backgroundImageEffectColorMul background image effect color mul
86  * @param backgroundImageEffectColorAdd background image effect color add
87  * @param border border
88  * @param padding padding
89  * @param showOn show on
90  * @param hideOn hide on
91  * @param tooltip tooltip
92  * @param requestedDimensionConstraints requested dimension constraints
93  * @param mirrorX mirror X
94  * @param mirrorY mirror Y
95  * @param effectColorMul effect color mul
96  * @param effectColorAdd effect color add
97  * @param scale9Grid scale 9 grid
98  * @param clipping clipping
99  * @param mask mask image
100  * @param maskMaxValue maximum value of mask to display image
101  * @throws tdme::gui::GUIParserException
102  */
106  const string& id,
110  const GUIColor& backgroundColor,
111  const string& backgroundImage,
115  const GUINode_Border& border,
116  const GUINode_Padding& padding,
117  const GUINodeConditions& showOn,
118  const GUINodeConditions& hideOn,
119  const string& tooltip,
120  const RequestedDimensionConstraints& requestedDimensionConstraints,
121  bool mirrorX,
122  bool mirrorY,
123  const GUIColor& effectColorMul,
124  const GUIColor& effectColorAdd,
126  const GUINode_Clipping& clipping,
127  const string& mask,
128  float maskMaxValue
129  );
130 
131  /**
132  * @return node type
133  */
134  const string getNodeType() override = 0;
135  bool isContentNode() override;
136 
137 public:
138  // overridden methods
139  int getContentWidth() override;
140  int getContentHeight() override;
141  void dispose() override;
142  void render(GUIRenderer* guiRenderer) override;
143 
144  /**
145  * Set texture matrix
146  * @param textureMatrix texture matrix
147  */
149 
150  /**
151  * @return effect color mul
152  */
153  const GUIColor& getEffectColorMul();
154 
155  /**
156  * Set effect color mul
157  * @param effectColorMul effect color mul
158  */
160 
161  /**
162  * @return effect color add
163  */
164  const GUIColor& getEffectColorAdd();
165 
166  /**
167  * Set effect color add
168  * @param effectColorAdd effect color add
169  */
171 
172  /**
173  * @return clipping
174  */
176 
177  /**
178  * Create clipping
179  * @param allClipping all sides
180  * @param left left
181  * @param top top
182  * @param right right
183  * @param bottom bottom
184  */
185  static GUINode_Clipping createClipping(const string& allClipping, const string& left, const string& top, const string& right, const string& bottom);
186 
187  /**
188  * @return mask source
189  */
190  const string& getMask();
191 
192  /**
193  * Set mask source
194  * @param mask mask source
195  */
196  void setMask(const string& mask);
197 
198  /**
199  * @return maximum value of mask to display image
200  */
201  float getMaskMaxValue() {
202  return maskMaxValue;
203  }
204 
205  /**
206  * Set maximum value of mask to display image
207  * @param maskMinValue value of mask to display image
208  */
210  this->maskMaxValue = maskMaxValue;
211  }
212 
213  /**
214  * Create requested dimension constraints
215  * @param width width
216  * @param height height
217  * @return requested constraints
218  */
219  static RequestedDimensionConstraints createRequestedDimensionConstraints(const string& width, const string& height);
220 
221  /**
222  * On render texture event
223  */
224  virtual void onRenderTexture();
225 
226 };
Texture entity.
Definition: Texture.h:24
GUI parser.
Definition: GUIParser.h:40
GUI element node conditions.
GUI node base class.
Definition: GUINode.h:64
GUINodeConditions hideOn
Definition: GUINode.h:162
GUIColor backgroundImageEffectColorMul
Definition: GUINode.h:157
GUINode_Border border
Definition: GUINode.h:160
GUINode_Scale9Grid backgroundImageScale9Grid
Definition: GUINode.h:156
GUIColor backgroundImageEffectColorAdd
Definition: GUINode.h:158
GUIParentNode * parentNode
Definition: GUINode.h:148
GUINode_Padding padding
Definition: GUINode.h:159
GUIScreenNode * screenNode
Definition: GUINode.h:147
GUINode_RequestedConstraints requestedConstraints
Definition: GUINode.h:151
GUINode_Alignments alignments
Definition: GUINode.h:150
GUINodeConditions showOn
Definition: GUINode.h:161
GUINode_Flow * flow
Definition: GUINode.h:86
GUI parent node base class thats supporting child nodes.
Definition: GUIParentNode.h:42
GUI screen node that represents a screen that can be rendered via GUI system.
Definition: GUIScreenNode.h:72
static GUINode_Clipping createClipping(const string &allClipping, const string &left, const string &top, const string &right, const string &bottom)
Create clipping.
void setEffectColorMul(const GUIColor &effectColorMul)
Set effect color mul.
void dispose() override
Dispose node.
void setMaskMaxValue(float maskMaxValue)
Set maximum value of mask to display image.
static RequestedDimensionConstraints createRequestedDimensionConstraints(const string &width, const string &height)
Create requested dimension constraints.
GUITextureBaseNode(GUIScreenNode *screenNode, GUIParentNode *parentNode, const string &id, GUINode_Flow *flow, const GUINode_Alignments &alignments, const GUINode_RequestedConstraints &requestedConstraints, const GUIColor &backgroundColor, const string &backgroundImage, const GUINode_Scale9Grid &backgroundImageScale9Grid, const GUIColor &backgroundImageEffectColorMul, const GUIColor &backgroundImageEffectColorAdd, const GUINode_Border &border, const GUINode_Padding &padding, const GUINodeConditions &showOn, const GUINodeConditions &hideOn, const string &tooltip, const RequestedDimensionConstraints &requestedDimensionConstraints, bool mirrorX, bool mirrorY, const GUIColor &effectColorMul, const GUIColor &effectColorAdd, const GUINode_Scale9Grid &scale9Grid, const GUINode_Clipping &clipping, const string &mask, float maskMaxValue)
Constructor.
const string getNodeType() override=0
void setMask(const string &mask)
Set mask source.
virtual void onRenderTexture()
On render texture event.
RequestedDimensionConstraints requestedDimensionConstraints
void render(GUIRenderer *guiRenderer) override
Render.
void setEffectColorAdd(const GUIColor &effectColorAdd)
Set effect color add.
void setTextureMatrix(const Matrix3x3 &textureMatrix)
Set texture matrix.
Matrix3x3 class representing matrix3x3 mathematical structure and operations for 2d space.
Definition: Matrix3x3.h:20
GUI node border entity.
GUI node clipping entity.
GUI node padding entity.
GUI node scale 9 grid entity.
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6