- Source: src/core/typedefs/index.js (Line 7)
Type Definitions
-
AudioConfig
-
Config object containing various sound settings.
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/AudioConfig.js (Line 1)
- See:
Properties:
Name Type Argument Default Description disableWebAudio
boolean <optional>
false Use HTML5 Audio instead of Web Audio.
context
AudioContext <optional>
An existing Web Audio context.
noAudio
boolean <optional>
false Disable all audio output.
-
BannerConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/BannerConfig.js (Line 1)
Properties:
Name Type Argument Default Description hidePhaser
boolean <optional>
false Omit Phaser's name and version from the banner.
text
string <optional>
'#ffffff' The color of the banner text.
background
Array.<string> <optional>
The background colors of the banner.
-
BootCallback(game)
-
Parameters:
Name Type Description game
Phaser.Game The game.
- Since: 3.0.0
- Source: src/core/typedefs/BootCallback.js (Line 1)
-
CallbacksConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/CallbacksConfig.js (Line 1)
Properties:
Name Type Argument Default Description preBoot
Phaser.Types.Core.BootCallback <optional>
Phaser.Types.Core.NOOP A function to run at the start of the boot sequence.
postBoot
Phaser.Types.Core.BootCallback <optional>
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.
-
DOMContainerConfig
-
Type:
- object
- Since: 3.12.0
- Source: src/core/typedefs/DOMContainerConfig.js (Line 1)
Properties:
Name Type Argument Default Description createContainer
boolean <optional>
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 <optional>
false 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? -
FPSConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/FPSConfig.js (Line 1)
Properties:
Name Type Argument Default Description min
number <optional>
5 The minimum acceptable rendering rate, in frames per second.
target
number <optional>
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.
forceSetTimeOut
boolean <optional>
false Use setTimeout instead of requestAnimationFrame to run the game loop.
deltaHistory
number <optional>
10 Calculate the average frame delta from this many consecutive frame intervals.
panicMax
number <optional>
120 The amount of frames the time step counts before we trust the delta values again.
smoothStep
boolean <optional>
true Apply delta smoothing during the game update to help avoid spikes?
-
GameConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/GameConfig.js (Line 1)
Properties:
Name Type Argument 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. Ifnull
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. Iftrue
therenderType
cannot be left asAUTO
.context
CanvasRenderingContext2D <optional>
Provide your own Canvas Context for Phaser to use, instead of creating one.
scene
Phaser.Scene | Array.<Phaser.Scene> | Phaser.Types.Scenes.SettingsConfig | Array.<Phaser.Types.Scenes.SettingsConfig> | Phaser.Types.Scenes.CreateSceneFromObjectConfig | Array.<Phaser.Types.Scenes.CreateSceneFromObjectConfig> | function | Array.<function()> <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 thesceneConfig
argument inPhaser.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
. -
GamepadInputConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/GamepadInputConfig.js (Line 1)
Properties:
Name Type Argument Default Description target
* <optional>
window Where the Gamepad Manager listens for gamepad input events.
-
ImagesConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/ImagesConfig.js (Line 1)
Properties:
Name Type Argument Description default
string <optional>
A base64 encoded image file to use as the 'default' texture.
missing
string <optional>
A base64 encoded image file to use as the 'missing' texture.
white
string <optional>
A base64 encoded image file to use as the 'white' texture.
-
InputConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/InputConfig.js (Line 1)
Properties:
Name Type Argument Default Description keyboard
boolean | Phaser.Types.Core.KeyboardInputConfig <optional>
true Keyboard input configuration.
true
uses the default configuration andfalse
disables keyboard input.mouse
boolean | Phaser.Types.Core.MouseInputConfig <optional>
true Mouse input configuration.
true
uses the default configuration andfalse
disables mouse input.touch
boolean | Phaser.Types.Core.TouchInputConfig <optional>
true Touch input configuration.
true
uses the default configuration andfalse
disables touch input.gamepad
boolean | Phaser.Types.Core.GamepadInputConfig <optional>
false Gamepad input configuration.
true
enables gamepad input.activePointers
number <optional>
1 The maximum number of touch pointers. See Phaser.Input.InputManager#pointers.
smoothFactor
number <optional>
0 The smoothing factor to apply during Pointer movement. See Phaser.Input.Pointer#smoothFactor.
windowEvents
boolean <optional>
true Should Phaser listen for input events on the Window? If you disable this, events like 'POINTER_UP_OUTSIDE' will no longer fire.
-
KeyboardInputConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/KeyboardInputConfig.js (Line 1)
Properties:
Name Type Argument Default Description target
* <optional>
window Where the Keyboard Manager listens for keyboard input events.
capture
Array.<number> <optional>
<nullable>
preventDefault
will be called on every non-modified key which has a key code in this array. By default it is empty. -
LoaderConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/LoaderConfig.js (Line 1)
Properties:
Name Type Argument Default Description baseURL
string <optional>
A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'.
path
string <optional>
A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'.
maxParallelDownloads
number <optional>
32 The maximum number of resources the loader will start loading at once.
crossOrigin
string | undefined <optional>
'anonymous', 'use-credentials', or
undefined
. If you're not making cross-origin requests, leave this asundefined
. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes.responseType
string <optional>
The response type of the XHR request, e.g.
blob
,text
, etc.async
boolean <optional>
true Should the XHR request use async or not?
user
string <optional>
Optional username for all XHR requests.
password
string <optional>
Optional password for all XHR requests.
timeout
number <optional>
0 Optional XHR timeout value, in ms.
-
MouseInputConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/MouseInputConfig.js (Line 1)
Properties:
Name Type Argument Default Description target
* <optional>
null Where the Mouse Manager listens for mouse input events. The default is the game canvas.
preventDefaultDown
boolean <optional>
true If
true
the DOMmousedown
event will havepreventDefault
set.preventDefaultUp
boolean <optional>
true If
true
the DOMmouseup
event will havepreventDefault
set.preventDefaultMove
boolean <optional>
true If
true
the DOMmousemove
event will havepreventDefault
set.preventDefaultWheel
boolean <optional>
true If
true
the DOMwheel
event will havepreventDefault
set. -
NOOP()
-
This callback type is completely empty, a no-operation.
- Since: 3.0.0
- Source: src/core/typedefs/NOOP.js (Line 1)
-
PhysicsConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/PhysicsConfig.js (Line 1)
Properties:
Name Type Argument Description default
string <optional>
The default physics system. It will be started for each scene. Phaser provides 'arcade', 'impact', and 'matter'.
arcade
Phaser.Types.Physics.Arcade.ArcadeWorldConfig <optional>
Arcade Physics configuration.
matter
Phaser.Types.Physics.Matter.MatterWorldConfig <optional>
Matter Physics configuration.
-
PipelineConfig
-
Type:
- object
- Since: 3.50.0
- Source: src/core/typedefs/PipelineConfig.js (Line 1)
Properties:
Name Type Description name
string The name of the pipeline. Must be unique within the Pipeline Manager.
pipeline
Phaser.Renderer.WebGL.WebGLPipeline The pipeline class. This should be a constructable object, not an instance of a class.
-
PluginObject
-
Type:
- object
- Since: 3.8.0
- Source: src/core/typedefs/PluginObject.js (Line 1)
Properties:
Name Type Argument Description global
Array.<Phaser.Types.Core.PluginObjectItem> <optional>
<nullable>
Global plugins to install.
scene
Array.<Phaser.Types.Core.PluginObjectItem> <optional>
<nullable>
Scene plugins to install.
default
Array.<string> <optional>
The default set of scene plugins (names).
defaultMerge
Array.<string> <optional>
Plugins to add to the default set of scene plugins.
-
PluginObjectItem
-
Type:
- object
- Since: 3.8.0
- Source: src/core/typedefs/PluginObjectItem.js (Line 1)
Properties:
Name Type Argument Description key
string <optional>
A key to identify the plugin in the Plugin Manager.
plugin
* <optional>
The plugin itself. Usually a class/constructor.
start
boolean <optional>
Whether the plugin should be started automatically.
systemKey
string <optional>
For a scene plugin, add the plugin to the scene's systems object under this key (
this.sys.KEY
, from the scene).sceneKey
string <optional>
For a scene plugin, add the plugin to the scene object under this key (
this.KEY
, from the scene).mapping
string <optional>
If this plugin is to be injected into the Scene Systems, this is the property key map used.
data
* <optional>
Arbitrary data passed to the plugin's init() method.
Examples
// Global plugin { key: 'BankPlugin', plugin: BankPluginV3, start: true, data: { gold: 5000 } }
// Scene plugin { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' }
-
RenderConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/RenderConfig.js (Line 1)
Properties:
Name Type Argument Default Description antialias
boolean <optional>
true When set to
true
, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set tofalse
, 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.antialiasGL
boolean <optional>
true 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.desynchronized
boolean <optional>
false 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.pixelArt
boolean <optional>
false Sets
antialias
to false androundPixels
to true. This is the best setting for pixel-art games.roundPixels
boolean <optional>
false Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property.
transparent
boolean <optional>
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 <optional>
true Whether the game canvas will be cleared between each rendering frame.
premultipliedAlpha
boolean <optional>
true In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha.
failIfMajorPerformanceCaveat
boolean <optional>
false Let the browser abort creating a WebGL context if it judges performance would be unacceptable.
powerPreference
string <optional>
'default' "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use.
batchSize
number <optional>
4096 The default WebGL batch size. Represents the number of quads that can be added to a single batch.
maxLights
number <optional>
10 The maximum number of lights allowed to be visible within range of a single Camera in the LightManager.
maxTextures
number <optional>
-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 <optional>
'LINEAR' The mipmap magFilter to be used when creating WebGL textures.
pipline
Phaser.Types.Core.PipelineConfig <optional>
The WebGL Pipeline configuration object.
-
ScaleConfig
-
Type:
- object
- Since: 3.16.0
- Source: src/core/typedefs/ScaleConfig.js (Line 1)
Properties:
Name Type Argument Default Description width
number | string <optional>
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 <optional>
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 <optional>
1 The zoom value of the game canvas.
parent
HTMLElement | string <optional>
<nullable>
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 inserted directly into the document body. Ifnull
no parent will be used and you are responsible for adding the canvas to your environment.expandParent
boolean <optional>
true Is the Scale Manager allowed to adjust the CSS height property of the parent and/or document body to be 100%?
mode
Phaser.Scale.ScaleModeType <optional>
Phaser.Scale.ScaleModes.NONE The scale mode.
min
WidthHeight <optional>
The minimum width and height the canvas can be scaled down to.
max
WidthHeight <optional>
The maximum width the canvas can be scaled up to.
autoRound
boolean <optional>
false Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices.
autoCenter
Phaser.Scale.CenterType <optional>
Phaser.Scale.Center.NO_CENTER Automatically center the canvas within the parent?
resizeInterval
number <optional>
500 How many ms should elapse before checking if the browser size has changed?
fullscreenTarget
HTMLElement | string <optional>
<nullable>
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. -
TimeStepCallback(time, average, interpolation)
-
Parameters:
Name Type Description time
number The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
average
number The Delta Average.
interpolation
number Interpolation - how far between what is expected and where we are?
- Since: 3.0.0
- Source: src/core/typedefs/TimeStepCallback.js (Line 1)
-
TouchInputConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/TouchInputConfig.js (Line 1)
Properties:
Name Type Argument Default Description target
* <optional>
null Where the Touch Manager listens for touch input events. The default is the game canvas.
capture
boolean <optional>
true Whether touch input events have preventDefault() called on them.
-
WidthHeight
-
Type:
- object
- Since: 3.16.0
- Source: src/core/typedefs/WidthHeight.js (Line 1)
Properties:
Name Type Argument Default Description width
number <optional>
0 The width.
height
number <optional>
0 The height.