Class: Config

Phaser.Core. Config

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


new Config( [GameConfig])

Parameters:
Name Type Argument Description
GameConfig GameConfig <optional>

The configuration object for your Phaser Game instance.

Since: 3.0.0
Source: src/core/Config.js (Line 244)
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 561)

<constant> audio :AudioConfig

The Audio Configuration object.

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

<constant> autoCenter :Phaser.Scale.CenterType

Automatically center the canvas within the parent?

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

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

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

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

<constant> bannerBackgroundColor :Array.<string>

The background colors of the banner.

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

<constant> bannerTextColor :string

The color of the banner text.

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

<constant> batchSize :integer

The default WebGL Batch size.

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

<constant, nullable> canvas :HTMLCanvasElement

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

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

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

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

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

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

<constant> defaultImage :string

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

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

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

<constant> defaultPlugins :any

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

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

<constant> disableContextMenu :boolean

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

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

<constant, nullable> domBehindCanvas :boolean

EXPERIMENTAL: Do not currently use.

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

<constant, nullable> domCreateContainer :boolean

EXPERIMENTAL: Do not currently use.

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

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

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

<constant, nullable> fps :FPSConfig

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

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

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

<constant> gameTitle :string

The title of the game.

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

<constant> gameURL :string

The URL of the game.

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

<constant> gameVersion :string

The version of the game.

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

<constant> height :integer|string

The height of the underlying canvas, in pixels.

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

<constant> hideBanner :boolean

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

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

<constant> hidePhaser :boolean

Omit Phaser's name and version from the banner.

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

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

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

<constant> inputGamepadEventTarget :*

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

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

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

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

<constant> inputKeyboardEventTarget :*

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

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

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

<constant> inputMouseCapture :boolean

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

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

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

<constant> inputQueue :boolean

Should Phaser use a queued input system for native DOM Events or not?

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

<constant> inputSmoothFactor :integer

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

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

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

<constant> inputTouchCapture :boolean

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

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

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

<constant> installGlobalPlugins :any

An array of global plugins to be installed.

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

<constant> installScenePlugins :any

An array of Scene level plugins to be installed.

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

<constant> loaderAsync :boolean

Should the XHR request use async or not?

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

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

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

<constant> loaderMaxParallelDownloads :integer

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

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

<constant> loaderPassword :string

Optional password for all XHR requests.

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

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

<constant> loaderResponseType :string

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

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

<constant> loaderTimeout :integer

Optional XHR timeout value, in ms.

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

<constant> loaderUser :string

Optional username for all XHR requests.

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

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

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

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

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

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

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

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

<constant> physics :PhysicsConfig

The Physics Configuration object.

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

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

<constant> postBoot :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 634)

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

<constant> preBoot :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 629)

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

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

<constant> resizeInterval :integer

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

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

<constant> resolution :number

The canvas device pixel resolution. Currently un-used.

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

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

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

<constant, nullable> sceneConfig :object

The default Scene configuration object.

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

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

<constant> transparent :boolean

Whether the game canvas will have a transparent background.

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

<constant> width :integer|string

The width of the underlying canvas, in pixels.

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

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

The zoom factor, as used by the Scale Manager.

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