How to use the @pixi/core.Renderer.create function in @pixi/core

To help you get started, we’ve selected a few @pixi/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pixijs / pixi.js / packages / canvas / canvas-renderer / src / Renderer.js View on Github external
import { Renderer } from '@pixi/core';
import { CanvasRenderer } from './CanvasRenderer';

// Reference to Renderer.create static function
const parentCreate = Renderer.create;

/**
 * Override the Renderer.create to fallback to use CanvasRenderer.
 * Also supports forceCanvas option with Application or autoDetectRenderer.
 * @private
 */
Renderer.create = function create(options)
{
    const forceCanvas = options && options.forceCanvas;

    if (!forceCanvas)
    {
        try
        {
            return parentCreate(options);
        }
        catch (err)
        {
            // swallow WebGL-unsupported error
        }
    }

    return new CanvasRenderer(options);
github pixijs / pixi.js / packages / canvas / canvas-renderer / src / Renderer.js View on Github external
import { Renderer } from '@pixi/core';
import { CanvasRenderer } from './CanvasRenderer';

// Reference to Renderer.create static function
const parentCreate = Renderer.create;

/**
 * Override the Renderer.create to fallback to use CanvasRenderer.
 * Also supports forceCanvas option with Application or autoDetectRenderer.
 * @private
 */
Renderer.create = function create(options)
{
    const forceCanvas = options && options.forceCanvas;

    if (!forceCanvas)
    {
        try
        {
            return parentCreate(options);
        }