phaser - v4.0.0-rc.4
    Preparing search index...

    Type Alias GameConfig

    type GameConfig = {
        antialias?: boolean;
        antialiasGL?: boolean;
        audio?: AudioConfig;
        autoCenter?: CenterType;
        autoFocus?: boolean;
        autoMobileTextures?: boolean;
        autoRound?: boolean;
        backgroundColor?: string | number;
        banner?: boolean | BannerConfig;
        batchSize?: number;
        callbacks?: CallbacksConfig;
        canvas?: HTMLCanvasElement;
        canvasStyle?: string;
        clearBeforeRender?: boolean;
        context?: CanvasRenderingContext2D;
        customEnvironment?: boolean;
        desynchronized?: boolean;
        disableContextMenu?: boolean;
        dom?: DOMContainerConfig;
        expandParent?: boolean;
        failIfMajorPerformanceCaveat?: boolean;
        fps?: FPSConfig;
        fullscreenTarget?: HTMLElement | string | null;
        height?: number | string;
        images?: ImagesConfig;
        input?: boolean | InputConfig;
        loader?: LoaderConfig;
        max?: WidthHeight;
        maxLights?: number;
        maxTextures?: number;
        min?: WidthHeight;
        mipmapFilter?: string;
        mode?: ScaleModeType;
        parent?: HTMLElement | string | null;
        pathDetailThreshold?: number;
        physics?: PhysicsConfig;
        pixelArt?: boolean;
        plugins?: PluginObject | PluginObjectItem[];
        powerPreference?: string;
        premultipliedAlpha?: boolean;
        preserveDrawingBuffer?: boolean;
        render?: RenderConfig;
        resizeInterval?: number;
        roundPixels?: boolean;
        scale?: ScaleConfig;
        scene?: SceneType | SceneType[];
        seed?: string[];
        selfShadow?: boolean;
        skipUnreadyShaders?: boolean;
        smoothPixelArt?: boolean;
        stableSort?: number | boolean;
        title?: string;
        transparent?: boolean;
        type?: number;
        url?: string;
        version?: string;
        width?: number | string;
        zoom?: number;
    }
    Index

    Properties

    antialias?: boolean

    When set to true, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to false, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. false also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled.

    antialiasGL?: boolean

    Sets the antialias property when the WebGL context is created. Setting this value does not impact any subsequent textures that are created, or the canvas style attributes.

    audio?: AudioConfig

    The Audio Configuration object.

    autoCenter?: CenterType

    Automatically center the canvas within the parent?

    autoFocus?: boolean

    Automatically call window.focus() when the game boots. Usually necessary to capture input events if the game is in a separate frame.

    autoMobileTextures?: boolean

    If iOS or Android detected, automatically restrict WebGL to use 1 texture per batch. This can help performance on some devices.

    autoRound?: boolean

    Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices.

    backgroundColor?: string | number

    The background color of the game canvas. The default is black.

    banner?: boolean | BannerConfig

    Configuration for the banner printed in the browser console when the game starts.

    batchSize?: number

    The default WebGL batch size. Represents the number of quads that can be added to a single batch.

    callbacks?: CallbacksConfig

    Optional callbacks to run before or after game boot.

    canvas?: HTMLCanvasElement

    Provide your own Canvas element for Phaser to use instead of creating one.

    canvasStyle?: string

    CSS styles to apply to the game canvas instead of Phasers default styles.

    clearBeforeRender?: boolean

    Whether the game canvas will be cleared between each rendering frame.

    context?: CanvasRenderingContext2D

    Provide your own Canvas Context for Phaser to use, instead of creating one.

    customEnvironment?: boolean

    Is Phaser running under a custom (non-native web) environment? If so, set this to true to skip internal Feature detection. If true the renderType cannot be left as AUTO.

    desynchronized?: boolean

    When set to true it will create a desynchronized context for both 2D and WebGL. See https://developers.google.com/web/updates/2019/05/desynchronized for details.

    disableContextMenu?: boolean

    Disable the browser's default 'contextmenu' event (usually triggered by a right-button mouse click).

    The DOM Container configuration object.

    expandParent?: boolean

    Is the Scale Manager allowed to adjust the CSS height property of the parent and/or document body to be 100%?

    failIfMajorPerformanceCaveat?: boolean

    Let the browser abort creating a WebGL context if it judges performance would be unacceptable.

    fps?: FPSConfig

    Game loop configuration.

    fullscreenTarget?: HTMLElement | string | null

    The DOM element that will be sent into full screen mode, or its id. If undefined Phaser will create its own div and insert the canvas into it when entering fullscreen mode.

    height?: number | string

    The height of the game, in game pixels.

    images?: ImagesConfig

    Images configuration.

    input?: boolean | InputConfig

    Input configuration, or false to disable all game input.

    loader?: LoaderConfig

    Loader configuration.

    The maximum width the canvas can be scaled up to.

    maxLights?: number

    The maximum number of lights allowed to be visible within range of a single Camera in the LightManager.

    maxTextures?: number

    When in WebGL mode, this sets the maximum number of GPU Textures to use. The default, -1, will use all available units. The WebGL1 spec says all browsers should provide a minimum of 8.

    The minimum width and height the canvas can be scaled down to.

    mipmapFilter?: string

    The mipmap magFilter to be used when creating WebGL textures.

    The scale mode.

    parent?: HTMLElement | string | null

    The DOM element that will contain the game canvas, or its id. If undefined, or if the named element doesn't exist, the game canvas is appended to the document body. If null no parent will be used and you are responsible for adding the canvas to the dom.

    pathDetailThreshold?: number

    Threshold for combining points into a single path in the WebGL renderer for Graphics objects. This can be overridden at the Graphics object level.

    physics?: PhysicsConfig

    Physics configuration.

    pixelArt?: boolean

    Sets antialias to false and roundPixels to true. This is the best setting for pixel-art games.

    Plugins to install.

    powerPreference?: string

    "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use.

    premultipliedAlpha?: boolean

    In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha.

    preserveDrawingBuffer?: boolean

    If the value is true the WebGL buffers will not be cleared and will preserve their values until cleared or overwritten by the author.

    render?: RenderConfig

    Game renderer configuration.

    resizeInterval?: number

    How many ms should elapse before checking if the browser size has changed?

    roundPixels?: boolean

    Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property.

    scale?: ScaleConfig

    The Scale Manager configuration.

    scene?: SceneType | SceneType[]

    A scene or scenes to add to the game. If several are given, the first is started; the remainder are started only if they have { active: true }. See the sceneConfig argument in Phaser.Scenes.SceneManager#add.

    seed?: string[]

    Seed for the random number generator.

    selfShadow?: boolean

    On textured objects with lighting, this enables self-shadowing based on the diffuse map.

    skipUnreadyShaders?: boolean

    Avert stuttering during shader compilation, by enabling parallel shader compilation, where supported. Objects which request a shader that is not yet ready will not be drawn. This prevents stutter, but may cause "pop-in" of objects unless you use a pre-touch strategy.

    smoothPixelArt?: boolean

    WebGL only. Sets antialias to true and pixelArt to false. Texture-based Game Objects use special shader setting that preserve blocky pixels, but smooth the edges between the pixels. This is only visible when objects are scaled up; otherwise, antialias is simpler.

    stableSort?: number | boolean

    true or 1 = Use the built-in StableSort (needed for older browsers), false or 0 = Rely on ES2019 Array.sort being stable (modern browsers only), or -1 = Try and determine this automatically based on browser inspection (not guaranteed to work, errs on side of caution).

    title?: string

    The title of the game. Shown in the browser console.

    transparent?: boolean

    Whether the game canvas will be transparent. Boolean that indicates if the canvas contains an alpha channel. If set to false, the browser now knows that the backdrop is always opaque, which can speed up drawing of transparent content and images.

    type?: number

    Which renderer to use. Phaser.AUTO, Phaser.CANVAS, Phaser.HEADLESS, or Phaser.WEBGL. AUTO picks WEBGL if available, otherwise CANVAS.

    url?: string

    The URL of the game. Shown in the browser console.

    version?: string

    The version of the game. Shown in the browser console.

    width?: number | string

    The width of the game, in game pixels.

    zoom?: number

    Simple scale applied to the game canvas. 2 is double size, 0.5 is half size, etc.