The CanvasRenderer draws the Stage and all its content onto a 2d canvas. This renderer should be used for browsers that do not support webGL.
Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything :)
Name | Type | Description |
---|---|---|
game | PhaserGame | A reference to the Phaser Game instance |
Whether the render view should be resized automatically
Instance of a PIXI.CanvasMaskManager, handles masking when using the canvas renderer
This sets if the CanvasRenderer will clear the canvas or not before the new render pass.
If the Stage is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.
If the Stage is transparent Pixi will use clearRect to clear the canvas every frame.
Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.
The canvas 2d context that everything is drawn with
Internal var.
The height of the canvas view
Boolean flag controlling canvas refresh.
The render session is just a bunch of parameter used for rendering
The resolution of the canvas.
Whether the render view is transparent
The renderer type.
The canvas element that everything is drawn to.
The width of the canvas view
Removes everything from the renderer and optionally removes the Canvas DOM element.
Name | Type | Argument | Default | Description |
---|---|---|---|---|
removeView | Boolean | <optional> | true | Removes the Canvas element from the DOM. |
Renders the DisplayObjectContainer, usually the Phaser.Stage, to this canvas view.
Name | Type | Description |
---|---|---|
root | PhaserStage | PIXIDisplayObjectContainer | The root element to be rendered. |
Resizes the canvas view to the specified width and height
Name | Type | Description |
---|---|---|
width | Number | the new width of the canvas view |
height | Number | the new height of the canvas view |
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/PIXI.CanvasRenderer.html