new Debug(game)
A collection of methods for displaying debug information about game objects. Phaser.Debug requires a CANVAS game type in order to render, so if you've got your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL doesn't kick in, then the Debug functions will all display.
Parameters:
| Name | Type | Description |
|---|---|---|
game |
Phaser.Game | A reference to the currently running game. |
- Source:
Members
-
columnWidth
-
- Source:
Properties:
Name Type Description columnWidthnumber The spacing between columns.
-
context
-
- Source:
Properties:
Name Type Description contextContext The canvas context on which to render the debug information.
-
currentAlpha
-
- Default Value:
- 1
- Source:
Properties:
Name Type Description currentAlphanumber The current alpha the debug information will be rendered at.
-
currentX
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description currentXContext The current X position the debug information will be rendered at.
-
currentY
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description currentYnumber The current Y position the debug information will be rendered at.
-
font
-
- Default Value:
- '14px Courier'
- Source:
Properties:
Name Type Description fontstring The font that the debug information is rendered in.
-
game
-
- Source:
Properties:
Name Type Description gamePhaser.Game A reference to the currently running Game.
-
lineHeight
-
- Source:
Properties:
Name Type Description lineHeightnumber The line height between the debug text.
-
renderShadow
-
- Source:
Properties:
Name Type Description renderShadowboolean Should the text be rendered with a slight shadow? Makes it easier to read on different types of background.
Methods
-
line(text, x, y)
-
Internal method that outputs a single line of text.
Parameters:
Name Type Argument Description textstring The line of text to draw.
xnumber <optional>
The X value the debug info will start from.
ynumber <optional>
The Y value the debug info will start from.
- Source:
-
renderBodyInfo(sprite, x, y, color)
-
Render Sprite Body Physics Data as text.
Parameters:
Name Type Argument Default Description spritePhaser.Sprite The sprite to be rendered.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderCameraInfo(camera, x, y, color)
-
Render camera information including dimensions and location.
Parameters:
Name Type Argument Default Description cameraPhaser.Camera Description.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderCircle(circle, color)
-
Renders a Circle.
Parameters:
Name Type Argument Description circlePhaser.Circle The Circle to render.
colorstring <optional>
Color of the debug info to be rendered (format is css color string).
- Source:
-
renderInputInfo(x, y, color)
-
Render debug information about the Input object.
Parameters:
Name Type Argument Default Description xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderLine(line, color)
-
Renders a Line object in the given color.
Parameters:
Name Type Argument Default Description linePhaser.Line The Line to render.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderLineInfo(line, x, y, color)
-
Renders Line information in the given color.
Parameters:
Name Type Argument Default Description linePhaser.Line The Line to render.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderPhysicsBody(body, color)
-
Parameters:
Name Type Argument Default Description bodyPhaser.Body The Phaser.Body instance to render all shapes from.
colorstring <optional>
'rgb(255,255,255)' The color the polygon is stroked in.
- Source:
-
renderPixel(x, y, color)
-
Renders a single pixel.
Parameters:
Name Type Argument Description xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
Color of the debug info to be rendered (format is css color string).
- Source:
-
renderPoint(point, color)
-
Renders a Point object.
Parameters:
Name Type Argument Description pointPhaser.Point The Point to render.
colorstring <optional>
Color of the debug info to be rendered (format is css color string).
- Source:
-
renderPointer(pointer, hideIfUp, downColor, upColor, color)
-
Renders the Pointer.circle object onto the stage in green if down or red if up along with debug text.
Parameters:
Name Type Argument Default Description pointerPhaser.Pointer Description.
hideIfUpboolean <optional>
false Doesn't render the circle if the pointer is up.
downColorstring <optional>
'rgba(0,255,0,0.5)' The color the circle is rendered in if down.
upColorstring <optional>
'rgba(255,0,0,0.5)' The color the circle is rendered in if up (and hideIfUp is false).
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderPointInfo(sprite, x, y, color)
-
Renders Point coordinates in the given color.
Parameters:
Name Type Argument Default Description spritePhaser.Point Description.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderQuadTree(quadtree, color)
-
Visually renders a QuadTree to the display.
Parameters:
Name Type Description quadtreePhaser.QuadTree The quadtree to render.
colorstring The color of the lines in the quadtree.
- Source:
-
renderRectangle(rect, color, filled)
-
Renders a Rectangle.
Parameters:
Name Type Argument Default Description rectPhaser.Rectangle The Rectangle to render.
colorstring <optional>
Color of the debug info to be rendered (format is css color string).
filledboolean <optional>
true Render the rectangle as a fillRect (default, true) or a strokeRect (false)
- Source:
-
renderShape(shape, x, y, angle)
-
Parameters:
Name Type Description shapep2.Shape The shape to render.
xnumber The x coordinate of the Body to translate to.
ynumber The y coordinate of the Body to translate to.
anglenumber The angle of the Body to rotate to.
- Source:
-
renderShape(x, y, shape, offset, angle)
-
Parameters:
Name Type Description xnumber The x coordinate of the Body to translate to.
ynumber The y coordinate of the Body to translate to.
shapep2.Shape The shape to render.
offsetnumber -
anglenumber -
- Source:
-
renderShape(shape, x, y, angle)
-
Parameters:
Name Type Description shapep2.Shape The shape to render.
xnumber The x coordinate of the Body to translate to.
ynumber The y coordinate of the Body to translate to.
anglenumber The angle of the Body to rotate to.
- Source:
-
renderSoundInfo(sound, x, y, color)
-
Render Sound information, including decoded state, duration, volume and more.
Parameters:
Name Type Argument Default Description soundPhaser.Sound The sound object to debug.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderSpriteCoords(line, x, y, color)
-
Renders the sprite coordinates in local, positional and world space.
Parameters:
Name Type Argument Default Description linePhaser.Sprite The sprite to inspect.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderSpriteInfo(sprite, x, y, color)
-
Render debug infos (including name, bounds info, position and some other properties) about the Sprite.
Parameters:
Name Type Argument Default Description spritePhaser.Sprite Description.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderSpriteInputInfo(sprite, x, y, color)
-
Render Sprite Input Debug information.
Parameters:
Name Type Argument Default Description spritePhaser.Sprite The sprite to be rendered.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
'rgb(255,255,255)' color of the debug info to be rendered. (format is css color string).
- Source:
-
renderText(text, x, y, color, font)
-
Render text.
Parameters:
Name Type Argument Description textstring The line of text to draw.
xnumber X position of the debug info to be rendered.
ynumber Y position of the debug info to be rendered.
colorstring <optional>
Color of the debug info to be rendered (format is css color string).
fontstring The font of text to draw.
- Source:
-
splitline(text)
-
Internal method that outputs a single line of text split over as many columns as needed, one per parameter.
Parameters:
Name Type Description textstring The text to render. You can have as many columns of text as you want, just pass them as additional parameters.
- Source:
-
start(x, y, color, columnWidth)
-
Internal method that resets and starts the debug output values.
Parameters:
Name Type Argument Default Description xnumber <optional>
0 The X value the debug info will start from.
ynumber <optional>
0 The Y value the debug info will start from.
colorstring <optional>
'rgb(255,255,255)' The color the debug text will drawn in.
columnWidthnumber <optional>
0 The spacing between columns.
- Source:
-
stop()
-
Internal method that stops the debug output.
- Source: