@kognifai/cogsengine
    Preparing search index...

    Class TextComponent

    Renders the given text(s) by generating sprites.

    Hierarchy (View Summary)

    Index

    Constructors

    • Internal: Component constructor

      Parameters

      • type: string

        type of the component. Ex. "TransformComponent"

      • entity: Entity

        Owning entity. Entity only passed when wrapping existing entity.

      Returns TextComponent

    Properties

    color: vec4

    Single color value to apply to all text strings.

    colors: Float32Array

    (Contents: vec4[]) Colors for individual strings in text. If colors contains the same number of elements as texts, each text string is rendered using the corresponding color. If not, the field color is used.

    horizontalJustification: HorizontalJustification

    Horizontal justification of the text.

    isTyped: boolean

    Internal flag set if component is a Cogs Core component.

    positioningMode: PositionMode
    positions: Float32Array

    (Contents: vec3[]) Offset positions for each of the strings in texts. If positions is empty, all texts will be rendered at the position given by TransformComponent. If positions contains the same number of elements as texts, each text string is rendered using the corresponding position offset.

    texts: string[]

    A set of text strings to render. The text is positioned on the screen according to the position given by the TransformComponent and the positioningMode field. All the texts are rendered using the same font, positioning mode, alignment and justification. However, color and position can vary according to the positions and color arrays.

    verticalAlignment: VerticalAlignment

    Vertical alignment of the text.

    Accessors

    • get entity(): Entity

      Gets the optional owning entity

      Returns Entity

    • set entity(entity: Entity): void

      Internal: set owning entity.

      Parameters

      Returns void

    • get name(): string

      Component name == type. For compatibility

      Returns string

    • get type(): string

      Gets the type of the component. Ex. "TransformComponent", "SceneComponent" etc.

      Returns string

    Methods

    • Internal: Creates a new component of the given type (name). Component is wrapped when adding to an entity.

      Parameters

      • type: string

        Type of the component. Ex. "TransformComponent"

      Returns Component

      Created Cogs.js component.

    • Internal: Creates a new component being wrapped as an existing member of the entity

      Parameters

      • type: string

        Type of the component. Ex. "TransformComponent"

      • entity: Entity

        The owning entity

      Returns Component

      Created Cogs.js component.