Foundation.SpriteProfileRenderer

Draws debug outlines and points for sprites and particle emitters. For sprites, a SpriteProfileRenderer will draw bounding outlines and points, vertex outlines and points, origin point, and collider shapes.

This is a convenience element for debugging, it is in no way optimized (expect it to eat a significant portion of your game loop, and to kill your frame rate if you have a large number of sprites).


Example

// Create a default game prefab
var game = Foundation.Game.createDefaultPrefab();

// Add the sprite profiler renderer to the game
game.add('DebugDrawer', new Foundation.SpriteProfileRenderer(
  <Foundation.OrderedUpdateDictionary<Layer>>game['layers'],
  <Foundation.Camera>game['camera'],
  game.HTMLContainer 
));


Implementation Details

Reference paths

  • '/foundation/_digest.ts'
  • '/foundation/core/debugging/_digest.ts'
  • '/foundation/core/debugging/SpriteProfileRenderer.ts'

Extends

This type extends:

Implements

This type does not implement any interfaces


Public Properties

boundsOutlineColor: Color

  • Defaults to Color.yellow.

boundsPointColor: Color

  • Defaults to Color.yellow.

vertsOutlineColor: Color

  • Defaults to Color.red.

vertsPointColor: Color

  • Defaults to Color.red.

originPointColor: Color

  • Defaults to Color.white.

inactiveBoundsColor: Color

  • Defaults to Color(0, 0, 0, 50).

colliderFillColor: Color

  • Defaults to Color(0, 255, 0, 128).

emitterOutlineColor: Color

  • Defaults to Color(255, 255, 255, 128).

emitterPointColor: Color

  • Defaults to Color(255, 255, 255, 64).

boundsPointSize: number

  • Defaults to 6.

vertsPointSize: number

  • Defaults to 4.

originPointSize: number

  • Defaults to 6.

Constructors

(layers: OrderedUpdateDictionary<Layer>, camera: Camera, container: HTMLElement)

  • Pass a list of layers to draw (only emitter and sprite types will be drawn), also pass the game camera and the HTML container for the game.