Construct and initialize the object
Optional
canvas: HTMLCanvasElementCanvas element
Optional
apiKey: stringRequired if connecting to the dddice API
Optional
config: Partial<IEngineConfig>Optional configuration to change the look and feel of the renderer
Static
DefaultDefault Config
Optional
apiAPI Connection
Available after calling connect
Optional
apiAPI Key
Optional
canvasCanvas
Get mouse/pointer controls enabled
Set mouse/pointer controls enabled
Canvas Height
Get if a roll is currently animating
Get the number of dice currently being rendered
Get the current version of dddice
Canvas width
Static
isConnect to the live server and begin listening to room events.
Note: Your user must be a participant in a room in order to listen to events, otherwise an error is thrown.
Room slug to listen on
Optional
roomPasscode: stringPrivate passcode to access room
Optional
userUuid: stringPersonal User UUID to listen to whispers
Connect to the live server and begin listening to room events.
Note: Your user must be a participant in a room in order to listen to events, otherwise an error is thrown.
Manually trigger an event
The event to dispatch
Rest
...params: any[]Initialize object if the default constructor had been called
Optional
canvas: HTMLCanvasElementCanvas element
Optional
apiKey: stringRequired if connecting to the dddice API
Optional
config: Partial<IEngineConfig>Optional configuration to change the look and feel of the renderer
Optional
appName: stringOptional name to identify which application is connecting to dddice
Limit which participant events are executed This is useful for filtering dice rolls to a select group of players per instance (i.e. creating dice trays)
The participant IDs of the room
Load a theme, including shaders, into the engine
Remove callback from event
The event to stop listening to
Listen for an event and execute a callback.
The event to listen on
The function to execute when the event is fired
Pick up dice belonging to a particular user
This clears all dice rolled by the specified from the board and uses the API to notify clear those dice from the board's of all connected users
uuid of the user whose dice to clear
void
Pick up dice
This clears certain dice from the board and updates the API
void
Load assets for a loaded theme
This loads all meshes, textures, and sounds for a dice theme. Calling this multiple times will debounce the loading processing for 50ms
Returns a list of items to be queued
Resize canvas
Width of canvas in pixels
Height of canvas in pixels
Roll dice using the dddice API. This method submits the roll to the server to be distributed to all room participants.
Optional
options: IDiceRollOptionsSet configuration
Start the renderer
Stop the renderer
Change the hidden state of a roll
Optionally pass the uuids of specific dice to only unhide those dice, otherwise all dice in the roll will be revealed.
IRoll Roll to unhide
Optional array of dice uuids
void
Generated using TypeDoc
ThreeDDice Class