Options
All
  • Public
  • Public/Protected
  • All
Menu

The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer} and PIXI.Renderer which can be used for rendering a PixiJS scene.

abstract
memberof

PIXI

Hierarchy

Index

Constructors

constructor

Properties

Protected _backgroundColor

_backgroundColor: number

_backgroundColorRgba

_backgroundColorRgba: number[]

Protected _backgroundColorString

_backgroundColorString: string

_lastObjectRendered

_lastObjectRendered: IRenderableObject

Readonly autoDensity

autoDensity: boolean

Optional clearBeforeRender

clearBeforeRender: boolean

Readonly options

Readonly plugins

Readonly preserveDrawingBuffer

preserveDrawingBuffer: boolean

resolution

resolution: number

Readonly screen

screen: Rectangle

Readonly type

Readonly useContextAlpha

useContextAlpha: boolean | "notMultiplied"

Readonly view

view: HTMLCanvasElement

Static prefixed

prefixed: string | boolean

Accessors

backgroundAlpha

  • get backgroundAlpha(): number
  • set backgroundAlpha(value: number): void
  • The background color alpha. Setting this to 0 will make the canvas transparent.

    member

    {number}

    Returns number

  • The background color alpha. Setting this to 0 will make the canvas transparent.

    Parameters

    • value: number

    Returns void

backgroundColor

  • get backgroundColor(): number
  • set backgroundColor(value: number): void
  • The background color to fill if not transparent

    member

    {number}

    Returns number

  • The background color to fill if not transparent

    Parameters

    • value: number

    Returns void

height

  • get height(): number
  • Same as view.height, actual number of pixels in the canvas by vertical.

    member

    {number}

    readonly
    default

    600

    Returns number

width

  • get width(): number
  • Same as view.width, actual number of pixels in the canvas by horizontal.

    member

    {number}

    readonly
    default

    800

    Returns number

Methods

addListener

destroy

  • destroy(removeView?: boolean): void
  • Removes everything from the renderer and optionally removes the Canvas DOM element.

    Parameters

    • Optional removeView: boolean

    Returns void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Calls each of the listeners registered for a given event.

    Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): (string | symbol)[]
  • Return an array listing the events for which the emitter has registered listeners.

    Returns (string | symbol)[]

generateTexture

  • 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.

    Parameters

    • displayObject: IRenderableObject

      The displayObject the object will be generated from.

    • Optional scaleMode: SCALE_MODES

      The scale mode of the texture.

    • Optional resolution: number

      The resolution / device pixel ratio of the texture being generated.

    • Optional region: Rectangle

    Returns RenderTexture

    A texture of the graphics object.

Protected initPlugins

  • Initialize the plugins.

    Parameters

    Returns void

listenerCount

  • listenerCount(event: string | symbol): number
  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

    Returns number

listeners

  • Return the listeners registered for a given event.

    Parameters

    • event: string | symbol

    Returns ListenerFn[]

off

  • Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns AbstractRenderer

on

  • Add a listener for a given event.

    Parameters

    • event: string | symbol
    • fn: ListenerFn
    • Optional context: any

    Returns AbstractRenderer

once

  • Add a one-time listener for a given event.

    Parameters

    • event: string | symbol
    • fn: ListenerFn
    • Optional context: any

    Returns AbstractRenderer

removeAllListeners

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: string | symbol

    Returns AbstractRenderer

removeListener

  • Remove the listeners of a given event.

    Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns AbstractRenderer

Abstract render

resize

  • resize(screenWidth: number, screenHeight: number): void
  • Resizes the screen and canvas to the specified width and height. Canvas dimensions are multiplied by resolution.

    Parameters

    • screenWidth: number

      The new width of the screen.

    • screenHeight: number

      The new height of the screen.

    Returns void

Generated using TypeDoc