Class: Config

Phaser.Boot. 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/boot/Config.js (Line 236)
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/boot/Config.js (Line 542)

<constant> audio :AudioConfig

The Audio Configuration object.

Type:
Source: src/boot/Config.js (Line 500)

<constant> autoCenter :integer

Automatically center the canvas within the parent? 0 = No centering. 1 = Center both horizontally and vertically. 2 = Center horizontally. 3 = Center vertically.

Type:
  • integer
Source: src/boot/Config.js (Line 307)

<constant> autoFocus :boolean

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

Type:
  • boolean
Source: src/boot/Config.js (Line 411)

<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/boot/Config.js (Line 302)

<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/boot/Config.js (Line 600)

<constant> bannerBackgroundColor :Array.<string>

The background colors of the banner.

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

<constant> bannerTextColor :string

The color of the banner text.

Type:
  • string
Source: src/boot/Config.js (Line 517)

<constant> batchSize :integer

The default WebGL Batch size.

Type:
  • integer
Source: src/boot/Config.js (Line 588)

<constant, nullable> canvas :HTMLCanvasElement

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

Type:
  • HTMLCanvasElement
Source: src/boot/Config.js (Line 364)

<constant, nullable> canvasStyle :string

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

Type:
  • string
Source: src/boot/Config.js (Line 374)

<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/boot/Config.js (Line 568)

<constant, nullable> context :CanvasRenderingContext2D|WebGLRenderingContext

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

Type:
  • CanvasRenderingContext2D | WebGLRenderingContext
Source: src/boot/Config.js (Line 369)

<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/boot/Config.js (Line 379)

<constant> defaultImage :string

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

Type:
  • string
Source: src/boot/Config.js (Line 737)

<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/boot/Config.js (Line 625)

<constant> defaultPlugins :any

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

Type:
  • any
Source: src/boot/Config.js (Line 729)

<constant> disableContextMenu :boolean

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

Type:
  • boolean
Source: src/boot/Config.js (Line 495)

<constant, nullable> domBehindCanvas :boolean

EXPERIMENTAL: Do not currently use.

Type:
  • boolean
Source: src/boot/Config.js (Line 423)

<constant, nullable> domCreateContainer :boolean

EXPERIMENTAL: Do not currently use.

Type:
  • boolean
Source: src/boot/Config.js (Line 418)

<constant> expandParent :boolean

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

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

<constant> failIfMajorPerformanceCaveat :boolean

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

Type:
  • boolean
Source: src/boot/Config.js (Line 578)

<constant, nullable> fps :FPSConfig

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

Type:
Source: src/boot/Config.js (Line 532)

<constant> gameTitle :string

The title of the game.

Type:
  • string
Source: src/boot/Config.js (Line 396)

<constant> gameURL :string

The URL of the game.

Type:
  • string
Source: src/boot/Config.js (Line 401)

<constant> gameVersion :string

The version of the game.

Type:
  • string
Source: src/boot/Config.js (Line 406)

<constant> height :integer|string

The height of the underlying canvas, in pixels.

Type:
  • integer | string
Source: src/boot/Config.js (Line 272)

<constant> hideBanner :boolean

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

Type:
  • boolean
Source: src/boot/Config.js (Line 507)

<constant> hidePhaser :boolean

Omit Phaser's name and version from the banner.

Type:
  • boolean
Source: src/boot/Config.js (Line 512)

<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/boot/Config.js (Line 475)

<constant> inputGamepad :boolean

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

Type:
  • boolean
Source: src/boot/Config.js (Line 485)

<constant> inputGamepadEventTarget :*

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

Type:
  • *
Source: src/boot/Config.js (Line 490)

<constant> inputKeyboard :boolean

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

Type:
  • boolean
Source: src/boot/Config.js (Line 430)

<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/boot/Config.js (Line 440)

<constant> inputKeyboardEventTarget :*

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

Type:
  • *
Source: src/boot/Config.js (Line 435)

<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/boot/Config.js (Line 445)

<constant> inputMouseCapture :boolean

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

Type:
  • boolean
Source: src/boot/Config.js (Line 455)

<constant, nullable> inputMouseEventTarget :*

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

Type:
  • *
Source: src/boot/Config.js (Line 450)

<constant> inputSmoothFactor :integer

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

Type:
  • integer
Source: src/boot/Config.js (Line 480)

<constant> inputTouch :boolean

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

Type:
  • boolean
Source: src/boot/Config.js (Line 460)

<constant> inputTouchCapture :boolean

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

Type:
  • boolean
Source: src/boot/Config.js (Line 470)

<constant, nullable> inputTouchEventTarget :*

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

Type:
  • *
Source: src/boot/Config.js (Line 465)

<constant> installGlobalPlugins :any

An array of global plugins to be installed.

Type:
  • any
Source: src/boot/Config.js (Line 693)

<constant> installScenePlugins :any

An array of Scene level plugins to be installed.

Type:
  • any
Source: src/boot/Config.js (Line 698)

<constant> loaderAsync :boolean

Should the XHR request use async or not?

Type:
  • boolean
Source: src/boot/Config.js (Line 655)

<constant> loaderBaseURL :string

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

Type:
  • string
Source: src/boot/Config.js (Line 630)

<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/boot/Config.js (Line 645)

<constant> loaderMaxParallelDownloads :integer

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

Type:
  • integer
Source: src/boot/Config.js (Line 640)

<constant> loaderPassword :string

Optional password for all XHR requests.

Type:
  • string
Source: src/boot/Config.js (Line 665)

<constant> loaderPath :string

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

Type:
  • string
Source: src/boot/Config.js (Line 635)

<constant> loaderResponseType :string

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

Type:
  • string
Source: src/boot/Config.js (Line 650)

<constant> loaderTimeout :integer

Optional XHR timeout value, in ms.

Type:
  • integer
Source: src/boot/Config.js (Line 670)

<constant> loaderUser :string

Optional username for all XHR requests.

Type:
  • string
Source: src/boot/Config.js (Line 660)

<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/boot/Config.js (Line 332)

<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/boot/Config.js (Line 593)

<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/boot/Config.js (Line 322)

<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/boot/Config.js (Line 327)

<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/boot/Config.js (Line 317)

<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/boot/Config.js (Line 742)

<constant, nullable> parent :*

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

Type:
  • *
Source: src/boot/Config.js (Line 287)

<constant> physics :PhysicsConfig

The Physics Configuration object.

Type:
Source: src/boot/Config.js (Line 620)

<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/boot/Config.js (Line 552)

<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/boot/Config.js (Line 615)

<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/boot/Config.js (Line 583)

<constant> preBoot :BootCallback

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

Type:
Source: src/boot/Config.js (Line 610)

<constant> premultipliedAlpha :boolean

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

Type:
  • boolean
Source: src/boot/Config.js (Line 573)

<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/boot/Config.js (Line 359)

<constant> resizeInterval :integer

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

Type:
  • integer
Source: src/boot/Config.js (Line 312)

<constant> resolution :number

The canvas device pixel resolution.

Type:
  • number
Source: src/boot/Config.js (Line 282)

<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/boot/Config.js (Line 547)

<constant> scaleMode :integer

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

Type:
  • integer
Source: src/boot/Config.js (Line 292)

<constant, nullable> sceneConfig :object

The default Scene configuration object.

Type:
  • object
Source: src/boot/Config.js (Line 384)

<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/boot/Config.js (Line 389)

<constant> transparent :boolean

Whether the game canvas will have a transparent background.

Type:
  • boolean
Source: src/boot/Config.js (Line 563)

<constant> width :integer|string

The width of the underlying canvas, in pixels.

Type:
  • integer | string
Source: src/boot/Config.js (Line 267)

<constant> zoom :number

The zoom factor, as used by the Scale Manager.

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