40 GUITextureBaseNode::GUITextureBaseNode(
48 const string& backgroundImage,
50 const GUIColor& backgroundImageEffectColorMul,
51 const GUIColor& backgroundImageEffectColorAdd,
56 const string& tooltip,
66 GUINode(screenNode, parentNode, id, flow, alignments, requestedConstraints, backgroundColor, backgroundImage, backgroundImageScale9Grid, backgroundImageEffectColorMul, backgroundImageEffectColorAdd, border, padding, showOn, hideOn, tooltip)
133 auto renderAreaLeft = ((left) / (screenWidth / 2.0f)) - renderOffsetXCurrent - 1.0f;
134 auto renderAreaTop = ((screenHeight - top) / (screenHeight / 2.0f)) + renderOffsetYCurrent - 1.0f;
135 auto renderAreaRight = ((left + width) / (screenWidth / 2.0f)) - renderOffsetXCurrent - 1.0f;
136 auto renderAreaBottom = ((screenHeight - top - height) / (screenHeight / 2.0f)) + renderOffsetYCurrent - 1.0f;
164 ((left) / (screenWidth / 2.0f)) - 1.0f,
165 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
166 1.0f, 1.0f, 1.0f, 1.0f,
169 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
170 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
171 1.0f, 1.0f, 1.0f, 1.0f,
174 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
175 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
176 1.0f, 1.0f, 1.0f, 1.0f,
179 ((left) / (screenWidth / 2.0f)) - 1.0f,
180 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
181 1.0f, 1.0f, 1.0f, 1.0f,
216 float imageScreenScale9Left = imageScreenLeft + scaledScale9Grid.
left;
217 float imageScreenScale9Top = imageScreenTop + scaledScale9Grid.
top;
220 float imageScreenScale9Right = imageScreenLeft + imageScreenWidth - scaledScale9Grid.
right;
221 float imageScreenScale9Bottom = imageScreenTop + imageScreenHeight - scaledScale9Grid.
bottom;
225 if (scaledScale9Grid.
left > 0 && scaledScale9Grid.
top > 0) {
226 float left = imageScreenLeft;
227 float top = imageScreenTop;
228 float width = scaledScale9Grid.
left;
229 float height = scaledScale9Grid.
top;
231 ((left) / (screenWidth / 2.0f)) - 1.0f,
232 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
233 1.0f, 1.0f, 1.0f, 1.0f,
236 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
237 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
238 1.0f, 1.0f, 1.0f, 1.0f,
241 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
242 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
243 1.0f, 1.0f, 1.0f, 1.0f,
246 ((left) / (screenWidth / 2.0f)) - 1.0f,
247 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
248 1.0f, 1.0f, 1.0f, 1.0f,
254 if (scaledScale9Grid.
top > 0) {
255 float left = imageScreenScale9Left;
256 float top = imageScreenTop;
257 float width = imageScreenWidth - scaledScale9Grid.
left - scaledScale9Grid.
right;
258 float height = scaledScale9Grid.
top;
260 ((left) / (screenWidth / 2.0f)) - 1.0f,
261 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
262 1.0f, 1.0f, 1.0f, 1.0f,
265 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
266 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
267 1.0f, 1.0f, 1.0f, 1.0f,
270 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
271 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
272 1.0f, 1.0f, 1.0f, 1.0f,
275 ((left) / (screenWidth / 2.0f)) - 1.0f,
276 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
277 1.0f, 1.0f, 1.0f, 1.0f,
283 if (scaledScale9Grid.
right > 0 && scaledScale9Grid.
top > 0) {
284 float left = imageScreenScale9Right;
285 float top = imageScreenTop;
286 float width = scaledScale9Grid.
right;
287 float height = scaledScale9Grid.
top;
289 ((left) / (screenWidth / 2.0f)) - 1.0f,
290 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
291 1.0f, 1.0f, 1.0f, 1.0f,
294 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
295 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
296 1.0f, 1.0f, 1.0f, 1.0f,
299 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
300 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
301 1.0f, 1.0f, 1.0f, 1.0f,
304 ((left) / (screenWidth / 2.0f)) - 1.0f,
305 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
306 1.0f, 1.0f, 1.0f, 1.0f,
312 if (scaledScale9Grid.
right > 0 && scaledScale9Grid.
bottom > 0) {
313 float left = imageScreenScale9Right;
314 float top = imageScreenScale9Bottom;
315 float width = scaledScale9Grid.
right;
316 float height = scaledScale9Grid.
bottom;
318 ((left) / (screenWidth / 2.0f)) - 1.0f,
319 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
320 1.0f, 1.0f, 1.0f, 1.0f,
323 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
324 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
325 1.0f, 1.0f, 1.0f, 1.0f,
328 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
329 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
330 1.0f, 1.0f, 1.0f, 1.0f,
333 ((left) / (screenWidth / 2.0f)) - 1.0f,
334 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
335 1.0f, 1.0f, 1.0f, 1.0f,
341 if (scaledScale9Grid.
bottom > 0) {
342 float left = imageScreenScale9Left;
343 float top = imageScreenScale9Bottom;
344 float width = imageScreenWidth - scaledScale9Grid.
left - scaledScale9Grid.
right;
345 float height = scaledScale9Grid.
bottom;
347 ((left) / (screenWidth / 2.0f)) - 1.0f,
348 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
349 1.0f, 1.0f, 1.0f, 1.0f,
352 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
353 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
354 1.0f, 1.0f, 1.0f, 1.0f,
357 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
358 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
359 1.0f, 1.0f, 1.0f, 1.0f,
362 ((left) / (screenWidth / 2.0f)) - 1.0f,
363 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
364 1.0f, 1.0f, 1.0f, 1.0f,
370 if (scaledScale9Grid.
left > 0 && scaledScale9Grid.
bottom > 0) {
371 float left = imageScreenLeft;
372 float top = imageScreenScale9Bottom;
373 float width = scaledScale9Grid.
left;
374 float height = scaledScale9Grid.
bottom;
376 ((left) / (screenWidth / 2.0f)) - 1.0f,
377 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
378 1.0f, 1.0f, 1.0f, 1.0f,
381 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
382 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
383 1.0f, 1.0f, 1.0f, 1.0f,
386 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
387 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
388 1.0f, 1.0f, 1.0f, 1.0f,
391 ((left) / (screenWidth / 2.0f)) - 1.0f,
392 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
393 1.0f, 1.0f, 1.0f, 1.0f,
399 if (scaledScale9Grid.
left > 0) {
400 float left = imageScreenLeft;
401 float top = imageScreenScale9Top;
402 float width = scaledScale9Grid.
left;
403 float height = imageScreenHeight - scaledScale9Grid.
top - scaledScale9Grid.
bottom;
405 ((left) / (screenWidth / 2.0f)) - 1.0f,
406 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
407 1.0f, 1.0f, 1.0f, 1.0f,
410 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
411 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
412 1.0f, 1.0f, 1.0f, 1.0f,
415 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
416 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
417 1.0f, 1.0f, 1.0f, 1.0f,
420 ((left) / (screenWidth / 2.0f)) - 1.0f,
421 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
422 1.0f, 1.0f, 1.0f, 1.0f,
428 if (scaledScale9Grid.
right > 0) {
429 float left = imageScreenScale9Right;
430 float top = imageScreenScale9Top;
431 float width = scaledScale9Grid.
right;
432 float height = imageScreenHeight - scaledScale9Grid.
top - scaledScale9Grid.
bottom;
434 ((left) / (screenWidth / 2.0f)) - 1.0f,
435 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
436 1.0f, 1.0f, 1.0f, 1.0f,
439 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
440 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
441 1.0f, 1.0f, 1.0f, 1.0f,
444 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
445 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
446 1.0f, 1.0f, 1.0f, 1.0f,
449 ((left) / (screenWidth / 2.0f)) - 1.0f,
450 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
451 1.0f, 1.0f, 1.0f, 1.0f,
458 float left = imageScreenScale9Left;
459 float top = imageScreenScale9Top;
460 float width = imageScreenWidth - scaledScale9Grid.
left - scaledScale9Grid.
right;
461 float height = imageScreenHeight - scaledScale9Grid.
top - scaledScale9Grid.
bottom;
463 ((left) / (screenWidth / 2.0f)) - 1.0f,
464 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
465 1.0f, 1.0f, 1.0f, 1.0f,
468 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
469 ((screenHeight - top) / (screenHeight / 2.0f)) - 1.0f,
470 1.0f, 1.0f, 1.0f, 1.0f,
473 ((left + width) / (screenWidth / 2.0f)) - 1.0f,
474 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
475 1.0f, 1.0f, 1.0f, 1.0f,
478 ((left) / (screenWidth / 2.0f)) - 1.0f,
479 ((screenHeight - top - height) / (screenHeight / 2.0f)) - 1.0f,
480 1.0f, 1.0f, 1.0f, 1.0f,
540 Engine::getInstance()->getTextureManager()->removeTexture(
maskTexture->
getId());
550 if (width.empty() ==
false) {
551 if (StringTools::endsWith(width,
"%")) {
552 constraints.
horizontalScale = Float::parse(width.substr(0, width.length() - 1)) / 100.0f;
557 if (height.empty() ==
false) {
558 if (StringTools::endsWith(height,
"%")) {
559 constraints.
verticalScale = Float::parse(height.substr(0, height.length() - 1)) / 100.0f;
const string & getId() const
GUI element node conditions.
GUI node requested constraints requested constraints type enum.
static STATIC_DLL_IMPEXT GUINode_RequestedConstraints_RequestedConstraintsType * AUTO
virtual void render(GUIRenderer *guiRenderer)
Render.
static int getRequestedPixelValue(const string &value, int defaultValue)
Get requested pixel value.
GUINode_ComputedConstraints computedConstraints
GUIScreenNode * screenNode
GUINode_RequestedConstraints requestedConstraints
bool shouldRender()
Returns if to render.
virtual void dispose()
Dispose node.
GUI parent node base class thats supporting child nodes.
GUI screen node that represents a screen that can be rendered via GUI system.
Texture * getImage(const string &fileName)
Get image.
Matrix3x3 mirrorTextureMatrix
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.
int getContentWidth() override
static RequestedDimensionConstraints createRequestedDimensionConstraints(const string &width, const string &height)
Create requested dimension constraints.
const GUIColor & getEffectColorMul()
int getContentHeight() override
GUINode_Scale9Grid scale9Grid
GUINode_Clipping clipping
void setMask(const string &mask)
Set mask source.
virtual void onRenderTexture()
On render texture event.
RequestedDimensionConstraints requestedDimensionConstraints
const GUIColor & getEffectColorAdd()
void render(GUIRenderer *guiRenderer) override
Render.
bool isContentNode() override
void setEffectColorAdd(const GUIColor &effectColorAdd)
Set effect color add.
GUINode_Clipping & getClipping()
void setTextureMatrix(const Matrix3x3 &textureMatrix)
Set texture matrix.
void setSubRenderAreaBottom(float renderAreaBottom)
Set sub render area bottom.
void setMaskMaxValue(float maskMaxValue)
Set mask max value.
void setTexureMatrix(const Matrix3x3 &textureMatrix)
Set texture matrix.
void bindTexture(int32_t textureId)
Bind texture.
void setSubRenderAreaRight(float renderAreaRight)
Set sub render area right.
void setSubRenderAreaLeft(float renderAreaLeft)
Set sub render area left.
void setEffectColorAdd(const GUIColor &color)
Set effect color add.
void setSubRenderAreaTop(float renderAreaTop)
Set sub render area top.
void setEffectColorMul(const GUIColor &color)
Set effect color mul.
void bindMask(int32_t textureId)
Bind mask texture.
void addQuad(float x1, float y1, float colorR1, float colorG1, float colorB1, float colorA1, float tu1, float tv1, float x2, float y2, float colorR2, float colorG2, float colorB2, float colorA2, float tu2, float tv2, float x3, float y3, float colorR3, float colorG3, float colorB3, float colorA3, float tu3, float tv3, float x4, float y4, float colorR4, float colorG4, float colorB4, float colorA4, float tu4, float tv4, bool solidColor=false, bool rotated=false)
Add quad Note: quad vertices order 1 2 +-—+ | | | | +-—+ 4 3.
Matrix3x3 class representing matrix3x3 mathematical structure and operations for 2d space.
Matrix3x3 & identity()
Creates identity matrix.
Matrix3x3 & set(float r0c0, float r0c1, float r0c2, float r1c0, float r1c1, float r1c2, float r2c0, float r2c1, float r2c2)
Sets this matrix by its components.
Matrix3x3 & setTranslation(const Vector2 &vector2)
Sets translation in matrix.
Matrix3x3 & scale(float scalar)
Scales by scalar.
Matrix3x3 & multiply(const Matrix3x3 &matrix)
Multiplies this matrix with given matrix.
Vector2 class representing vector2 mathematical structure and operations with x, y components.
GUI node clipping entity.
GUI node computed constraints.
int additionalAlignmentLeft
int additionalAlignmentTop
GUI node requested constraints entity.
GUINode_RequestedConstraints_RequestedConstraintsType * widthType
GUINode_RequestedConstraints_RequestedConstraintsType * heightType
GUI node scale 9 grid entity.