ThreeDDice Class

Hierarchy

  • ThreeDDice

Properties

DICE_ON_TABLE_LIMIT: number = 25

Limit of 3D dice to allow on table at any one time

DefaultConfig: IEngineConfig = ...

Default Config

API Connection

Available after calling connect

Constructors

  • Constructor

    Parameters

    • canvas: HTMLCanvasElement

      Canvas element

    • Optional apiKey: string

      Required if connecting to the dddice API

    • Optional config: Partial<IEngineConfig>

      Optional configuration to change the look and feel of the renderer

    Returns ThreeDDice

Methods

  • Check if WebGL is available

    Returns boolean

  • Clear all dice from canvas

    Returns void

  • Connect to the live server and begin listening to room events.

    If called more than once, this method does nothing.

    Note: Your user must be a participant in a room in order to listen to events, otherwise an error is thrown.

    Parameters

    • roomSlug: string

      Room slug to listen on

    • Optional roomPasscode: string

      Private passcode to access room

    Returns ThreeDDice

  • Return all loaded themes

    Returns ITheme[]

  • Pause camera controls

    Returns void

  • Resize canvas

    Parameters

    • width: number

      Width of canvas in pixels

    • height: number

      Height of canvas in pixels

    Returns ThreeDDice

  • Resume camera controls

    Returns void

  • Roll dice using the dddice API. This method submits the roll to the server to be distributed to all room participants.

    Throws

    APIError if connect not called previously

    Parameters

    Returns void

  • Screenshot the canvas

    Returns

    screenshot as a DataURI

    Parameters

    • mimeType: string

      image format mime type of the generated screenshot.

    Returns string

  • Change the hidden state of dice given UUIDs

    Returns

    void

    Parameters

    • uuids: string[]

      array of dice uuids

    Returns void

Accessors

  • get height(): number
  • Canvas Height

    Returns number

  • get version(): string
  • Get the current version of dddice

    Returns string

  • get width(): number
  • Canvas width

    Returns number

Generated using TypeDoc