Skip to Content
defold-typescript libraries
britzldefold-metrics

britzl/defold-metrics/metrics.mem

Calculate and display performance metrics in Defold games

  • GitHub: britzl/defold-metrics — pinned to 1.2.1
    1. Pick a release from britzl/defold-metrics releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as mem from "metrics.mem"

Functions

create(format?: string, position?: Vector3, color?: Vector4): Metrics

Parameters

  • format?: string
  • position?: Vector3
  • color?: Vector4

Returns

  • Metrics

update()

Call this to get a new memory usage reading.

mem(): number

Get the current memory usage, in kilobytes.

Returns

  • number

draw()

Draw memory usage text using draw_debug_text.

Variables

POSITION: Vector3

Where draw() places the text, and the default create() uses when given no position.

FORMAT: string

The string.format pattern the memory reading is rendered through.

COLOR: Vector4

The colour draw() renders the text in, and the default create() uses when given no colour.

Types

Metrics

Metrics.mem: () => number

Metrics.update: () => void

Metrics.draw: () => void

On this page