Options
All
  • Public
  • Public/Protected
  • All
Menu
class

Visual map display

Hierarchy

  • Display

Index

Constructors

constructor

Properties

_backend

_backend: Backend

_data

_data: object

Type declaration

_dirty

_dirty: boolean | object

_options

_options: DisplayOptions

Static Hex

Hex: Hex = Hex

Static Rect

Rect: Rect = Rect

Static Term

Term: Term = Term

Static Tile

Tile: Tile = Tile

Static TileGL

TileGL: TileGL = TileGL

Methods

DEBUG

  • DEBUG(x: number, y: number, what: number): void
  • Debug helper, ideal as a map generator callback. Always bound to this.

    Parameters

    • x: number
    • y: number
    • what: number

    Returns void

_draw

  • _draw(key: string, clearBefore: boolean): void
  • Parameters

    • key: string

      What to draw

    • clearBefore: boolean

      Is it necessary to clean before?

    Returns void

_tick

  • _tick(): void

clear

  • clear(): void

computeFontSize

  • computeFontSize(availWidth: number, availHeight: number): number
  • Compute the maximum font size to fit into a set of given constraints

    Parameters

    • availWidth: number

      Maximum allowed pixel width

    • availHeight: number

      Maximum allowed pixel height

    Returns number

    fontSize

computeSize

  • computeSize(availWidth: number, availHeight: number): [number, number]
  • Compute the maximum width/height to fit into a set of given constraints

    Parameters

    • availWidth: number

      Maximum allowed pixel width

    • availHeight: number

      Maximum allowed pixel height

    Returns [number, number]

    cellWidth,cellHeight

computeTileSize

  • computeTileSize(availWidth: number, availHeight: number): number[]

draw

  • draw(x: number, y: number, ch: string | string[] | null, fg: string | null, bg: string | null): void
  • Parameters

    • x: number
    • y: number
    • ch: string | string[] | null

      One or more chars (will be overlapping themselves)

    • fg: string | null
    • bg: string | null

    Returns void

drawOver

  • drawOver(x: number, y: number, ch: string | null, fg: string | null, bg: string | null): void
  • Parameters

    • x: number
    • y: number
    • ch: string | null

      One or more chars (will be overlapping themselves)

    • fg: string | null
    • bg: string | null

    Returns void

drawText

  • drawText(x: number, y: number, text: string, maxWidth?: undefined | number): number
  • Draws a text at given position. Optionally wraps at a maximum length. Currently does not work with hex layout.

    Parameters

    • x: number
    • y: number
    • text: string

      May contain color/background format specifiers, %c{name}/%b{name}, both optional. %c{}/%b{} resets to default.

    • Optional maxWidth: undefined | number

    Returns number

    lines drawn

eventToPosition

  • eventToPosition(e: TouchEvent | MouseEvent): [number, number]
  • Convert a DOM event (mouse or touch) to map coordinates. Uses first touch for multi-touch.

    Parameters

    • e: TouchEvent | MouseEvent

      event

    Returns [number, number]

    -1 for values outside of the canvas

getContainer

  • getContainer(): null | HTMLElement

getOptions

setOptions

Generated using TypeDoc