RSX Code Reference
    Preparing search index...

    Class UIUtility

    Various helper functionality that's useful when creating UI elements.

    Index
    • Parameters

      • OptionalisInternalConstructor: boolean

      Returns UIUtility

    • Calculates optimal size of a UI element. This is the size that allows the UI element to properly display all of its content.

      Parameters

      Returns Vector2

    • Calculates size hint for the provided text using the provided font and size. Size is calculated without word wrap.

      Parameters

      • text: string

        Text to calculate the size for.

      • font: Font | ResourceHandle<Font>

        Font to use for rendering the text.

      • fontSize: number

        Size of individual characters in the font, in points.

      • OptionalmaximumWidthInPixels: number

        The maximum width in pixels.

      Returns Vector2

      Width/height required to display the text, in pixels.

    • Generates the lorem impsum place holder text with the specified number of words.

      Parameters

      • wordCount: number

      Returns string

    • Scales a point value by using the element's DPI scale to the current pixel value.

      Parameters

      • element: UIElementBase

        The element to scale a value for. This element must be attached to a valid widget in order to retrieve the scale factor. If the element is not attached to a widget, no scaling is performed.

      • valueInPoints: number

        The value to be scaled. This will effectively multiply the value by the widget scale factor.

      Returns number

      The value in pixels.

    • Converts a pixel value to points by using the element's DPI scale.

      Parameters

      • element: UIElementBase

        The element to scale a value for. This element must be attached to a valid widget in order to retrieve the scale factor. If the element is not attached to a widget, no scaling is performed.

      • valueInPixels: number

        The value to be scaled. This will effectively multiply the value by the widget scale factor.

      Returns number

      The value in points.