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 349)

<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 354)

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

The Audio Configuration object.

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

<constant> autoCenter :Phaser.Scale.CenterType

Automatically center the canvas within the parent?

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

<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 193)

<constant> autoRound :number

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

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

<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 428)

<constant> bannerBackgroundColor :Array.<string>

The background colors of the banner.

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

<constant> bannerTextColor :string

The color of the banner text.

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

<constant> batchSize :number

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

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

<constant, nullable> canvas :HTMLCanvasElement

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

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

<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 156)

<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 391)

<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 151)

<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 161)

<constant> defaultImage :string

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

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

<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 454)

<constant> defaultPlugins :any

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

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

<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 364)

<constant> disableContextMenu :boolean

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

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

<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 205)

<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 200)

<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 74)

<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 401)

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

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

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

<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 94)

<constant> gameTitle :string

The title of the game.

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

<constant> gameURL :string

The URL of the game.

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

<constant> gameVersion :string

The version of the game.

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

<constant> height :number|string

The height of the underlying canvas, in pixels.

Type:
  • number | 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 309)

<constant> hidePhaser :boolean

Omit Phaser's name and version from the banner.

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

<constant> inputActivePointers :number

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

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

<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 287)

<constant> inputGamepadEventTarget :*

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

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

<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 212)

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

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

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

<constant> inputKeyboardEventTarget :*

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

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

<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 227)

<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 232)

<constant> inputMousePreventDefaultDown :boolean

Should mousedown DOM events have preventDefault called on them?

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

<constant> inputMousePreventDefaultMove :boolean

Should mousemove DOM events have preventDefault called on them?

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

<constant> inputMousePreventDefaultUp :boolean

Should mouseup DOM events have preventDefault called on them?

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

<constant> inputMousePreventDefaultWheel :boolean

Should wheel DOM events have preventDefault called on them?

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

<constant> inputSmoothFactor :number

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

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

<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 257)

<constant> inputTouchCapture :boolean

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

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

<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 262)

<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 282)

<constant> installGlobalPlugins :any

An array of global plugins to be installed.

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

<constant> installScenePlugins :any

An array of Scene level plugins to be installed.

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

<constant> loaderAsync :boolean

Should the XHR request use async or not?

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

<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 459)

<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 476)

<constant> loaderMaxParallelDownloads :number

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

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

<constant> loaderPassword :string

Optional password for all XHR requests.

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

<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 464)

<constant> loaderResponseType :string

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

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

<constant> loaderTimeout :number

Optional XHR timeout value, in ms.

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

<constant> loaderUser :string

Optional username for all XHR requests.

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

<constant> loaderWithCredentials :boolean

Optional XHR withCredentials value.

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

<constant> maxHeight :number

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

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

<constant> maxLights :number

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

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

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

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

<constant> maxWidth :number

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

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

<constant> minHeight :number

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

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

<constant> minWidth :number

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

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

<constant> mipmapFilter :string

Sets the mipmapFilter property when the WebGL renderer is created.

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

<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 578)

<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 64)

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

The Physics Configuration object.

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

<constant> pipeline :Phaser.Types.Core.PipelineConfig

An object mapping WebGL names to WebGLPipeline classes. These should be class constructors, not instances.

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

<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 374)

<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 444)

<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 406)

<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 439)

<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 396)

<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 141)

<constant> resizeInterval :number

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

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

<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 369)

<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 69)

<constant, nullable> sceneConfig :object

The default Scene configuration object.

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

<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 171)

<constant> transparent :boolean

Whether the game canvas will have a transparent background.

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

<constant> whiteImage :string

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

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

<constant> width :number|string

The width of the underlying canvas, in pixels.

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

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

The zoom factor, as used by the Scale Manager.

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