class GUIContentSprites

Wrapper around Sprite that helps construct a sprite for drawing a GUI element with text and/or image contents.

Public

Methods

BuildRenderElements

void BuildRenderElements(const GUIContentSpriteCreateInformation &createInformation, TInlineArray<GUIRenderElement, 4> &outRenderElements)

Builds the background render elements and appends them to the render elements array.

createInformation
Information about the sprites to build render elements for.
outRenderElements
Array to which the generated render element will be appended to.

staticBuildTextSpriteInformation

static TextSpriteInformation BuildTextSpriteInformation(const Area2I &contentArea, const String &text, const GUIStyleSheetRules &rules, const Color &tint, float fontScale = 1.F, bool wordWrap = false)

Builds a struct used for initializing the text sprite required for rendering the provided contents within the provided bounds.

SetAnimationStartTime

void SetAnimationStartTime(float time)

Updates the animation start time (in seconds since application start), in case the content image contains an animated sprite.

GetImageSprite

const ImageSprite &GetImageSprite() const

Returns the image sprite.

Note the sprite is only initialized/updated after a call to BuildRenderElements().

GetTextSprite

const TextSprite &GetTextSprite() const

Returns the text sprite.

Note the sprite is only initialized/updated after a call to BuildRenderElements().

Private

Methods

staticCalculateScaledImageSize

static Size2I CalculateScaledImageSize(const HSpriteImage &image, const Size2I &size)

Calculates the size of the provided image so it fits in the provided , while preserving aspect ratio of the image.

staticCalculateContentBounds

static void CalculateContentBounds(const Area2I &contentArea, const Size2UI &imageSize, const Size2UI &textSize, GUIImagePosition imagePosition, Area2 &outTextBounds, Area2 &outImageBounds)

Calculates the bounds at which to place text and/or image sprites.

contentArea
Content area of the GUI element. Both text and image must fit in this area.
imageSize
Size of the image sprite.
textSize
Size of the text sprite.
imagePosition
Position of the image relative to the text.
outTextBounds
Position of the text sprite, relative to the GUI element.
outImageBounds
Position of the image sprite, relative to the GUI element.

Fields

mContentImageSprite

ImageSprite mContentImageSprite

mContentTextSprite

TextSprite mContentTextSprite

mContentImageSpriteInformation

ImageSpriteInformation mContentImageSpriteInformation

mContentTextSpriteInformation

TextSpriteInformation mContentTextSpriteInformation