Class: Config

Phaser.Core. Config

The active game configuration settings, parsed from a Phaser.Types.Core.GameConfig object.


new Config( [GameConfig])

Parameters:
Name Type Argument Description
GameConfig Phaser.Types.Core.GameConfig <optional>

The configuration object for your Phaser Game instance.

Since: 3.0.0
Source: src/core/Config.js (Line 18)
See:

Members


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

Type:
  • boolean
Source: src/core/Config.js (Line 335)

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

Type:
  • boolean
Source: src/core/Config.js (Line 340)

<constant> audio :Phaser.Types.Core.AudioConfig

The Audio Configuration object.

Type:
Source: src/core/Config.js (Line 293)

<constant> autoCenter :Phaser.Scale.CenterType

Automatically center the canvas within the parent?

Type:
Source: src/core/Config.js (Line 89)

<constant> autoFocus :boolean

If true the window will automatically be given focus immediately and on any future mousedown event.

Type:
  • boolean
Source: src/core/Config.js (Line 199)

<constant> autoRound :integer

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

Type:
  • integer
Source: src/core/Config.js (Line 84)

<constant> backgroundColor :Phaser.Display.Color

The background color of the game canvas. The default is black. This value is ignored if transparent is set to true.

Type:
Source: src/core/Config.js (Line 408)

<constant> bannerBackgroundColor :Array.<string>

The background colors of the banner.

Type:
  • Array.<string>
Source: src/core/Config.js (Line 315)

<constant> bannerTextColor :string

The color of the banner text.

Type:
  • string
Source: src/core/Config.js (Line 310)

<constant> batchSize :integer

The default WebGL Batch size.

Type:
  • integer
Source: src/core/Config.js (Line 396)

<constant, nullable> canvas :HTMLCanvasElement

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

Type:
  • HTMLCanvasElement
Source: src/core/Config.js (Line 152)

<constant, nullable> canvasStyle :string

Optional CSS attributes to be set on the canvas object created by the renderer.

Type:
  • string
Source: src/core/Config.js (Line 162)

<constant> clearBeforeRender :boolean

Whether the game canvas will be cleared between each rendering frame. You can disable this if you have a full-screen background image or game object.

Type:
  • boolean
Source: src/core/Config.js (Line 376)

<constant, nullable> context :CanvasRenderingContext2D|WebGLRenderingContext

Force Phaser to use your own Canvas context instead of creating one.

Type:
  • CanvasRenderingContext2D | WebGLRenderingContext
Source: src/core/Config.js (Line 157)

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

Type:
  • boolean
Source: src/core/Config.js (Line 167)

<constant> defaultImage :string

A base64 encoded PNG that will be used as the default blank texture.

Type:
  • string
Source: src/core/Config.js (Line 550)

<constant> defaultPhysicsSystem :boolean|string

The default physics system. It will be started for each scene. Either 'arcade', 'impact' or 'matter'.

Type:
  • boolean | string
Source: src/core/Config.js (Line 433)

<constant> defaultPlugins :any

The plugins installed into every Scene (in addition to CoreScene and Global).

Type:
  • any
Source: src/core/Config.js (Line 542)

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

Type:
  • boolean
Source: src/core/Config.js (Line 350)

<constant> disableContextMenu :boolean

Set to true to disable the right-click context menu.

Type:
  • boolean
Source: src/core/Config.js (Line 288)

<constant, nullable> domBehindCanvas :boolean

Should the DOM Container that is created (if dom.createContainer is true) be positioned behind (true) or over the top (false, the default) of the game canvas?

Type:
  • boolean
Source: src/core/Config.js (Line 211)

<constant, nullable> domCreateContainer :boolean

Should the game create a div element to act as a DOM Container? Only enable if you're using DOM Element objects. You must provide a parent object if you use this feature.

Type:
  • boolean
Source: src/core/Config.js (Line 206)

<constant> expandParent :boolean

Is the Scale Manager allowed to adjust the CSS height property of the parent to be 100%?

Type:
  • boolean
Source: src/core/Config.js (Line 79)

<constant> failIfMajorPerformanceCaveat :boolean

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

Type:
  • boolean
Source: src/core/Config.js (Line 386)

<constant, nullable> fps :Phaser.Types.Core.FPSConfig

The Frame Rate Configuration object, as parsed by the Timestep class.

Type:
Source: src/core/Config.js (Line 325)

<constant, nullable> fullscreenTarget :HTMLElement|string

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.

Type:
  • HTMLElement | string
Source: src/core/Config.js (Line 99)

<constant> gameTitle :string

The title of the game.

Type:
  • string
Source: src/core/Config.js (Line 184)

<constant> gameURL :string

The URL of the game.

Type:
  • string
Source: src/core/Config.js (Line 189)

<constant> gameVersion :string

The version of the game.

Type:
  • string
Source: src/core/Config.js (Line 194)

<constant> height :integer|string

The height of the underlying canvas, in pixels.

Type:
  • integer | string
Source: src/core/Config.js (Line 54)

<constant> hideBanner :boolean

Don't write the banner line to the console.log.

Type:
  • boolean
Source: src/core/Config.js (Line 300)

<constant> hidePhaser :boolean

Omit Phaser's name and version from the banner.

Type:
  • boolean
Source: src/core/Config.js (Line 305)

<constant> inputActivePointers :integer

The number of Pointer objects created by default. In a mouse-only, or non-multi touch game, you can leave this as 1.

Type:
  • integer
Source: src/core/Config.js (Line 263)

<constant> inputGamepad :boolean

Enable the Gamepad Plugin. This can be disabled in games that don't need gamepad input.

Type:
  • boolean
Source: src/core/Config.js (Line 278)

<constant> inputGamepadEventTarget :*

The DOM Target to listen for gamepad events on. Defaults to window if not specified.

Type:
  • *
Source: src/core/Config.js (Line 283)

<constant> inputKeyboard :boolean

Enable the Keyboard Plugin. This can be disabled in games that don't need keyboard input.

Type:
  • boolean
Source: src/core/Config.js (Line 218)

<constant, nullable> inputKeyboardCapture :Array.<integer>

preventDefault will be called on every non-modified key which has a key code in this array. By default, it is empty.

Type:
  • Array.<integer>
Source: src/core/Config.js (Line 228)

<constant> inputKeyboardEventTarget :*

The DOM Target to listen for keyboard events on. Defaults to window if not specified.

Type:
  • *
Source: src/core/Config.js (Line 223)

<constant> inputMouse :boolean|object

Enable the Mouse Plugin. This can be disabled in games that don't need mouse input.

Type:
  • boolean | object
Source: src/core/Config.js (Line 233)

<constant> inputMouseCapture :boolean

Should mouse events be captured? I.e. have prevent default called on them.

Type:
  • boolean
Source: src/core/Config.js (Line 243)

<constant, nullable> inputMouseEventTarget :*

The DOM Target to listen for mouse events on. Defaults to the game canvas if not specified.

Type:
  • *
Source: src/core/Config.js (Line 238)

<constant> inputSmoothFactor :integer

The smoothing factor to apply during Pointer movement. See Phaser.Input.Pointer#smoothFactor.

Type:
  • integer
Source: src/core/Config.js (Line 268)

<constant> inputTouch :boolean

Enable the Touch Plugin. This can be disabled in games that don't need touch input.

Type:
  • boolean
Source: src/core/Config.js (Line 248)

<constant> inputTouchCapture :boolean

Should touch events be captured? I.e. have prevent default called on them.

Type:
  • boolean
Source: src/core/Config.js (Line 258)

<constant, nullable> inputTouchEventTarget :*

The DOM Target to listen for touch events on. Defaults to the game canvas if not specified.

Type:
  • *
Source: src/core/Config.js (Line 253)

<constant> inputWindowEvents :boolean

Should Phaser listen for input events on the Window? If you disable this, events like 'POINTER_UP_OUTSIDE' will no longer fire.

Type:
  • boolean
Source: src/core/Config.js (Line 273)

<constant> installGlobalPlugins :any

An array of global plugins to be installed.

Type:
  • any
Source: src/core/Config.js (Line 506)

<constant> installScenePlugins :any

An array of Scene level plugins to be installed.

Type:
  • any
Source: src/core/Config.js (Line 511)

<constant> loaderAsync :boolean

Should the XHR request use async or not?

Type:
  • boolean
Source: src/core/Config.js (Line 463)

<constant> loaderBaseURL :string

A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'.

Type:
  • string
Source: src/core/Config.js (Line 438)

<constant> loaderCrossOrigin :string|undefined

'anonymous', 'use-credentials', or undefined. If you're not making cross-origin requests, leave this as undefined. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes.

Type:
  • string | undefined
Source: src/core/Config.js (Line 453)

<constant> loaderMaxParallelDownloads :integer

Maximum parallel downloads allowed for resources (Default to 32).

Type:
  • integer
Source: src/core/Config.js (Line 448)

<constant> loaderPassword :string

Optional password for all XHR requests.

Type:
  • string
Source: src/core/Config.js (Line 473)

<constant> loaderPath :string

A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'.

Type:
  • string
Source: src/core/Config.js (Line 443)

<constant> loaderResponseType :string

The response type of the XHR request, e.g. blob, text, etc.

Type:
  • string
Source: src/core/Config.js (Line 458)

<constant> loaderTimeout :integer

Optional XHR timeout value, in ms.

Type:
  • integer
Source: src/core/Config.js (Line 478)

<constant> loaderUser :string

Optional username for all XHR requests.

Type:
  • string
Source: src/core/Config.js (Line 468)

<constant> loaderWithCredentials :boolean

Optional XHR withCredentials value.

Type:
  • boolean
Source: src/core/Config.js (Line 483)

<constant> maxHeight :integer

The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum.

Type:
  • integer
Source: src/core/Config.js (Line 119)

<constant> maxLights :integer

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

Type:
  • integer
Source: src/core/Config.js (Line 401)

<constant> maxWidth :integer

The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum.

Type:
  • integer
Source: src/core/Config.js (Line 109)

<constant> minHeight :integer

The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum.

Type:
  • integer
Source: src/core/Config.js (Line 114)

<constant> minWidth :integer

The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum.

Type:
  • integer
Source: src/core/Config.js (Line 104)

<constant> mipmapFilter :string

Sets the mipmapFilter property when the WebGL renderer is created.

Type:
  • string
Source: src/core/Config.js (Line 345)

<constant> missingImage :string

A base64 encoded PNG that will be used as the default texture when a texture is assigned that is missing or not loaded.

Type:
  • string
Source: src/core/Config.js (Line 555)

<constant, nullable> parent :*

A parent DOM element into which the canvas created by the renderer will be injected.

Type:
  • *
Source: src/core/Config.js (Line 69)

<constant> physics :Phaser.Types.Core.PhysicsConfig

The Physics Configuration object.

Type:
Source: src/core/Config.js (Line 428)

<constant> pixelArt :boolean

Prevent pixel art from becoming blurred when scaled. It will remain crisp (tells the WebGL renderer to automatically create textures using a linear filter mode).

Type:
  • boolean
Source: src/core/Config.js (Line 360)

<constant> postBoot :Phaser.Types.Core.BootCallback

A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded.

Type:
Source: src/core/Config.js (Line 423)

<constant> powerPreference :string

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

Type:
  • string
Source: src/core/Config.js (Line 391)

<constant> preBoot :Phaser.Types.Core.BootCallback

Called before Phaser boots. Useful for initializing anything not related to Phaser that Phaser may require while booting.

Type:
Source: src/core/Config.js (Line 418)

<constant> premultipliedAlpha :boolean

In WebGL mode, sets the drawing buffer to contain colors with pre-multiplied alpha.

Type:
  • boolean
Source: src/core/Config.js (Line 381)

<constant> renderType :number

Force Phaser to use a specific renderer. Can be CONST.CANVAS, CONST.WEBGL, CONST.HEADLESS or CONST.AUTO (default)

Type:
  • number
Source: src/core/Config.js (Line 147)

<constant> resizeInterval :integer

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

Type:
  • integer
Source: src/core/Config.js (Line 94)

<constant> resolution :number

The canvas device pixel resolution. Currently un-used.

Type:
  • number
Source: src/core/Config.js (Line 64)

<constant> roundPixels :boolean

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

Type:
  • boolean
Source: src/core/Config.js (Line 355)

<constant> scaleMode :Phaser.Scale.ScaleModeType

The scale mode as used by the Scale Manager. The default is zero, which is no scaling.

Type:
Source: src/core/Config.js (Line 74)

<constant, nullable> sceneConfig :object

The default Scene configuration object.

Type:
  • object
Source: src/core/Config.js (Line 172)

<constant> seed :Array.<string>

A seed which the Random Data Generator will use. If not given, a dynamic seed based on the time is used.

Type:
  • Array.<string>
Source: src/core/Config.js (Line 177)

<constant> transparent :boolean

Whether the game canvas will have a transparent background.

Type:
  • boolean
Source: src/core/Config.js (Line 371)

<constant> width :integer|string

The width of the underlying canvas, in pixels.

Type:
  • integer | string
Source: src/core/Config.js (Line 49)

<constant> zoom :Phaser.Scale.ZoomType|integer

The zoom factor, as used by the Scale Manager.

Type:
Source: src/core/Config.js (Line 59)