Constructor
new DebugRender(Game)
Creates a debug rendering context for the game.
Parameters:
Name | Type | Description |
---|---|---|
Game | Game | Game to render debug info for |
- Source
Members
enabled :object
What is rendered
- enabled.wireframes - Shows wireframes of all physics bodies
- enabled.collisions - Shows collision points and normals
- enabled.boundingBox - Shows AABB bounding boxes for physics bodies
- enabled.centers - Shows center of mass of all physics bodies
- enabled.broadphase - Shows active non-static broadphase grids cells
Type:
- object
- Source
- To Do
- Add methods for setting these, possibly also in Game
// All options:
game.DebugRender.enabled = {
wireframes: true,
centers: true,
collisions: true,
broadphase: true,
boundingBox: true,
}
Methods
on(event, callback)
Bind a callback to an event
Parameters:
Name | Type | Description |
---|---|---|
event | string | Name of the event |
callback | function | Callback run when event is fired |
- Source
off(event, callback)
Unbinds a callback from an event
Parameters:
Name | Type | Description |
---|---|---|
event | string | Name of the event |
callback | function | Function to unbind |
- Source
trigger(event, …args)
Triggers an event, firing all bound callbacks
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
event | string | Name of the event | |
args | * | <repeatable> | Arguments passed to callbacks |
- Source