new PIXI.Renderer (options) overrides
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options |
IRendererOptions |
<optional> |
The optional renderer parameters. |
|
options.width |
number |
<optional> |
800 |
The width of the screen. |
options.height |
number |
<optional> |
600 |
The height of the screen. |
options.view |
HTMLCanvasElement |
<optional> |
The canvas to use as a view, optional. |
|
options.useContextAlpha |
boolean |
<optional> |
true |
Pass-through value for canvas' context |
options.autoDensity |
boolean |
<optional> |
false |
Resizes renderer view in CSS pixels to allow for resolutions other than 1. |
options.antialias |
boolean |
<optional> |
false |
Sets antialias. If not available natively then FXAA antialiasing is used. |
options.resolution |
number |
<optional> |
PIXI.settings.RESOLUTION |
The resolution / device pixel ratio of the renderer. |
options.clearBeforeRender |
boolean |
<optional> |
true |
This sets if the renderer will clear
the canvas or not before the new render pass. If you wish to set this to false, you must set
preserveDrawingBuffer to |
options.preserveDrawingBuffer |
boolean |
<optional> |
false |
Enables drawing buffer preservation, enable this if you need to call toDataUrl on the WebGL context. |
options.backgroundColor |
number |
<optional> |
0x000000 |
The background color of the rendered area (shown if not transparent). |
options.backgroundAlpha |
number |
<optional> |
1 |
Value from 0 (fully transparent) to 1 (fully opaque). |
options.powerPreference |
string |
<optional> |
Parameter passed to WebGL context, set to "high-performance" for devices with dual graphics card. |
|
options.context |
object |
<optional> |
If WebGL context already exists, all parameters must be taken from it. |
Extends
Members
Collection of installed plugins. These are included by default in PIXI, but can be excluded by creating a custom build. Consult the README for more information about creating custom builds and excluding plugins.
Properties:
Name | Type | Description |
---|---|---|
accessibility |
PIXI.AccessibilityManager |
Support tabbing interactive elements. |
batch |
PIXI.BatchRenderer |
Batching of Sprite, Graphics and Mesh objects. |
extract |
PIXI.Extract |
Extract image data from renderer. |
interaction |
PIXI.InteractionManager |
Handles mouse, touch and pointer events. |
particle |
PIXI.ParticleRenderer |
Renderer for ParticleContainer objects. |
prepare |
PIXI.Prepare |
Pre-render display objects. |
tilingSprite |
PIXI.TilingSpriteRenderer |
Renderer for TilingSprite objects. |
batch PIXI.BatchSystem readonly
Batch system instance
buffer PIXI.BufferSystem readonly
Buffer system instance
context PIXI.ContextSystem readonly
Context system instance
Unique UID assigned to the renderer's WebGL context.
extract PIXI.Extract Deprecated : since 6.0.0 readonly
Please use plugins.extract
instead.
filter PIXI.FilterSystem readonly
Filter system instance
framebuffer PIXI.FramebufferSystem readonly
Framebuffer system instance
geometry PIXI.GeometrySystem readonly
Geometry system instance
WebGL context, set by this.context.
globalUniforms PIXI.UniformGroup
Global uniforms
mask PIXI.MaskSystem readonly
Mask system instance
multisample PIXI.MSAA_QUALITY readonly
The number of msaa samples of the canvas.
projection PIXI.ProjectionSystem readonly
Projection system instance
Flag if we are rendering to the screen vs renderTexture
- Default Value:
- true
renderTexture PIXI.RenderTextureSystem readonly
RenderTexture system instance
scissor PIXI.ScissorSystem readonly
Scissor system instance
shader PIXI.ShaderSystem readonly
Shader system instance
state PIXI.StateSystem readonly
State system instance
stencil PIXI.StencilSystem readonly
Stencil system instance
texture PIXI.TextureSystem readonly
Texture system instance
textureGC PIXI.TextureGCSystem readonly
Texture garbage collector system instance
Methods
Adds a plugin to the renderer.
Name | Type | Description |
---|---|---|
pluginName |
string |
The name of the plugin. |
ctor |
IRendererPluginConstructor |
The constructor function or class for the plugin. |
addSystem (ClassRef, name) this overrides
Add a new system to the renderer.
Name | Type | Description |
---|---|---|
ClassRef |
ISystemConstructor |
Class reference |
name |
string |
Property name for system, if not specified
will use a static |
Returns:
Type | Description |
---|---|
this | Return instance of renderer |
Clear the frame buffer.
destroy (removeView) void overrides
Removes everything from the renderer (event listeners, spritebatch, etc...)
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
removeView |
boolean |
<optional> |
false |
Removes the Canvas element from the DOM. See: https://github.com/pixijs/pixi.js/issues/2233 |
Renders the object to its WebGL view.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
displayObject |
PIXI.IRenderableObject |
The object to be rendered. |
||
options |
object |
<optional> |
Object to use for render options. |
|
options.renderTexture |
PIXI.RenderTexture |
<optional> |
The render texture to render to. |
|
options.clear |
boolean |
<optional> |
true |
Should the canvas be cleared before the new render. |
options.transform |
PIXI.Matrix |
<optional> |
A transform to apply to the render texture before rendering. |
|
options.skipUpdateTransform |
boolean |
<optional> |
false |
Should we skip the update transform pass? |
Please use the option
render arguments instead.
Name | Type | Attributes | Description |
---|---|---|---|
displayObject |
PIXI.IRenderableObject | ||
renderTexture |
PIXI.RenderTexture |
<optional> |
|
clear |
boolean |
<optional> |
|
transform |
PIXI.Matrix |
<optional> |
|
skipUpdateTransform |
boolean |
<optional> |
Resets the WebGL state so you can render things however you fancy!
Returns:
Type | Description |
---|---|
this | Returns itself. |
Resizes the WebGL view to the specified width and height.
Name | Type | Description |
---|---|---|
desiredScreenWidth |
number |
The desired width of the screen. |
desiredScreenHeight |
number |
The desired height of the screen. |
Events
Fired when the WebGL context is set.
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext |
WebGL context. |
Fired after rendering finishes.
Fired before rendering starts.
resize overrides
Fired after view has been resized.
Name | Type | Description |
---|---|---|
screenWidth |
number |
The new width of the screen. |
screenHeight |
number |
The new height of the screen. |
Inherited Properties
From class PIXI.AbstractRenderer
autoDensity boolean inherited
Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.
- Default Value:
- --
backgroundAlpha number inherited
The background color alpha. Setting this to 0 will make the canvas transparent.
backgroundColor number inherited
The background color to fill if not transparent
clearBeforeRender boolean inherited
This sets if the CanvasRenderer will clear the canvas or not before the new render pass. If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every frame to set the canvas background color. If the scene is transparent PixiJS 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.
height number readonly inherited
Same as view.height, actual number of pixels in the canvas by vertical.
- Default Value:
- 600
options object readonly inherited
The supplied constructor options.
plugins object readonly inherited
Collection of plugins.
preserveDrawingBuffer boolean inherited
The value of the preserveDrawingBuffer flag affects whether or not the contents of the stencil buffer is retained after rendering.
resolution number inherited
The resolution / device pixel ratio of the renderer.
- Default Value:
- PIXI.settings.RESOLUTION
screen PIXI.Rectangle inherited
Measurements of the screen. (0, 0, screenWidth, screenHeight).
Its safe to use as filterArea or hitArea for the whole stage.
type number inherited
The type of the renderer.
- Default Value:
- PIXI.RENDERER_TYPE.UNKNOWN
- See:
useContextAlpha boolean inherited
Pass-thru setting for the canvas' context alpha
property. This is typically
not something you need to fiddle with. If you want transparency, use backgroundAlpha
.
view HTMLCanvasElement inherited
The canvas element that everything is drawn to.
width number readonly inherited
Same as view.width, actual number of pixels in the canvas by horizontal.
- Default Value:
- 800
_backgroundColor number protected inherited
The background color as a number.
- Default Value:
- 0
_backgroundColorRgba Array<number> protected inherited
The background color as an [R, G, B, A] array.
_backgroundColorString string protected inherited
The background color as a string.
- Default Value:
- "#000000"
_lastObjectRendered PIXI.DisplayObject protected inherited
The last root object that the renderer tried to render.
- Default Value:
- undefined
Inherited Methods
From class PIXI.AbstractRenderer
generateTexture (displayObject, options) PIXI.RenderTexture inherited
Useful function that returns a texture of the display object that can then be used to create sprites This can be quite useful if your displayObject is complicated and needs to be reused multiple times.
Name | Type | Attributes | Description |
---|---|---|---|
displayObject |
PIXI.IRenderableObject |
The displayObject the object will be generated from. |
|
options |
object |
<optional> |
Generate texture options. |
options.scaleMode |
PIXI.SCALE_MODES |
The scale mode of the texture. |
|
options.resolution |
number |
The resolution / device pixel ratio of the texture being generated. |
|
options.region |
PIXI.Rectangle |
The region of the displayObject, that shall be rendered, if no region is specified, defaults to the local bounds of the displayObject. |
|
options.multisample |
PIXI.MSAA_QUALITY |
The number of samples of the frame buffer. |
Returns:
Type | Description |
---|---|
PIXI.RenderTexture | A texture of the graphics object. |
initPlugins (staticMap) void protected inherited
Initialize the plugins.
Name | Type | Description |
---|---|---|
staticMap |
object |
The dictionary of statically saved plugins. |