AudioConfig
<static> AudioConfig
Config object containing various sound settings.
name | type | optional | default | description |
---|---|---|---|---|
disableWebAudio | boolean | Yes | false | Use HTML5 Audio instead of Web Audio. |
context | AudioContext | Yes | An existing Web Audio context. | |
noAudio | boolean | Yes | false | Disable all audio output. |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/AudioConfig.js#L1
Since: 3.0.0
BannerConfig
<static> BannerConfig
name | type | optional | default | description |
---|---|---|---|---|
hidePhaser | boolean | Yes | false | Omit Phaser's name and version from the banner. |
text | string | Yes | "'#ffffff'" | The color of the banner text. |
background | Array.<string> | Yes | The background colors of the banner. |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/BannerConfig.js#L1
Since: 3.0.0
BootCallback
<static> BootCallback
Type: function
Member of: Phaser.Types.Core
Source: src/core/typedefs/BootCallback.js#L1
Since: 3.0.0
CallbacksConfig
<static> CallbacksConfig
name | type | optional | default | description |
---|---|---|---|---|
preBoot | Yes | "Phaser.Types.Core.NOOP" | A function to run at the start of the boot sequence. | |
postBoot | Yes | "Phaser.Types.Core.NOOP" | 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: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/CallbacksConfig.js#L1
Since: 3.0.0
DOMContainerConfig
<static> DOMContainerConfig
name | type | optional | default | description |
---|---|---|---|---|
createContainer | boolean | Yes | false | 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. |
behindCanvas | boolean | Yes | false | Should the DOM Container that is created (if |
pointerEvents | string | Yes | "'none'" | The default |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/DOMContainerConfig.js#L1
Since: 3.12.0
FPSConfig
<static> FPSConfig
name | type | optional | default | description |
---|---|---|---|---|
min | number | Yes | 5 | The minimum acceptable rendering rate, in frames per second. |
target | number | Yes | 60 | The optimum rendering rate, in frames per second. This does not enforce the fps rate, it merely tells Phaser what rate is considered optimal for this game. |
limit | number | Yes | 0 | Enforces an fps rate limit that the game step will run at, regardless of browser frequency. 0 means 'no limit'. Never set this higher than RAF can handle. |
forceSetTimeOut | boolean | Yes | false | Use setTimeout instead of requestAnimationFrame to run the game loop. |
deltaHistory | number | Yes | 10 | Calculate the average frame delta from this many consecutive frame intervals. |
panicMax | number | Yes | 120 | The amount of frames the time step counts before we trust the delta values again. |
smoothStep | boolean | Yes | true | Apply delta smoothing during the game update to help avoid spikes? |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/FPSConfig.js#L1
Since: 3.0.0
GameConfig
<static> GameConfig
name | type | optional | default | description |
---|---|---|---|---|
width | number | string | Yes | 1024 | The width of the game, in game pixels. |
height | number | string | Yes | 768 | The height of the game, in game pixels. |
zoom | number | Yes | 1 | Simple scale applied to the game canvas. 2 is double size, 0.5 is half size, etc. |
type | number | Yes | "CONST.AUTO" | Which renderer to use. Phaser.AUTO, Phaser.CANVAS, Phaser.HEADLESS, or Phaser.WEBGL. AUTO picks WEBGL if available, otherwise CANVAS. |
stableSort | number | boolean | Yes | -1 |
|
parent | HTMLElement | string | null | Yes | |
canvas | HTMLCanvasElement | Yes | null | Provide your own Canvas element for Phaser to use instead of creating one. |
canvasStyle | string | Yes | null | CSS styles to apply to the game canvas instead of Phasers default styles. |
customEnvironment | boolean | Yes | false | Is Phaser running under a custom (non-native web) environment? If so, set this to |
context | CanvasRenderingContext2D | Yes | Provide your own Canvas Context for Phaser to use, instead of creating one. | |
scene | Phaser.Types.Scenes.SceneType | Array.<Phaser.Types.Scenes.SceneType> | Yes | 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 |
seed | Array.<string> | Yes | Seed for the random number generator. | |
title | string | Yes | "''" | The title of the game. Shown in the browser console. |
url | string | Yes | The URL of the game. Shown in the browser console. | |
version | string | Yes | "''" | The version of the game. Shown in the browser console. |
autoFocus | boolean | Yes | 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 | Yes | Input configuration, or | |
disableContextMenu | boolean | Yes | false | Disable the browser's default 'contextmenu' event (usually triggered by a right-button mouse click). |
banner | boolean | Phaser.Types.Core.BannerConfig | Yes | false | Configuration for the banner printed in the browser console when the game starts. |
dom | Yes | The DOM Container configuration object. | ||
fps | Yes | Game loop configuration. | ||
render | Yes | Game renderer configuration. | ||
callbacks | Yes | Optional callbacks to run before or after game boot. | ||
loader | Yes | Loader configuration. | ||
images | Yes | Images configuration. | ||
physics | Yes | Physics configuration. | ||
plugins | Phaser.Types.Core.PluginObject | Array.<Phaser.Types.Core.PluginObjectItem> | Yes | Plugins to install. | |
scale | Yes | The Scale Manager configuration. | ||
audio | Yes | The Audio Configuration object. | ||
pipeline | Yes | The WebGL Pipeline configuration object. Can also be part of the | ||
backgroundColor | string | number | Yes | "0x000000" | The background color of the game canvas. The default is black. |
antialias | boolean | Yes | true | When set to |
antialiasGL | boolean | Yes | true | Sets the |
desynchronized | boolean | Yes | false | When set to |
pixelArt | boolean | Yes | false | Sets |
roundPixels | boolean | Yes | false | Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. |
transparent | boolean | Yes | false | Whether the game canvas will be transparent. Boolean that indicates if the canvas contains an alpha channel. If set to false, the browser now knows that the backdrop is always opaque, which can speed up drawing of transparent content and images. |
clearBeforeRender | boolean | Yes | true | Whether the game canvas will be cleared between each rendering frame. |
preserveDrawingBuffer | boolean | Yes | false | If the value is true the WebGL buffers will not be cleared and will preserve their values until cleared or overwritten by the author. |
premultipliedAlpha | boolean | Yes | true | In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha. |
failIfMajorPerformanceCaveat | boolean | Yes | false | Let the browser abort creating a WebGL context if it judges performance would be unacceptable. |
powerPreference | string | Yes | "'default'" | "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. |
batchSize | number | Yes | 4096 | The default WebGL batch size. Represents the number of quads that can be added to a single batch. |
maxLights | number | Yes | 10 | The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. |
maxTextures | number | Yes | -1 | 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. |
mipmapFilter | string | Yes | "'LINEAR'" | The mipmap magFilter to be used when creating WebGL textures. |
autoMobilePipeline | boolean | Yes | true | Automatically enable the Mobile Pipeline if iOS or Android detected? |
defaultPipeline | string | Yes | "'MultiPipeline'" | The WebGL Pipeline that Game Objects will use by default. Set to 'MultiPipeline' as standard. |
expandParent | boolean | Yes | true | Is the Scale Manager allowed to adjust the CSS height property of the parent and/or document body to be 100%? |
mode | Yes | "Phaser.Scale.ScaleModes.NONE" | The scale mode. | |
min | WidthHeight | Yes | The minimum width and height the canvas can be scaled down to. | |
max | WidthHeight | Yes | The maximum width the canvas can be scaled up to. | |
autoRound | boolean | Yes | false | Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. |
autoCenter | Yes | "Phaser.Scale.Center.NO_CENTER" | Automatically center the canvas within the parent? | |
resizeInterval | number | Yes | 500 | How many ms should elapse before checking if the browser size has changed? |
fullscreenTarget | HTMLElement | string | Yes | The DOM element that will be sent into full screen mode, or its | |
disablePreFX | boolean | Yes | false | Disables the automatic creation of the Pre FX Pipelines. If disabled, you cannot use the built-in Pre FX on Game Objects. |
disablePostFX | boolean | Yes | false | Disables the automatic creation of the Post FX Pipelines. If disabled, you cannot use the built-in Post FX on Game Objects. |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/GameConfig.js#L1
Since: 3.0.0
GamepadInputConfig
<static> GamepadInputConfig
name | type | optional | default | description |
---|---|---|---|---|
target | * | Yes | "window" | Where the Gamepad Manager listens for gamepad input events. |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/GamepadInputConfig.js#L1
Since: 3.0.0
ImagesConfig
<static> ImagesConfig
name | type | optional | description |
---|---|---|---|
default | string | undefined | null | Yes |
missing | string | undefined | null | Yes |
white | string | undefined | null | Yes |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/ImagesConfig.js#L1
Since: 3.0.0
InputConfig
<static> InputConfig
name | type | optional | default | description |
---|---|---|---|---|
keyboard | boolean | Phaser.Types.Core.KeyboardInputConfig | Yes | true | Keyboard input configuration. |
mouse | boolean | Phaser.Types.Core.MouseInputConfig | Yes | true | Mouse input configuration. |
touch | boolean | Phaser.Types.Core.TouchInputConfig | Yes | true | Touch input configuration. |
gamepad | boolean | Phaser.Types.Core.GamepadInputConfig | Yes | false | Gamepad input configuration. |
activePointers | number | Yes | 1 | The maximum number of touch pointers. See {@link Phaser.Input.InputManager#pointers}. |
smoothFactor | number | Yes | 0 | The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. |
windowEvents | boolean | Yes | true | Should Phaser listen for input events on the Window? If you disable this, events like 'POINTER_UP_OUTSIDE' will no longer fire. |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/InputConfig.js#L1
Since: 3.0.0
KeyboardInputConfig
<static> KeyboardInputConfig
name | type | optional | default | description |
---|---|---|---|---|
target | * | Yes | "window" | Where the Keyboard Manager listens for keyboard input events. |
capture | Array.<number> | Yes |
|
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/KeyboardInputConfig.js#L1
Since: 3.0.0
LoaderConfig
<static> LoaderConfig
name | type | optional | default | description |
---|---|---|---|---|
baseURL | string | Yes | A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. | |
path | string | Yes | A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. | |
maxParallelDownloads | number | Yes | 32 | The maximum number of resources the loader will start loading at once. |
crossOrigin | string | undefined | Yes | 'anonymous', 'use-credentials', or | |
responseType | string | Yes | The response type of the XHR request, e.g. | |
async | boolean | Yes | true | Should the XHR request use async or not? |
user | string | Yes | Optional username for all XHR requests. | |
password | string | Yes | Optional password for all XHR requests. | |
timeout | number | Yes | 0 | Optional XHR timeout value, in ms. |
localScheme | Array.<string> | Yes | An optional array of schemes that the Loader considers as being 'local' files. Defaults to: | |
withCredentials | boolean | Yes | false | Optional XHR withCredentials value. |
imageLoadType | string | Yes | "'XHR'" | Optional load type for image, |
maxRetries | number | Yes | 2 | The number of times to retry the file load if it fails. |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/LoaderConfig.js#L1
Since: 3.0.0
MouseInputConfig
<static> MouseInputConfig
name | type | optional | default | description |
---|---|---|---|---|
target | * | Yes | null | Where the Mouse Manager listens for mouse input events. The default is the game canvas. |
preventDefaultDown | boolean | Yes | true | If |
preventDefaultUp | boolean | Yes | true | If |
preventDefaultMove | boolean | Yes | true | If |
preventDefaultWheel | boolean | Yes | true | If |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/MouseInputConfig.js#L1
Since: 3.0.0
NOOP
<static> NOOP
This callback type is completely empty, a no-operation.
Type: function
Member of: Phaser.Types.Core
Source: src/core/typedefs/NOOP.js#L1
Since: 3.0.0
PhysicsConfig
<static> PhysicsConfig
name | type | optional | description |
---|---|---|---|
default | string | Yes | The default physics system. It will be started for each scene. Phaser provides 'arcade', 'impact', and 'matter'. |
arcade | Yes | Arcade Physics configuration. | |
matter | Yes | Matter Physics configuration. |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/PhysicsConfig.js#L1
Since: 3.0.0
PipelineConfig
<static> PipelineConfig
name | type | optional | default | description |
---|---|---|---|---|
frameInc | number | Yes | 32 | Sets the |
Type: Array.<Phaser.Renderer.WebGL.WebGLPipeline>, object.<string, Phaser.Renderer.WebGL.WebGLPipeline>
Member of: Phaser.Types.Core
Source: src/core/typedefs/PipelineConfig.js#L1
Since: 3.50.0
PluginObject
<static> PluginObject
name | type | optional | description |
---|---|---|---|
global | Yes | Global plugins to install. | |
scene | Yes | Scene plugins to install. | |
default | Array.<string> | Yes | The default set of scene plugins (names). |
defaultMerge | Array.<string> | Yes | Plugins to add to the default set of scene plugins. |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/PluginObject.js#L1
Since: 3.8.0
PluginObjectItem
<static> PluginObjectItem
name | type | optional | description |
---|---|---|---|
key | string | Yes | A key to identify the plugin in the Plugin Manager. |
plugin | * | Yes | The plugin itself. Usually a class/constructor. |
start | boolean | Yes | Whether the plugin should be started automatically. |
systemKey | string | Yes | For a scene plugin, add the plugin to the scene's systems object under this key ( |
sceneKey | string | Yes | For a scene plugin, add the plugin to the scene object under this key ( |
mapping | string | Yes | If this plugin is to be injected into the Scene Systems, this is the property key map used. |
data | * | Yes | Arbitrary data passed to the plugin's init() method. |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/PluginObjectItem.js#L1
Since: 3.8.0
RenderConfig
<static> RenderConfig
name | type | optional | default | description |
---|---|---|---|---|
antialias | boolean | Yes | true | When set to |
antialiasGL | boolean | Yes | true | Sets the |
desynchronized | boolean | Yes | false | When set to |
pixelArt | boolean | Yes | false | Sets |
roundPixels | boolean | Yes | false | Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. |
transparent | boolean | Yes | false | Whether the game canvas will be transparent. Boolean that indicates if the canvas contains an alpha channel. If set to false, the browser now knows that the backdrop is always opaque, which can speed up drawing of transparent content and images. |
clearBeforeRender | boolean | Yes | true | Whether the game canvas will be cleared between each rendering frame. |
preserveDrawingBuffer | boolean | Yes | false | If the value is true the WebGL buffers will not be cleared and will preserve their values until cleared or overwritten by the author. |
premultipliedAlpha | boolean | Yes | true | In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha. |
failIfMajorPerformanceCaveat | boolean | Yes | false | Let the browser abort creating a WebGL context if it judges performance would be unacceptable. |
powerPreference | string | Yes | "'default'" | "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. |
batchSize | number | Yes | 4096 | The default WebGL batch size. Represents the number of quads that can be added to a single batch. |
maxLights | number | Yes | 10 | The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. |
maxTextures | number | Yes | -1 | 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. |
mipmapFilter | string | Yes | "''" | The mipmap magFilter to be used when creating WebGL textures. Don't set unless you wish to create mipmaps. Set to one of the following: 'NEAREST', 'LINEAR', 'NEAREST_MIPMAP_NEAREST', 'LINEAR_MIPMAP_NEAREST', 'NEAREST_MIPMAP_LINEAR' or 'LINEAR_MIPMAP_LINEAR'. |
pipeline | Yes | The WebGL Pipeline configuration object. | ||
autoMobilePipeline | boolean | Yes | true | Automatically enable the Mobile Pipeline if iOS or Android detected? |
defaultPipeline | string | Yes | "'MultiPipeline'" | The WebGL Pipeline that Game Objects will use by default. Set to 'MultiPipeline' as standard. |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/RenderConfig.js#L1
Since: 3.0.0
ScaleConfig
<static> ScaleConfig
name | type | optional | default | description |
---|---|---|---|---|
width | number | string | Yes | 1024 | The base width of your game. Can be an integer or a string: '100%'. If a string it will only work if you have set a parent element that has a size. |
height | number | string | Yes | 768 | The base height of your game. Can be an integer or a string: '100%'. If a string it will only work if you have set a parent element that has a size. |
zoom | Phaser.Scale.ZoomType | number | Yes | 1 | The zoom value of the game canvas. |
parent | HTMLElement | string | Yes | The DOM element that will contain the game canvas, or its | |
expandParent | boolean | Yes | true | Is the Scale Manager allowed to adjust the CSS height property of the parent and/or document body to be 100%? |
mode | Yes | "Phaser.Scale.ScaleModes.NONE" | The scale mode. | |
min | WidthHeight | Yes | The minimum width and height the canvas can be scaled down to. | |
max | WidthHeight | Yes | The maximum width the canvas can be scaled up to. | |
snap | WidthHeight | Yes | Set the snapping values used by the Scale Manager when resizing the canvas. See | |
autoRound | boolean | Yes | false | Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. |
autoCenter | Yes | "Phaser.Scale.Center.NO_CENTER" | Automatically center the canvas within the parent? | |
resizeInterval | number | Yes | 500 | How many ms should elapse before checking if the browser size has changed? |
fullscreenTarget | HTMLElement | string | Yes | The DOM element that will be sent into full screen mode, or its |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/ScaleConfig.js#L1
Since: 3.16.0
TimeStepCallback
<static> TimeStepCallback
Type: function
Member of: Phaser.Types.Core
Source: src/core/typedefs/TimeStepCallback.js#L1
Since: 3.0.0
TouchInputConfig
<static> TouchInputConfig
name | type | optional | default | description |
---|---|---|---|---|
target | * | Yes | null | Where the Touch Manager listens for touch input events. The default is the game canvas. |
capture | boolean | Yes | true | Whether touch input events have preventDefault() called on them. |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/TouchInputConfig.js#L1
Since: 3.0.0
WidthHeight
<static> WidthHeight
name | type | optional | default | description |
---|---|---|---|---|
width | number | Yes | 0 | The width. |
height | number | Yes | 0 | The height. |
Type: object
Member of: Phaser.Types.Core
Source: src/core/typedefs/WidthHeight.js#L1
Since: 3.16.0