Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebGLTerminalCanvas

A write-only terminal canvas that uses the 2d canvas text rendering APIs to display text.

Hierarchy

  • WebGLTerminalCanvas

Index

Constructors

Methods

Constructors

constructor

Methods

set

  • set(left: number, top: number, char: string, foreground: string, background: string): void
  • Set a cell of the terminal canvas to a given character, foreground color, and background color. For WebGLTerminalCanvas, this immediately renders the character to the canvas.

    Parameters

    • left: number

      The logical X coordinate of the character cell to render to. 0 is the leftmost column.

    • top: number

      The logical Y coordinate of the character cell to render to. 0 is the topmost row.

    • char: string

      The character to render to the cell. Technically, you could pass a whole string here, but it will be centered within and clipped to the cell boundaries.

    • foreground: string

      A foreground style string such as '#FFF' to render the character with.

    • background: string

      A background style string such as '#000' to fill the background of the cell with. This is expected to be an opaque color.

    Returns void

tryRender

  • tryRender(): boolean
  • Render to the underlying canvas. May fail (and return false) if the font hasn't been loaded yet. You can simply retry on another frame if this occurs. Will return true on success.

    Returns boolean

Generated using TypeDoc