DrawableText

Extends: Drawable

Class to draw text

Properties

  • text (string) — The text to write on the screen
  • font (roFont) — The Font object to use ( get this from the font registry)
  • alignment (BGE.UI.HorizAlignment) — The Horizontal alignment for the text
  • textColor (integer) — The color the text is drawn in
  • lastTextValue (string)
  • lastTextColor (integer)
  • tempCanvas (roBitmap)
  • tempRegion (roRegion)
  • lastAlignment (BGE.UI.HorizAlignment)

Constructor

new DrawableText( owner: GameEntity, text?: string, font?: roFont, args?: roAssociativeArray, ): DrawableText

Parameters

  • owner (GameEntity)
  • text (string, optional, default: "\"\"")
  • font (roFont, optional, default: "invalid")
  • args (roAssociativeArray, optional, default: "{}")

Instance Methods

addToScene(rendererObj: Renderer): BGE.SceneObject

Parameters

Returns

getTextImage(): roRegion

Returns

  • roRegion

update(): void

alignment is a plain public field, so a direct assignment can't be intercepted - this dirty-checks it each frame and syncs it into the unified anchor mechanism (see Drawable.setAnchor), the same idiom this codebase uses for Camera3d.fieldOfViewDegrees.

Returns

  • void