class
GUIContentSprites
Wrapper around Sprite that helps construct a sprite for drawing a GUI element with text and/or image contents.
Public
Methods
BuildRenderElements
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
Builds a struct used for initializing the text sprite required for rendering the provided contents within the provided bounds.
SetAnimationStartTime
Updates the animation start time (in seconds since application start), in case the content image contains an animated sprite.
GetImageSprite
Returns the image sprite.
Note the sprite is only initialized/updated after a call to BuildRenderElements().
GetTextSprite
Returns the text sprite.
Note the sprite is only initialized/updated after a call to BuildRenderElements().
Private
Methods
staticCalculateScaledImageSize
Calculates the size of the provided image so it fits in the provided , while preserving aspect ratio of the image.
staticCalculateContentBounds
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.