PIXI. CanvasRenderer

new CanvasRenderer(width, height, options)

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 :)

Parameters:
Name Type Argument Default Description
width Number <optional>
800

the width of the canvas view

height Number <optional>
600

the height of the canvas view

options Object <optional>

The optional renderer parameters

Source - pixi/renderers/canvas/CanvasRenderer.js, line 5

Members

autoResize :Boolean

Whether the render view should be resized automatically

Source - pixi/renderers/canvas/CanvasRenderer.js, line 75

CanvasMaskManager :PIXI.CanvasMaskManager

Instance of a PIXI.CanvasMaskManager, handles masking when using the canvas renderer

Source - pixi/renderers/canvas/CanvasRenderer.js, line 138

clearBeforeRender :Boolean

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.

Source - pixi/renderers/canvas/CanvasRenderer.js, line 55

context :CanvasRenderingContext2D

The canvas 2d context that everything is drawn with

Source - pixi/renderers/canvas/CanvasRenderer.js, line 112

count :Number

Internal var.

Source - pixi/renderers/canvas/CanvasRenderer.js, line 130

height :Number

The height of the canvas view

Default Value:
  • 600
Source - pixi/renderers/canvas/CanvasRenderer.js, line 92

refresh :Boolean

Boolean flag controlling canvas refresh.

Source - pixi/renderers/canvas/CanvasRenderer.js, line 119

renderSession :Object

The render session is just a bunch of parameter used for rendering

Source - pixi/renderers/canvas/CanvasRenderer.js, line 145

resolution :Number

The resolution of the canvas.

Source - pixi/renderers/canvas/CanvasRenderer.js, line 47

transparent :Boolean

Whether the render view is transparent

Source - pixi/renderers/canvas/CanvasRenderer.js, line 67

type :Number

The renderer type.

Source - pixi/renderers/canvas/CanvasRenderer.js, line 39

view :HTMLCanvasElement

The canvas element that everything is drawn to.

Source - pixi/renderers/canvas/CanvasRenderer.js, line 104

width :Number

The width of the canvas view

Default Value:
  • 800
Source - pixi/renderers/canvas/CanvasRenderer.js, line 83

Methods

destroy(removeView)

Removes everything from the renderer and optionally removes the Canvas DOM element.

Parameters:
Name Type Argument Default Description
removeView Boolean <optional>
true

Removes the Canvas element from the DOM.

Source - pixi/renderers/canvas/CanvasRenderer.js, line 221

render(stage)

Renders the Stage to this canvas view

Parameters:
Name Type Description
stage PIXI.Stage

the Stage element to be rendered

Source - pixi/renderers/canvas/CanvasRenderer.js, line 181

resize(width, height)

Resizes the canvas view to the specified width and height

Parameters:
Name Type Description
width Number

the new width of the canvas view

height Number

the new height of the canvas view

Source - pixi/renderers/canvas/CanvasRenderer.js, line 243
Phaser Copyright © 2012-2015 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-alpha10 on Wed Jul 29 2015 14:58:02 GMT+0100 (GMT Daylight Time) using the DocStrap template.