Phaser API Documentation

  Version: 
GameConfig
Properties:
name type arguments Default description
width number | string <optional> 1024

The width of the game, in game pixels.

height number | string <optional> 768

The height of the game, in game pixels.

zoom number <optional> 1

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

type number <optional> CONST.AUTO

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

parent HTMLElement | string <optional>

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.

canvas HTMLCanvasElement <optional> null

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

canvasStyle string <optional> null

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

customEnvironment boolean <optional> false

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.

context CanvasRenderingContext2D <optional>

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

scene function | Array.<function()> | Phaser.Scene | Array.<Phaser.Scene> | Phaser.Types.Scenes.SettingsConfig | Array.<Phaser.Types.Scenes.SettingsConfig> | Phaser.Types.Scenes.CreateSceneFromObjectConfig | Array.<Phaser.Types.Scenes.CreateSceneFromObjectConfig> <optional> null

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 Array.<string> <optional>

Seed for the random number generator.

title string <optional> ''

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

url string <optional> 'http://phaser.io'

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

version string <optional> ''

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

autoFocus boolean <optional> true

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

input boolean | Phaser.Types.Core.InputConfig <optional>

Input configuration, or false to disable all game input.

disableContextMenu boolean <optional> false

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

transparent boolean <optional> false

Whether the game canvas will have a transparent background.

banner boolean | Phaser.Types.Core.BannerConfig <optional> false

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

dom Phaser.Types.Core.DOMContainerConfig <optional>

The DOM Container configuration object.

fps Phaser.Types.Core.FPSConfig <optional>

Game loop configuration.

render Phaser.Types.Core.RenderConfig <optional>

Game renderer configuration.

backgroundColor string | number <optional> 0x000000

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

callbacks Phaser.Types.Core.CallbacksConfig <optional>

Optional callbacks to run before or after game boot.

loader Phaser.Types.Core.LoaderConfig <optional>

Loader configuration.

images Phaser.Types.Core.ImagesConfig <optional>

Images configuration.

physics Phaser.Types.Core.PhysicsConfig <optional>

Physics configuration.

plugins Phaser.Types.Core.PluginObject | Array.<Phaser.Types.Core.PluginObjectItem> <optional>

Plugins to install.

scale Phaser.Types.Core.ScaleConfig <optional>

The Scale Manager configuration.

audio Phaser.Types.Core.AudioConfig <optional>

The Audio Configuration object.

pipeline Phaser.Types.Core.PipelineConfig <optional>

A WebGL Pipeline configuration object. Can also be part of the RenderConfig.

Type:
object
Since: 3.0.0